-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
550 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/RealTime/GameConnection/Patches/WorldInfoPanelPatches.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// <copyright file="WorldInfoPanelPatches.cs" company="dymanoid"> | ||
// Copyright (c) dymanoid. All rights reserved. | ||
// </copyright> | ||
|
||
namespace RealTime.GameConnection.Patches | ||
{ | ||
using System; | ||
using System.Reflection; | ||
using RealTime.UI; | ||
using SkyTools.Patching; | ||
|
||
/// <summary> | ||
/// A static class that provides the patch objects for the world info panel game methods. | ||
/// </summary> | ||
internal static class WorldInfoPanelPatches | ||
{ | ||
/// <summary>Gets or sets the customized citizen information panel.</summary> | ||
public static CustomCitizenInfoPanel CitizenInfoPanel { get; set; } | ||
|
||
/// <summary>Gets or sets the customized vehicle information panel.</summary> | ||
public static CustomVehicleInfoPanel VehicleInfoPanel { get; set; } | ||
|
||
/// <summary>Gets the patch for the update bindings method.</summary> | ||
public static IPatch UpdateBindings { get; } = new WorldInfoPanel_UpdateBindings(); | ||
|
||
private sealed class WorldInfoPanel_UpdateBindings : PatchBase | ||
{ | ||
protected override MethodInfo GetMethod() | ||
{ | ||
return typeof(WorldInfoPanel).GetMethod( | ||
"UpdateBindings", | ||
BindingFlags.Instance | BindingFlags.NonPublic, | ||
null, | ||
new Type[0], | ||
new ParameterModifier[0]); | ||
} | ||
|
||
#pragma warning disable SA1313 // Parameter names must begin with lower-case letter | ||
private static void Postfix(WorldInfoPanel __instance, ref InstanceID ___m_InstanceID) | ||
{ | ||
switch (__instance) | ||
{ | ||
case CitizenWorldInfoPanel _: | ||
CitizenInfoPanel?.UpdateCustomInfo(ref ___m_InstanceID); | ||
break; | ||
|
||
case VehicleWorldInfoPanel _: | ||
VehicleInfoPanel?.UpdateCustomInfo(ref ___m_InstanceID); | ||
break; | ||
} | ||
} | ||
#pragma warning restore SA1313 // Parameter names must begin with lower-case letter | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.