Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MapQuickAccess v1.0.0
MapQuickAccess.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("REPOJP")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("zabuMod")] [assembly: AssemblyTitle("zabuMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [BepInPlugin("REPOJP.MapQuickAccess", "MapQuickAccess", "1.0.0")] public class MapQuickAccessPlugin : BaseUnityPlugin { public const string PluginGuid = "REPOJP.MapQuickAccess"; public const string PluginName = "MapQuickAccess"; public const string PluginVersion = "1.0.0"; private Harmony harmony; internal static ManualLogSource Log; internal static ConfigEntry<bool> EnableMod; internal static ConfigEntry<bool> AllowWhileSprinting; internal static ConfigEntry<bool> AllowWhileDisabled; internal static ConfigEntry<bool> AllowWhileTumbling; internal static ConfigEntry<bool> AllowWhileAimTargetActive; internal static ConfigEntry<bool> AllowInMenuLevel; internal static ConfigEntry<bool> AllowWithTextInputActive; internal static ConfigEntry<bool> InstantOpenClose; internal static ConfigEntry<bool> EnableOpenCloseShake; internal static ConfigEntry<bool> KeepOpenSound; internal static ConfigEntry<bool> KeepLoopSound; internal static ConfigEntry<bool> DisableMoveSlowdown; internal static ConfigEntry<bool> DisableCameraZoomOverride; internal static ConfigEntry<bool> DisableCameraNoiseOverride; internal static ConfigEntry<bool> DisableCameraTopFade; internal static ConfigEntry<bool> DisableCameraBobMultiplier; internal static ConfigEntry<bool> KeepAimVisible; private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; InitializeConfig(); harmony = new Harmony("REPOJP.MapQuickAccess"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MapQuickAccess 1.0.0 loaded"); } private void InitializeConfig() { EnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableMod", true, "Enable this mod. このMODを有効化します"); AllowWhileSprinting = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWhileSprinting", true, "Allow opening the map while sprinting. 走り中でもマップを開けるようにします"); AllowWhileDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWhileDisabled", true, "Allow opening the map while disabled. 死亡無効化中でもマップを開けるようにします"); AllowWhileTumbling = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWhileTumbling", true, "Allow opening the map while tumbling. タンブル中でもマップを開けるようにします"); AllowWhileAimTargetActive = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWhileAimTargetActive", true, "Allow opening the map while aim target mode is active. エイム対象状態でもマップを開けるようにします"); AllowInMenuLevel = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowInMenuLevel", true, "Allow opening the map in menu levels. メニュー階層でもマップを開けるようにします"); AllowWithTextInputActive = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWithTextInputActive", true, "Allow opening the map while text input is active. テキスト入力中でもマップを開けるようにします"); InstantOpenClose = ((BaseUnityPlugin)this).Config.Bind<bool>("Opening Behavior", "InstantOpenClose", true, "Open and close the map instantly without the vanilla animation. バニラの開閉アニメーションを使わず即時開閉します"); EnableOpenCloseShake = ((BaseUnityPlugin)this).Config.Bind<bool>("Opening Behavior", "EnableOpenCloseShake", true, "Enable camera shake when opening or closing the map. マップ開閉時のカメラシェイクを有効化します"); KeepOpenSound = ((BaseUnityPlugin)this).Config.Bind<bool>("Opening Behavior", "KeepOpenSound", true, "Keep the map open and close sounds. マップの開閉音を維持します"); KeepLoopSound = ((BaseUnityPlugin)this).Config.Bind<bool>("Opening Behavior", "KeepLoopSound", true, "Keep the map loop sound while the map is active. マップ表示中のループ音を維持します"); DisableMoveSlowdown = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableMoveSlowdown", true, "Disable movement slowdown while the map is open. マップ表示中の移動速度低下を無効化します"); DisableCameraZoomOverride = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableCameraZoomOverride", true, "Disable the map zoom override while the map is open. マップ表示中のCameraZoom変更を無効化します"); DisableCameraNoiseOverride = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableCameraNoiseOverride", true, "Disable the map camera noise override while the map is open. マップ表示中のCameraNoise変更を無効化します"); DisableCameraTopFade = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableCameraTopFade", true, "Disable the top fade effect while the map is open. マップ表示中の上部フェードを無効化します"); DisableCameraBobMultiplier = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableCameraBobMultiplier", true, "Disable the camera bob multiplier change while the map is open. マップ表示中のカメラボブ倍率変更を無効化します"); KeepAimVisible = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "KeepAimVisible", false, "Keep the aim UI visible while the map is open. マップ表示中もエイムUIを隠さないようにします"); } } [HarmonyPatch(typeof(MapToolController), "Update")] public static class MapToolControllerUpdatePatch { private static readonly FieldInfo FieldActive = AccessTools.Field(typeof(MapToolController), "Active"); private static readonly FieldInfo FieldActivePrev = AccessTools.Field(typeof(MapToolController), "ActivePrev"); private static readonly FieldInfo FieldPhotonView = AccessTools.Field(typeof(MapToolController), "photonView"); private static readonly FieldInfo FieldHideLerp = AccessTools.Field(typeof(MapToolController), "HideLerp"); private static readonly FieldInfo FieldHideScale = AccessTools.Field(typeof(MapToolController), "HideScale"); private static readonly FieldInfo FieldMapToggled = AccessTools.Field(typeof(MapToolController), "mapToggled"); private static readonly FieldInfo FieldDisplayJointAngleDiff = AccessTools.Field(typeof(MapToolController), "DisplayJointAngleDiff"); private static readonly FieldInfo FieldDisplayJointAnglePreviousX = AccessTools.Field(typeof(MapToolController), "DisplayJointAnglePreviousX"); private static bool Prefix(MapToolController __instance) { if (!MapQuickAccessPlugin.EnableMod.Value) { return true; } if ((Object)(object)__instance == (Object)null || (Object)(object)InputManager.instance == (Object)null || (Object)(object)PlayerController.instance == (Object)null || (Object)(object)Map.Instance == (Object)null || (Object)(object)CameraAim.Instance == (Object)null) { return true; } try { RunPatchedUpdate(__instance); } catch (Exception ex) { MapQuickAccessPlugin.Log.LogError((object)("Failure: MapToolController.Update patch\n" + ex)); return true; } return false; } private static void RunPatchedUpdate(MapToolController instance) { PhotonView photonView = GetPhotonView(instance); bool flag = !GameManager.Multiplayer() || ((Object)(object)photonView != (Object)null && photonView.IsMine); if (flag) { ProcessLocalInput(instance); ProcessLocalUi(instance); } ProcessStateChange(instance, photonView, flag); ProcessAnimationAndCamera(instance, photonView, flag); ProcessSoundLoop(instance); } private static void ProcessLocalInput(MapToolController instance) { bool value = GetBool(instance, FieldActive); bool flag = GetBool(instance, FieldMapToggled); float @float = GetFloat(instance, FieldHideLerp); bool flag2 = MapQuickAccessPlugin.AllowWhileDisabled.Value || !instance.PlayerAvatar.isDisabled; bool flag3 = MapQuickAccessPlugin.AllowWhileTumbling.Value || !instance.PlayerAvatar.isTumbling; bool flag4 = MapQuickAccessPlugin.AllowWhileAimTargetActive.Value || !CameraAim.Instance.AimTargetActive; bool flag5 = MapQuickAccessPlugin.AllowInMenuLevel.Value || !SemiFunc.MenuLevel(); bool flag6 = MapQuickAccessPlugin.AllowWithTextInputActive.Value || SemiFunc.NoTextInputsActive(); if (flag2 && flag3 && flag4 && flag5 && flag6) { if (InputManager.instance.InputToggleGet((InputKey)8)) { if (SemiFunc.InputDown((InputKey)8)) { flag = !flag; } } else { flag = false; } bool flag7 = MapQuickAccessPlugin.AllowWhileSprinting.Value || !PlayerController.instance.sprinting; if ((SemiFunc.InputHold((InputKey)8) || flag || Map.Instance.debugActive) && flag7) { if (MapQuickAccessPlugin.InstantOpenClose.Value || @float >= 1f) { value = true; } } else { flag = false; if (MapQuickAccessPlugin.InstantOpenClose.Value || @float <= 0f) { value = false; } } } else { flag = false; value = false; } SetBool(instance, FieldMapToggled, flag); SetBool(instance, FieldActive, value); } private static void ProcessLocalUi(MapToolController instance) { if (GetBool(instance, FieldActive)) { if (Object.op_Implicit((Object)(object)StatsUI.instance)) { ((SemiUI)StatsUI.instance).Show(); } if (Object.op_Implicit((Object)(object)ItemInfoUI.instance)) { ((SemiUI)ItemInfoUI.instance).Hide(); } if (Object.op_Implicit((Object)(object)ItemInfoExtraUI.instance)) { ((SemiUI)ItemInfoExtraUI.instance).Hide(); } if (Object.op_Implicit((Object)(object)MissionUI.instance) && (Object)(object)MissionUI.instance.Text != (Object)null && ((TMP_Text)MissionUI.instance.Text).text != "") { ((SemiUI)MissionUI.instance).Show(); } } } private static void ProcessStateChange(MapToolController instance, PhotonView photonView, bool isLocalOwner) { //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) bool @bool = GetBool(instance, FieldActive); bool bool2 = GetBool(instance, FieldActivePrev); if (@bool == bool2) { return; } SetBool(instance, FieldActivePrev, @bool); if (GameManager.Multiplayer() && isLocalOwner && (Object)(object)photonView != (Object)null) { photonView.RPC("SetActiveRPC", (RpcTarget)1, new object[1] { @bool }); } if (@bool) { if (isLocalOwner) { if (MapQuickAccessPlugin.EnableOpenCloseShake.Value && (Object)(object)GameDirector.instance != (Object)null && (Object)(object)GameDirector.instance.CameraShake != (Object)null) { GameDirector.instance.CameraShake.Shake(2f, 0.1f); } if ((Object)(object)Map.Instance != (Object)null) { Map.Instance.ActiveSet(true); } } if ((Object)(object)instance.VisualTransform != (Object)null) { ((Component)instance.VisualTransform).gameObject.SetActive(true); } if (MapQuickAccessPlugin.KeepOpenSound.Value && instance.SoundStart != null) { instance.SoundStart.Play(((Component)instance).transform.position, 1f, 1f, 1f, 1f); } return; } if (isLocalOwner) { if (MapQuickAccessPlugin.EnableOpenCloseShake.Value && (Object)(object)GameDirector.instance != (Object)null && (Object)(object)GameDirector.instance.CameraShake != (Object)null) { GameDirector.instance.CameraShake.Shake(2f, 0.1f); } if ((Object)(object)Map.Instance != (Object)null) { Map.Instance.ActiveSet(false); } } if (MapQuickAccessPlugin.KeepOpenSound.Value && instance.SoundStop != null) { instance.SoundStop.Play(((Component)instance).transform.position, 1f, 1f, 1f, 1f); } } private static void ProcessAnimationAndCamera(MapToolController instance, PhotonView photonView, bool isLocalOwner) { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) bool @bool = GetBool(instance, FieldActive); float num = GetFloat(instance, FieldHideLerp); float num2 = 90f; float num3 = 1f; if (GameManager.Multiplayer() && !isLocalOwner) { num2 = 0f; num3 = 2f; } if (MapQuickAccessPlugin.InstantOpenClose.Value) { ApplyInstantVisualState(instance, @bool, isLocalOwner, num2); num = (@bool ? 0f : 1f); SetFloat(instance, FieldHideLerp, num); SetFloat(instance, FieldHideScale, @bool ? 1f : 0f); } else { float value; if (@bool) { if (num > 0f) { num -= Time.deltaTime * instance.IntroSpeed * num3; } value = Mathf.LerpUnclamped(1f, 0f, instance.IntroCurve.Evaluate(num)); if ((Object)(object)instance.HideTransform != (Object)null) { instance.HideTransform.localRotation = Quaternion.Slerp(Quaternion.identity, Quaternion.Euler(num2, 0f, 0f), instance.IntroCurve.Evaluate(num)); } } else { if (num < 1f) { num += Time.deltaTime * instance.OutroSpeed * num3; if (num > 1f && (Object)(object)instance.VisualTransform != (Object)null) { ((Component)instance.VisualTransform).gameObject.SetActive(false); } } value = Mathf.LerpUnclamped(1f, 0f, instance.OutroCurve.Evaluate(num)); } SetFloat(instance, FieldHideLerp, num); SetFloat(instance, FieldHideScale, value); } if (isLocalOwner && @bool) { SemiFunc.UIHideWorldSpace(); if (!MapQuickAccessPlugin.DisableMoveSlowdown.Value) { PlayerController.instance.MoveMult(instance.MoveMultiplier, 0.1f); } if (!MapQuickAccessPlugin.DisableCameraTopFade.Value && (Object)(object)CameraTopFade.Instance != (Object)null) { CameraTopFade.Instance.Set(instance.FadeAmount, 0.1f); } if (!MapQuickAccessPlugin.DisableCameraBobMultiplier.Value && (Object)(object)CameraBob.Instance != (Object)null) { CameraBob.Instance.SetMultiplier(instance.BobMultiplier, 0.1f); } if (!MapQuickAccessPlugin.DisableCameraZoomOverride.Value && (Object)(object)CameraZoom.Instance != (Object)null) { CameraZoom.Instance.OverrideZoomSet(50f, 0.05f, 2f, 2f, ((Component)instance).gameObject, 100); } if (!MapQuickAccessPlugin.DisableCameraNoiseOverride.Value && (Object)(object)CameraNoise.Instance != (Object)null) { CameraNoise.Instance.Override(0.025f, 0.25f); } if (!MapQuickAccessPlugin.KeepAimVisible.Value && (Object)(object)Aim.instance != (Object)null) { Aim.instance.SetState((State)4); } } if (MapQuickAccessPlugin.InstantOpenClose.Value) { return; } Vector3 val = Vector3.one; if (GameManager.Multiplayer() && !isLocalOwner) { if ((Object)(object)((Component)instance).transform.parent != (Object)null) { ((Component)instance).transform.parent.position = instance.FollowTransformClient.position; ((Component)instance).transform.parent.rotation = instance.FollowTransformClient.rotation; } val = instance.FollowTransformClient.localScale; if ((Object)(object)instance.mainSpringTransform != (Object)null) { instance.mainSpringTransform.rotation = SemiFunc.SpringQuaternionGet(instance.mainSpring, instance.mainSpringTransformTarget.rotation, -1f); } } float @float = GetFloat(instance, FieldHideScale); if ((Object)(object)((Component)instance).transform.parent != (Object)null) { ((Component)instance).transform.parent.localScale = Vector3.Lerp(((Component)instance).transform.parent.localScale, val * @float, Time.deltaTime * 20f); } if ((Object)(object)instance.displaySpringTransform != (Object)null) { instance.displaySpringTransform.rotation = SemiFunc.SpringQuaternionGet(instance.displaySpring, instance.displaySpringTransformTarget.rotation, -1f); } if (@bool && (Object)(object)instance.displaySpringTransform != (Object)null) { float displayJointAnglePreviousX = GetDisplayJointAnglePreviousX(instance); float num4 = (displayJointAnglePreviousX - instance.displaySpringTransform.localRotation.x) * 50f; num4 = Mathf.Clamp(num4, -0.1f, 0.1f); SetDisplayJointAngleDiff(instance, num4); SetDisplayJointAnglePreviousX(instance, instance.displaySpringTransform.localRotation.x); if (instance.SoundLoop != null) { instance.SoundLoop.LoopPitch = Mathf.Lerp(instance.SoundLoop.LoopPitch, 1f - num4, Time.deltaTime * 10f); } } } private static void ApplyInstantVisualState(MapToolController instance, bool active, bool isLocalOwner, float x) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.one; if (GameManager.Multiplayer() && !isLocalOwner) { if ((Object)(object)((Component)instance).transform.parent != (Object)null && (Object)(object)instance.FollowTransformClient != (Object)null) { ((Component)instance).transform.parent.position = instance.FollowTransformClient.position; ((Component)instance).transform.parent.rotation = instance.FollowTransformClient.rotation; val = instance.FollowTransformClient.localScale; } if ((Object)(object)instance.mainSpringTransform != (Object)null && (Object)(object)instance.mainSpringTransformTarget != (Object)null) { instance.mainSpringTransform.rotation = instance.mainSpringTransformTarget.rotation; } } if ((Object)(object)instance.HideTransform != (Object)null) { instance.HideTransform.localRotation = (active ? Quaternion.identity : Quaternion.Euler(x, 0f, 0f)); } if ((Object)(object)instance.VisualTransform != (Object)null) { ((Component)instance.VisualTransform).gameObject.SetActive(active); } if ((Object)(object)((Component)instance).transform.parent != (Object)null) { ((Component)instance).transform.parent.localScale = val * (active ? 1f : 0f); } if ((Object)(object)instance.displaySpringTransform != (Object)null && (Object)(object)instance.displaySpringTransformTarget != (Object)null) { instance.displaySpringTransform.rotation = instance.displaySpringTransformTarget.rotation; SetDisplayJointAnglePreviousX(instance, instance.displaySpringTransform.localRotation.x); } SetDisplayJointAngleDiff(instance, 0f); if (instance.SoundLoop != null) { instance.SoundLoop.LoopPitch = 1f; } } private static void ProcessSoundLoop(MapToolController instance) { if (instance.SoundLoop != null) { bool @bool = GetBool(instance, FieldActive); bool flag = MapQuickAccessPlugin.KeepLoopSound.Value && @bool; instance.SoundLoop.PlayLoop(flag, 5f, 5f, 1f); } } private static PhotonView GetPhotonView(MapToolController instance) { PhotonView val = null; if (FieldPhotonView != null) { object? value = FieldPhotonView.GetValue(instance); val = (PhotonView)((value is PhotonView) ? value : null); } if ((Object)(object)val == (Object)null) { val = ((Component)instance).GetComponent<PhotonView>(); if (FieldPhotonView != null && (Object)(object)val != (Object)null) { FieldPhotonView.SetValue(instance, val); } } return val; } private static bool GetBool(object instance, FieldInfo field) { if (field == null) { return false; } if (!(field.GetValue(instance) is bool result)) { return false; } return result; } private static void SetBool(object instance, FieldInfo field, bool value) { if (field != null) { field.SetValue(instance, value); } } private static float GetFloat(object instance, FieldInfo field) { if (field == null) { return 0f; } if (!(field.GetValue(instance) is float result)) { return 0f; } return result; } private static void SetFloat(object instance, FieldInfo field, float value) { if (field != null) { field.SetValue(instance, value); } } private static float GetDisplayJointAnglePreviousX(MapToolController instance) { if (FieldDisplayJointAnglePreviousX == null) { return 0f; } if (!(FieldDisplayJointAnglePreviousX.GetValue(instance) is float result)) { return 0f; } return result; } private static void SetDisplayJointAngleDiff(MapToolController instance, float value) { if (FieldDisplayJointAngleDiff != null) { FieldDisplayJointAngleDiff.SetValue(instance, value); } } private static void SetDisplayJointAnglePreviousX(MapToolController instance, float value) { if (FieldDisplayJointAnglePreviousX != null) { FieldDisplayJointAnglePreviousX.SetValue(instance, value); } } }