Decompiled source of Gunfig v1.1.3
Gunfig.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using Dungeonator; using HarmonyLib; using HutongGames.PlayMaker.Actions; using InControl; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.Cil; using MonoMod.RuntimeDetour; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Gunfiguration { public static class QoLConfig { [HarmonyPatch(typeof(AmmonomiconPokedexEntry), "Awake")] private class SpawnItemsFromAmmonomiconPatch { [CompilerGenerated] private static class <>O { public static KeyPressHandler <0>__OnKeyDown; } private static void Postfix(AmmonomiconPokedexEntry __instance) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown dfButton button = __instance.m_button; object obj = <>O.<0>__OnKeyDown; if (obj == null) { KeyPressHandler val = OnKeyDown; <>O.<0>__OnKeyDown = val; obj = (object)val; } ((dfControl)button).KeyDown += (KeyPressHandler)obj; } private static void OnKeyDown(dfControl control, dfKeyEventArgs keyEvent) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if ((int)keyEvent.KeyCode != 13 || !_Gunfig.Enabled("Spawn Items from Ammonomicon")) { return; } AmmonomiconPokedexEntry component = ((Component)control).GetComponent<AmmonomiconPokedexEntry>(); if (component != null && (int)component.encounterState <= 0) { EncounterDatabaseEntry linkedEncounterTrackable = component.linkedEncounterTrackable; if (linkedEncounterTrackable != null && linkedEncounterTrackable.pickupObjectId != -1) { LootEngine.SpawnItem(((Component)PickupObjectDatabase.GetById(linkedEncounterTrackable.pickupObjectId)).gameObject, Vector2.op_Implicit(((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition), Vector2.up, 1f, true, false, false); AkSoundEngine.PostEvent("Play_OBJ_power_up_01", ((Component)GameManager.Instance.BestActivePlayer).gameObject); } } } } [HarmonyPatch(typeof(RoomHandler), "GetNearestInteractable")] private class GetNearestInteractablePatch { [HarmonyILManipulator] private static void GetNearestInteractableIL(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld<TalkDoerLite>(instr, "PreventCoopInteraction") })) { val.Emit(OpCodes.Call, (MethodBase)typeof(GetNearestInteractablePatch).GetMethod("CheckPreventCoopInteraction", BindingFlags.Static | BindingFlags.NonPublic)); } } private static bool CheckPreventCoopInteraction(bool oldValue) { return oldValue && _Gunfig.Disabled("Breach Co-op Character Select"); } } [HarmonyPatch(typeof(TalkDoerLite), "Interact")] private class FoyerCharacterCoopInteractPatch { private static bool Prefix(TalkDoerLite __instance, PlayerController interactor) { if ((Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer) { return true; } if (!GameManager.Instance.IsFoyer) { return true; } if (_Gunfig.Disabled("Breach Co-op Character Select")) { return true; } FoyerCharacterSelectFlag component = ((Component)__instance).gameObject.GetComponent<FoyerCharacterSelectFlag>(); if (component == null) { return true; } if (!component.CanBeSelected()) { return true; } ReassignCoopPlayer(component); return false; } private static PlayerController ReassignCoopPlayer(FoyerCharacterSelectFlag f) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) _ManualCoopPrefabOverride = f.CharacterPrefabPath; Vector2 centerPosition = ((GameActor)GameManager.Instance.SecondaryPlayer).CenterPosition; Vector3 position = ((BraveBehaviour)GameManager.Instance.SecondaryPlayer).transform.position; GameManager.Instance.ClearSecondaryPlayer(); GameManager.LastUsedCoopPlayerPrefab = (GameObject)BraveResources.Load(_ManualCoopPrefabOverride, ".prefab"); GameObject val = Object.Instantiate<GameObject>(GameManager.LastUsedCoopPlayerPrefab, position, Quaternion.identity); val.SetActive(true); PlayerController component = val.GetComponent<PlayerController>(); if (Object.op_Implicit((Object)(object)f) && f.IsAlternateCostume) { component.SwapToAlternateCostume((tk2dSpriteAnimation)null); } GameManager.Instance.SecondaryPlayer = component; component.PlayerIDX = 1; LootEngine.DoDefaultItemPoof(centerPosition, false, false); return component; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class FastAmmonomiconPatch { [HarmonyILManipulator] private static void FastAmmonomiconIL(ILContext il, MethodBase original) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); Type declaringType = original.DeclaringType; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall<AmmonomiconController>(instr, "GetAnimationLength") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, AccessTools.GetDeclaredFields(declaringType).Find((FieldInfo f) => f.Name == "isDeath")); val.Emit(OpCodes.Call, (MethodBase)typeof(FastAmmonomiconPatch).GetMethod("AdjustAnimationSpeed", BindingFlags.Static | BindingFlags.NonPublic)); } } private static float AdjustAnimationSpeed(float oldValue, bool isDeath) { if (isDeath || _Gunfig.Disabled("Ammonmicon Opens Instantly")) { return oldValue; } AkSoundEngine.StopAll(((Component)AmmonomiconController.Instance).gameObject); return 0f; } } [HarmonyPatch(typeof(PlayerController), "GetEquippedWith")] private class UnlimitedActiveItemsPatch { [HarmonyILManipulator] private static void UnlimitedActiveItemsIL(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchStloc(instr, 6) })) { val.Emit(OpCodes.Call, (MethodBase)typeof(UnlimitedActiveItemsPatch).GetMethod("ActiveItemCapacity", BindingFlags.Static | BindingFlags.NonPublic)); } } private static int ActiveItemCapacity(int oldValue) { return _Gunfig.Enabled("Unlimited Active Items") ? 9999 : oldValue; } } [HarmonyPatch(typeof(PlayerController), "UpdateInventoryMaxItems")] private class UpdateInventoryMaxItemsPatch { private static bool Prefix(PlayerController __instance) { if (_Gunfig.Enabled("Unlimited Active Items")) { return false; } return true; } } [HarmonyPatch(typeof(GameStatsManager), "GetPlayerStatValue")] private class HaveInfiniteCreditsPatch { private static bool Prefix(GameStatsManager __instance, TrackedStats stat, ref float __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)stat != 25 || _Gunfig.Disabled("Infinite Hegemony Credits")) { return true; } __result = 99999f; return false; } } [HarmonyPatch(typeof(GameStatsManager), "SetStat")] private class DontSetCreditsPatch { private static bool Prefix(GameStatsManager __instance, TrackedStats stat, float value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)stat != 25 || _Gunfig.Disabled("Infinite Hegemony Credits")) { return true; } return false; } } [HarmonyPatch(typeof(GameStatsManager), "RegisterStatChange")] private class DontRegisterCreditsPatch { private static bool Prefix(GameStatsManager __instance, TrackedStats stat, float value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)stat != 25 || _Gunfig.Disabled("Infinite Hegemony Credits")) { return true; } return false; } } [HarmonyPatch(typeof(SimpleStatLabel), "Update")] private class InfiniteCreditsOnHUDPatch { private static void Postfix(SimpleStatLabel __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)__instance.m_label) && ((dfControl)__instance.m_label).IsVisible && (int)__instance.stat == 25 && !_Gunfig.Disabled("Infinite Hegemony Credits")) { __instance.m_label.AutoHeight = true; __instance.m_label.ProcessMarkup = true; __instance.m_label.Text = "[sprite \"infinite-big\"]"; } } } [HarmonyPatch(typeof(AmmonomiconDeathPageController), "GetNumMetasToQuickRestart")] private class FreeQuickRestartPatch { private static void Postfix(AmmonomiconDeathPageController __instance, QuickRestartOptions __result) { if (_Gunfig.Enabled("Infinite Hegemony Credits")) { __result.NumMetas = 0; } } } [HarmonyPatch(typeof(FoyerCharacterSelectFlag), "OnCoopChangedCallback")] private class FoyerOnCoopChangedCallbackPatch { private static bool Prefix(FoyerCharacterSelectFlag __instance) { return _Gunfig.Disabled("Breach Co-op Character Select"); } } internal static Gunfig _Gunfig = null; internal const string FINGER_SAVER = "Auto-fire Semi-Automatic Weapons"; internal const string PLAYER_TWO_CHAR = "Co-op Character"; internal const string QUICKSTART = "Quick Start Behavior"; internal const string COOP_FOYER_SEL = "Breach Co-op Character Select"; internal const string STATIC_CAMERA = "Static Camera While Aiming"; internal const string MENU_SOUNDS = "Better Menu Sounds"; internal const string HEROBRINE = "Disable Herobrine"; internal const string HEALTH_BARS = "Show Enemy Health Bars"; internal const string DAMAGE_NUMS = "Show Damage Numbers"; internal const string CHEATS_LABEL = "Cheats / Debug Stuff"; internal const string SPAWN_ITEMS = "Spawn Items from Ammonomicon"; internal const string FAST_POKEDEX = "Ammonmicon Opens Instantly"; internal const string ALL_THE_ITEMS = "Unlimited Active Items"; internal const string INFINITE_META = "Infinite Hegemony Credits"; private static readonly List<string> _QUICKSTART_OPTIONS = new List<string> { "Vanilla", "Extended".Yellow(), "Extended + Co-op".Yellow() }; private static readonly List<string> _QUICKSTART_DESCRIPTIONS = new List<string> { "Vanilla quickstart behavior".Green(), "Allows quickstarting on the main menu\nafter the title sequence".Green(), "Quick start will automatically start co-op\nif a second controller is plugged in".Green() }; private static readonly Dictionary<string, string> _PLAYER_MAP = new Dictionary<string, string> { { "Cultist", "coopcultist" }, { "Pilot", "rogue" }, { "Marine", "marine" }, { "Convict", "convict" }, { "Hunter", "guide" }, { "Bullet", "bullet" }, { "Robot", "robot" }, { "Paradox", "eevee" }, { "Gunslinger", "gunslinger" } }; internal static string _ManualCoopPrefabOverride = null; private static GameObject VFXHealthBar = null; private static readonly int ScouterId = 821; internal static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _Gunfig = Gunfig.Get("Quality of Life".WithColor(Color.white)); List<string> list = new List<string>(); foreach (string key in _PLAYER_MAP.Keys) { list.Add((key == "Cultist") ? key : key.Yellow()); } _Gunfig.AddScrollBox("Co-op Character", list); _Gunfig.AddScrollBox("Quick Start Behavior", _QUICKSTART_OPTIONS, null, null, _QUICKSTART_DESCRIPTIONS); _Gunfig.AddToggle("Breach Co-op Character Select"); _Gunfig.AddToggle("Auto-fire Semi-Automatic Weapons"); _Gunfig.AddToggle("Static Camera While Aiming"); _Gunfig.AddToggle("Show Enemy Health Bars"); _Gunfig.AddToggle("Show Damage Numbers"); _Gunfig.AddToggle("Ammonmicon Opens Instantly"); _Gunfig.AddToggle("Better Menu Sounds", enabled: false, null, null, Gunfig.Update.Immediate); Gunfig gunfig = _Gunfig.AddSubMenu("Cheats / Debug Stuff".Magenta()); gunfig.AddToggle("Spawn Items from Ammonomicon", enabled: false, "Spawn Items from Ammonomicon".Magenta()); gunfig.AddToggle("Unlimited Active Items", enabled: false, "Unlimited Active Items".Magenta()); gunfig.AddToggle("Infinite Hegemony Credits", enabled: false, "Infinite Hegemony Credits".Magenta()); gunfig.AddButton("Disable Herobrine", "Disable Herobrine".Red(), delegate(string optionKey, string optionValue) { ETGModConsole.Log((object)("Clicked the " + optionKey + " button...but you can't disable Herobrine :/"), false); }); Gunfig.OnAllModsLoaded = (Action)Delegate.Combine(Gunfig.OnAllModsLoaded, new Action(LateInit)); InitQoLHooks(); } private static void LateInit() { GunfigDebug.Log("doing late init for QoL config"); } private static void InitQoLHooks() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) new Hook((MethodBase)typeof(PlayerController).GetMethod("Awake", BindingFlags.Instance | BindingFlags.Public), typeof(QoLConfig).GetMethod("OnPlayerAwake", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(BraveOptionsMenuItem).GetMethod("ToggleCheckbox", BindingFlags.Instance | BindingFlags.NonPublic), typeof(QoLConfig).GetMethod("OnToggleCheckbox", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(BraveOptionsMenuItem).GetMethod("HandleFillbarValueChanged", BindingFlags.Instance | BindingFlags.NonPublic), typeof(QoLConfig).GetMethod("OnHandleFillbarValueChanged", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(BraveInput).GetMethod("get_ControllerFakeSemiAutoCooldown", BindingFlags.Static | BindingFlags.Public), typeof(QoLConfig).GetMethod("OverrideSemiAutoCooldown", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(ChangeCoopMode).GetMethod("GeneratePlayer", BindingFlags.Instance | BindingFlags.NonPublic), typeof(QoLConfig).GetMethod("OnGenerateCoopPlayer", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(MainMenuFoyerController).GetMethod("Update", BindingFlags.Instance | BindingFlags.NonPublic), typeof(QoLConfig).GetMethod("OnMainMenuUpdate", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(Dungeon).GetMethod("GeneratePlayerIfNecessary", BindingFlags.Instance | BindingFlags.NonPublic), typeof(QoLConfig).GetMethod("OnGeneratePlayerIfNecessary", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(CameraController).GetMethod("GetCoreOffset", BindingFlags.Instance | BindingFlags.NonPublic), typeof(QoLConfig).GetMethod("OnGetCoreOffset", BindingFlags.Static | BindingFlags.NonPublic)); } private static void OnPlayerAwake(Action<PlayerController> orig, PlayerController player) { orig(player); player.OnAnyEnemyReceivedDamage = (Action<float, bool, HealthHaver>)Delegate.Combine(player.OnAnyEnemyReceivedDamage, new Action<float, bool, HealthHaver>(DoHealthEffects)); } private static void OnToggleCheckbox(Action<BraveOptionsMenuItem, dfControl, dfMouseEventArgs> orig, BraveOptionsMenuItem item, dfControl control, dfMouseEventArgs args) { orig(item, control, args); if (_Gunfig.Enabled("Better Menu Sounds")) { AkSoundEngine.PostEvent("Play_UI_menu_select_01", ((Component)item).gameObject); } } private static void OnHandleFillbarValueChanged(Action<BraveOptionsMenuItem> orig, BraveOptionsMenuItem item) { orig(item); if (_Gunfig.Enabled("Better Menu Sounds")) { AkSoundEngine.PostEvent("Play_UI_menu_select_01", ((Component)item).gameObject); } } private static float OverrideSemiAutoCooldown(Func<float> orig) { if (_Gunfig.Enabled("Auto-fire Semi-Automatic Weapons")) { return 0f; } return orig(); } private static PlayerController OnGenerateCoopPlayer(Func<ChangeCoopMode, PlayerController> orig, ChangeCoopMode coop) { coop.PlayerPrefabPath = _ManualCoopPrefabOverride ?? ("Player" + _PLAYER_MAP[_Gunfig.Value("Co-op Character")]); return orig(coop); } private static void OnMainMenuUpdate(Action<MainMenuFoyerController> orig, MainMenuFoyerController menu) { orig(menu); if ((!Foyer.DoIntroSequence && !Foyer.DoMainMenu) || _Gunfig.Value("Quick Start Behavior") == "Vanilla") { return; } FinalIntroSequenceManager val = Foyer.Instance?.IntroDoer; if ((Object)(object)((val != null) ? ((Component)val).gameObject : null) == (Object)null || val.m_isDoingQuickStart || !val.QuickStartAvailable()) { return; } BraveInput playerlessInstance = BraveInput.PlayerlessInstance; bool? obj; if (playerlessInstance == null) { obj = null; } else { GungeonActions activeActions = playerlessInstance.ActiveActions; if (activeActions == null) { obj = null; } else { InputDevice device = ((PlayerActionSet)activeActions).Device; if (device == null) { obj = null; } else { InputControl action = device.Action4; obj = ((action != null) ? new bool?(((OneAxisInputControl)action).WasPressed) : null); } } } bool? flag = obj; if ((!flag.GetValueOrDefault() && !Input.GetKeyDown((KeyCode)113)) || GameManager.HasValidMidgameSave()) { return; } menu.DisableMainMenu(); TitleDioramaController obj2 = Object.FindObjectOfType<TitleDioramaController>(); if (obj2 != null) { obj2.ForceHideFadeQuad(); } Transform parent = ((Component)val).gameObject.transform.parent; if (parent != null) { GameObject gameObject = ((Component)parent).gameObject; if (gameObject != null) { gameObject.SetActive(true); } } val.m_skipCycle = true; val.m_isDoingQuickStart = true; if (InputManager.Devices.Count > 0 && _Gunfig.Value("Quick Start Behavior").Contains("Co-op")) { ((MonoBehaviour)GameManager.Instance).StartCoroutine(DoCoopQuickStart(val)); } else { ((MonoBehaviour)val).StartCoroutine(val.DoQuickStart()); } } private static void OnGeneratePlayerIfNecessary(Action<Dungeon, MidGameSaveData> orig, Dungeon dungeon, MidGameSaveData midgameSave) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 if (midgameSave != null) { orig(dungeon, midgameSave); } else if ((int)GameManager.Instance.CurrentLevelOverrideState == 1) { orig(dungeon, midgameSave); } else if ((int)GameManager.Instance.CurrentGameType != 1) { orig(dungeon, midgameSave); } else if (GameManager.Instance.AllPlayers.Length == 0) { GeneratePlayerOne(); GeneratePlayerTwo(); } else { orig(dungeon, midgameSave); } } private static IEnumerator DoCoopQuickStart(FinalIntroSequenceManager introManager) { GameObject quickStartObject = introManager.QuickStartObject; if (quickStartObject != null) { quickStartObject.SetActive(false); } ((MonoBehaviour)introManager).StartCoroutine(introManager.FadeToBlack(0.1f, true, true)); GameManager.PreventGameManagerExistence = false; GameManager.SKIP_FOYER = true; Foyer.DoMainMenu = false; uint out_bankID = default(uint); AkSoundEngine.LoadBank("SFX.bnk", -1, ref out_bankID); GameManager.EnsureExistence(); GameManager.PlayerPrefabForNewGame = (GameObject)BraveResources.Load(CharacterSelectController.GetCharacterPathFromQuickStart(), ".prefab"); GameManager.Instance.GlobalInjectionData.PreprocessRun(false); GameManager.Instance.IsSelectingCharacter = false; GameManager.Instance.IsFoyer = false; GeneratePlayerOne(); yield return null; GameManager.Instance.CurrentGameType = (GameType)1; GeneratePlayerTwo(); yield return null; GameManager.Instance.RefreshAllPlayers(); GameManager.Instance.FlushMusicAudio(); GameManager.Instance.SetNextLevelIndex(1); yield return null; Foyer.Instance.OnDepartedFoyer(); yield return null; GameManager.Instance.LoadNextLevel(); } private static void GeneratePlayerOne() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) PlayerController component = GameManager.PlayerPrefabForNewGame.GetComponent<PlayerController>(); GameStatsManager.Instance.BeginNewSession(component); GameObject val = Object.Instantiate<GameObject>(GameManager.PlayerPrefabForNewGame, Vector3.zero, Quaternion.identity); GameManager.PlayerPrefabForNewGame = null; val.SetActive(true); PlayerController component2 = val.GetComponent<PlayerController>(); component2.PlayerIDX = 0; GameManager.Instance.PrimaryPlayer = component2; } private static void GeneratePlayerTwo() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown string text = _ManualCoopPrefabOverride ?? ("Player" + _PLAYER_MAP[_Gunfig.Value("Co-op Character")]); GameObject val = Object.Instantiate<GameObject>((GameObject)BraveResources.Load(text, ".prefab"), Vector3.zero, Quaternion.identity); val.SetActive(true); PlayerController component = val.GetComponent<PlayerController>(); component.PlayerIDX = 1; GameManager.Instance.SecondaryPlayer = component; } private static Vector2 OnGetCoreOffset(Func<CameraController, Vector2, bool, bool, Vector2> orig, CameraController cam, Vector2 currentBasePosition, bool isUpdate, bool allowAimOffset) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (_Gunfig.Enabled("Static Camera While Aiming")) { return Vector2.zero; } return orig(cam, currentBasePosition, isUpdate, allowAimOffset); } private static bool HasPassive(this PlayerController pc, int pickupId) { int count = pc.passiveItems.Count; for (int i = 0; i < count; i++) { if (((PickupObject)pc.passiveItems[i]).PickupObjectId == pickupId) { return true; } } return false; } private static void DoHealthEffects(float damageAmount, bool fatal, HealthHaver target) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) bool flag = _Gunfig.Enabled("Show Enemy Health Bars"); bool flag2 = _Gunfig.Enabled("Show Damage Numbers"); if ((!flag && !flag2) || GameManager.Instance.PrimaryPlayer.HasPassive(ScouterId) || ((int)GameManager.Instance.CurrentGameType == 1 && GameManager.Instance.SecondaryPlayer.HasPassive(ScouterId))) { return; } if (VFXHealthBar == null) { PickupObject byId = PickupObjectDatabase.GetById(ScouterId); VFXHealthBar = ((RatchetScouterItem)((byId is RatchetScouterItem) ? byId : null)).VFXHealthBar; } Vector3 val = ((BraveBehaviour)target).transform.position; float num = 1f; SpeculativeRigidbody component = ((Component)target).GetComponent<SpeculativeRigidbody>(); if (component != null) { val = Vector2Extensions.ToVector3ZisY(component.UnitCenter, 0f); num = val.y - component.UnitBottomCenter.y; if (flag && Object.op_Implicit((Object)(object)((BraveBehaviour)component).healthHaver) && !((BraveBehaviour)component).healthHaver.HasHealthBar && !((BraveBehaviour)component).healthHaver.HasRatchetHealthBar && !((BraveBehaviour)component).healthHaver.IsBoss) { ((BraveBehaviour)component).healthHaver.HasRatchetHealthBar = true; Object.Instantiate<GameObject>(VFXHealthBar).GetComponent<SimpleHealthBarController>().Initialize(component, ((BraveBehaviour)component).healthHaver); } } else { AIActor component2 = ((Component)target).GetComponent<AIActor>(); if (component2 != null) { val = Vector2Extensions.ToVector3ZisY(((GameActor)component2).CenterPosition, 0f); if (Object.op_Implicit((Object)(object)((BraveBehaviour)component2).sprite)) { num = val.y - ((BraveBehaviour)component2).sprite.WorldBottomCenter.y; } } } if (flag2) { GameUIRoot.Instance.DoDamageNumber(val, num, Mathf.Max(Mathf.RoundToInt(damageAmount), 1)); } } } public class Gunfig { public enum Update { Immediate, OnConfirm, OnRestart } private enum ItemType { Label, Button, CheckBox, ArrowBox } private class Item { internal ItemType _itemType = ItemType.Label; internal Update _updateType = Update.OnConfirm; internal string _key = null; internal string _label = null; internal List<string> _values = null; internal List<string> _info = null; internal Action<string, string> _callback = null; } [HarmonyPatch(typeof(FinalIntroSequenceManager), "Start")] private static class FinalIntroSequenceManagerStartPatch { private static bool _AllModsLoaded; private static void Prefix() { if (!_AllModsLoaded) { _AllModsLoaded = true; if (OnAllModsLoaded != null) { OnAllModsLoaded(); } } } } public static Action OnAllModsLoaded; internal static readonly List<string> _UncheckedBoxValues = new List<string> { "0", "1" }; internal static readonly List<string> _CheckedBoxValues = new List<string> { "1", "0" }; internal static readonly List<string> _DefaultValues = new List<string> { "1" }; internal static List<Gunfig> _ActiveConfigs = new List<Gunfig>(); internal static List<string> _ConfigAssemblies = new List<string>(); private Dictionary<string, string> _options = new Dictionary<string, string>(); private List<Item> _registeredOptions = new List<Item>(); private bool _dirty = false; private string _configFile = null; private Gunfig _parentGunfig = null; private string _cleanModName = null; private dfScrollPanel _cachedConfigPage = null; internal string _modName = null; internal Gunfig _BaseGunfig => _parentGunfig ?? this; public static Gunfig Get(string modName) { Color color; string text = modName.ProcessColors(out color); for (int i = 0; i < _ActiveConfigs.Count; i++) { Gunfig gunfig = _ActiveConfigs[i]; if (!(gunfig._cleanModName != text)) { if (_ConfigAssemblies[i] != Assembly.GetCallingAssembly().FullName) { throw new AccessViolationException("Tried to access a Gunfig that doesn't belong to you!"); } return gunfig; } } GunfigDebug.Log("Creating new Gunfig instance for " + text); Gunfig gunfig2 = new Gunfig(); gunfig2._modName = modName; gunfig2._cleanModName = text; gunfig2._configFile = Path.Combine(SaveManager.SavePath, text + ".gunfig"); gunfig2.LoadFromDisk(); _ActiveConfigs.Add(gunfig2); _ConfigAssemblies.Add(Assembly.GetCallingAssembly().FullName); return gunfig2; } public void AddToggle(string key, bool enabled = false, string label = null, Action<string, string> callback = null, Update updateType = Update.OnConfirm) { RegisterOption(new Item { _itemType = ItemType.CheckBox, _updateType = updateType, _key = key, _label = (label ?? key), _callback = callback, _values = (enabled ? _CheckedBoxValues : _UncheckedBoxValues) }); } public void AddScrollBox(string key, List<string> options, string label = null, Action<string, string> callback = null, List<string> info = null, Update updateType = Update.OnConfirm) { RegisterOption(new Item { _itemType = ItemType.ArrowBox, _updateType = updateType, _key = key, _label = (label ?? key), _callback = callback, _values = options, _info = info }); } public void AddDynamicOptionToScrollBox(string key, string option, string info = null) { foreach (Item registeredOption in _registeredOptions) { if (registeredOption._itemType != ItemType.ArrowBox || registeredOption._key != key) { continue; } registeredOption._values.Add(option); if (registeredOption._info != null) { registeredOption._info.Add(info ?? string.Empty); } return; } ETGModConsole.Log((object)("WARNING: Tried to add dynamic option to non-existent scroll box " + key + "!"), false); } public void AddButton(string key, string label = null, Action<string, string> callback = null) { RegisterOption(new Item { _itemType = ItemType.Button, _updateType = Update.Immediate, _key = key, _label = (label ?? key), _callback = callback, _values = _DefaultValues }); } public Gunfig AddSubMenu(string label) { Gunfig subMenu = GetSubMenu(label); RegisterOption(new Item { _itemType = ItemType.Button, _updateType = Update.Immediate, _key = label + " submenu label", _label = label, _callback = subMenu.OpenConfigPage, _values = _DefaultValues }); return subMenu; } public void AddLabel(string label) { RegisterOption(new Item { _itemType = ItemType.Label, _updateType = Update.Immediate, _key = label + " label", _label = label, _values = _DefaultValues }); } public string Value(string key) { string value; return _options.TryGetValue(key, out value) ? value : null; } public bool Enabled(string key) { string value; return _options.TryGetValue(key, out value) && value == "1"; } public bool Disabled(string key) { string value; return _options.TryGetValue(key, out value) && value == "0"; } protected Gunfig() { } internal static void SaveActiveConfigsToDisk() { foreach (Gunfig activeConfig in _ActiveConfigs) { if (activeConfig._dirty) { activeConfig.SaveToDisk(); activeConfig._dirty = false; } } } private void LoadFromDisk() { if (!File.Exists(_configFile)) { return; } try { string[] array = File.ReadAllLines(_configFile); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { '=' }); if (array3.Length == 2 && array3[0] != null && array3[1] != null) { string text2 = array3[0].Trim(); string text3 = array3[1].Trim(); if (text2.Length != 0 && text3.Length != 0) { _options[text2] = text3; } } } } catch (Exception arg) { ETGModConsole.Log((object)$" error loading mod config file {_configFile}: {arg}", false); } } private void SaveToDisk() { try { using StreamWriter streamWriter = File.CreateText(_configFile); foreach (string key in _options.Keys) { if (!string.IsNullOrEmpty(key)) { streamWriter.WriteLine(key + " = " + _options[key]); } } } catch (Exception arg) { ETGModConsole.Log((object)$" error saving mod config file {_configFile}: {arg}", false); } } private void RegisterOption(Item item) { _registeredOptions.Add(item); if ((item._itemType == ItemType.CheckBox || item._itemType == ItemType.ArrowBox) && _BaseGunfig.Value(item._key) == null) { _BaseGunfig.Set(item._key, item._values[0]); } } private Gunfig GetSubMenu(string menuName) { Color color; string text = _cleanModName + ", " + menuName.ProcessColors(out color); for (int i = 0; i < _ActiveConfigs.Count; i++) { Gunfig gunfig = _ActiveConfigs[i]; if (!(gunfig._cleanModName != text)) { ETGModConsole.Log((object)("WARNING: tried to a create a duplicate submenu " + menuName + " under " + _cleanModName), false); return null; } } GunfigDebug.Log(" Creating new Gunfig submenu " + text + " for " + _cleanModName); Gunfig gunfig2 = new Gunfig(); gunfig2._modName = menuName; gunfig2._cleanModName = text; gunfig2._parentGunfig = _parentGunfig ?? this; _ActiveConfigs.Add(gunfig2); _ConfigAssemblies.Add(Assembly.GetCallingAssembly().FullName); return gunfig2; } internal dfScrollPanel RegenConfigPage() { _cachedConfigPage = GunfigMenu.NewOptionsPanel(_modName ?? ""); foreach (Item registeredOption in _registeredOptions) { dfControl val = (dfControl)(registeredOption._itemType switch { ItemType.Button => _cachedConfigPage.AddButton(registeredOption._label), ItemType.CheckBox => _cachedConfigPage.AddCheckBox(registeredOption._label), ItemType.ArrowBox => _cachedConfigPage.AddArrowBox(registeredOption._label, registeredOption._values, registeredOption._info), _ => _cachedConfigPage.AddLabel(registeredOption._label), }); if (registeredOption._itemType != 0) { ((Component)val).gameObject.AddComponent<GunfigOption>().Setup(_BaseGunfig, registeredOption._key, registeredOption._values, registeredOption._callback, registeredOption._updateType); } } return _cachedConfigPage; } internal void OpenConfigPage(string key, string value) { GunfigMenu.OpenSubMenu(_cachedConfigPage); } internal string Set(string key, string value) { if (string.IsNullOrEmpty(key)) { return null; } _options[key] = value; _dirty = true; return value; } } public static class GunfigHelpers { private const string MARKUP_DELIM = "@"; public static string WithColor(this string s, Color c) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return "@" + ColorUtility.ToHtmlStringRGB(c) + s; } public static string Red(this string s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return s.WithColor(Color.red); } public static string Green(this string s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return s.WithColor(Color.green); } public static string Blue(this string s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return s.WithColor(Color.blue); } public static string Yellow(this string s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return s.WithColor(Color.yellow); } public static string Cyan(this string s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return s.WithColor(Color.cyan); } public static string Magenta(this string s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return s.WithColor(Color.magenta); } public static string Gray(this string s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return s.WithColor(Color.gray); } public static string White(this string s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return s.WithColor(Color.white); } internal static Color Dim(this Color c, bool dim) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Color.Lerp(dim ? Color.black : Color.white, c, 0.5f); } internal static string ProcessColors(this string markupText, out Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) string text = markupText; color = Color.white; if (text.StartsWith("@")) { if (ColorUtility.TryParseHtmlString("#" + text.Substring(1, 6), ref color)) { text = text.Substring(7); } else { color = Color.white; } } return text; } } internal class GunfigOption : MonoBehaviour { [HarmonyPatch(typeof(FullOptionsMenuController), "CloseAndRevertChanges")] private class OnMenuCancelPatch { private static void Prefix(FullOptionsMenuController __instance) { foreach (GunfigOption item in _PendingUpdatesOnConfirm) { item.ResetMenuItemState(); } _PendingUpdatesOnConfirm.Clear(); } } [HarmonyPatch(typeof(FullOptionsMenuController), "CloseAndApplyChanges")] private class OnMenuConfirmPatch { private static void Prefix(FullOptionsMenuController __instance) { foreach (GunfigOption item in _PendingUpdatesOnConfirm) { if (item._updateType == Gunfig.Update.OnConfirm) { item.CommitPendingChanges(); } item._parent.Set(item._lookupKey, item._pendingValue); } Gunfig.SaveActiveConfigsToDisk(); _PendingUpdatesOnConfirm.Clear(); } } private static List<GunfigOption> _PendingUpdatesOnConfirm = new List<GunfigOption>(); private string _lookupKey = ""; private string _defaultValue = ""; private string _currentValue = ""; private string _pendingValue = ""; private Gunfig.Update _updateType = Gunfig.Update.OnConfirm; private List<string> _validValues = new List<string>(); private Action<string, string> _onApplyChanges = null; private dfControl _control = null; private Gunfig _parent = null; private Color _labelColor = Color.white; private List<Color> _optionColors = new List<Color>(); private List<Color> _infoColors = new List<Color>(); private static void OnGotFocus(Action<BraveOptionsMenuItem, dfControl, dfFocusEventArgs> orig, BraveOptionsMenuItem menuItem, dfControl control, dfFocusEventArgs args) { orig(menuItem, control, args); ((Component)menuItem).GetComponent<GunfigOption>()?.UpdateColors(menuItem, dim: false); } private static void OnSetUnselectedColors(Action<BraveOptionsMenuItem> orig, BraveOptionsMenuItem menuItem) { orig(menuItem); ((Component)menuItem).GetComponent<GunfigOption>()?.UpdateColors(menuItem, dim: true); } private void CommitPendingChanges() { if (!(_pendingValue == _currentValue)) { if (_onApplyChanges != null) { _onApplyChanges(_lookupKey, _pendingValue); } _currentValue = _pendingValue; if (_updateType == Gunfig.Update.Immediate) { _parent.Set(_lookupKey, _pendingValue); Gunfig.SaveActiveConfigsToDisk(); } } } private void OnControlChanged(dfControl control, string stringValue) { _pendingValue = stringValue; OnControlChanged(); } private void OnControlChanged(dfControl control, bool toggleValue) { _pendingValue = (toggleValue ? "1" : "0"); OnControlChanged(); } private void OnButtonClicked(dfControl control) { if (_onApplyChanges != null) { _onApplyChanges(_lookupKey, _pendingValue); } } private void OnControlChanged() { if (_updateType == Gunfig.Update.Immediate) { CommitPendingChanges(); } else if (!_PendingUpdatesOnConfirm.Contains(this)) { _PendingUpdatesOnConfirm.Add(this); } UpdateColors(((Component)this).GetComponent<BraveOptionsMenuItem>(), dim: false); } private void ProcessColors() { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) BraveOptionsMenuItem menuItem = ((Component)this).GetComponent<BraveOptionsMenuItem>(); if (!Object.op_Implicit((Object)(object)menuItem)) { ETGModConsole.Log((object)" NULL BRAVE MENU ITEM", false); return; } dfLabel labelControl = menuItem.labelControl; if (labelControl != null) { labelControl.Text = labelControl.Text.ProcessColors(out _labelColor); } dfButton buttonControl = menuItem.buttonControl; if (buttonControl != null) { buttonControl.Text = buttonControl.Text.ProcessColors(out _labelColor); } dfLabel selectedLabelControl = menuItem.selectedLabelControl; if (selectedLabelControl != null && menuItem.labelOptions != null) { bool flag = (Object)(object)menuItem.infoControl != (Object)null && menuItem.infoOptions != null && menuItem.labelOptions.Length == menuItem.infoOptions.Length; for (int i = 0; i < menuItem.labelOptions.Length; i++) { menuItem.labelOptions[i] = menuItem.labelOptions[i].ProcessColors(out var color); _optionColors.Add(color); if (flag) { menuItem.infoOptions[i] = menuItem.infoOptions[i].ProcessColors(out color); _infoColors.Add(color); } } } _control.IsVisibleChanged += delegate { UpdateColors(menuItem, dim: true); }; } private void ResetMenuItemState(bool addHandlers = false) { BraveOptionsMenuItem component = ((Component)this).GetComponent<BraveOptionsMenuItem>(); if (!Object.op_Implicit((Object)(object)component)) { ETGModConsole.Log((object)" NULL BRAVE MENU ITEM", false); return; } dfButton buttonControl = component.buttonControl; if (buttonControl != null && addHandlers) { GunfigMenu.CustomButtonHandler orAddComponent = GameObjectExtensions.GetOrAddComponent<GunfigMenu.CustomButtonHandler>(((Component)_control).gameObject); orAddComponent.onClicked = (Action<dfControl>)Delegate.Combine(orAddComponent.onClicked, new Action<dfControl>(OnButtonClicked)); } dfControl checkboxChecked = component.checkboxChecked; if (checkboxChecked != null) { bool flag2 = (checkboxChecked.IsVisible = _currentValue.Trim() == "1"); dfControl checkboxUnchecked = component.checkboxUnchecked; if (checkboxUnchecked != null) { checkboxUnchecked.IsVisible = true; } component.m_selectedIndex = (flag2 ? 1 : 0); if (addHandlers) { GunfigMenu.CustomCheckboxHandler orAddComponent2 = GameObjectExtensions.GetOrAddComponent<GunfigMenu.CustomCheckboxHandler>(((Component)_control).gameObject); orAddComponent2.onChanged = (PropertyChangedEventHandler<bool>)(object)Delegate.Combine((Delegate?)(object)orAddComponent2.onChanged, (Delegate?)(object)new PropertyChangedEventHandler<bool>(OnControlChanged)); } } dfLabel selectedLabelControl = component.selectedLabelControl; if (selectedLabelControl != null && component.labelOptions != null) { bool flag3 = (Object)(object)component.infoControl != (Object)null && component.infoOptions != null && component.labelOptions.Length == component.infoOptions.Length; for (int i = 0; i < component.labelOptions.Length; i++) { if (!(component.labelOptions[i] != _currentValue)) { selectedLabelControl.Text = component.labelOptions[i]; if (flag3) { component.infoControl.Text = component.infoOptions[i]; } component.m_selectedIndex = i; break; } } if (addHandlers) { GunfigMenu.CustomLeftRightArrowHandler orAddComponent3 = GameObjectExtensions.GetOrAddComponent<GunfigMenu.CustomLeftRightArrowHandler>(((Component)_control).gameObject); orAddComponent3.onChanged = (PropertyChangedEventHandler<string>)(object)Delegate.Combine((Delegate?)(object)orAddComponent3.onChanged, (Delegate?)(object)new PropertyChangedEventHandler<string>(OnControlChanged)); } } UpdateColors(component, dim: true); } internal void UpdateColors(BraveOptionsMenuItem menuItem, bool dim) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)menuItem.labelControl != (Object)null) { ((dfControl)menuItem.labelControl).Color = Color32.op_Implicit(_labelColor.Dim(dim)); } if ((Object)(object)menuItem.buttonControl != (Object)null) { menuItem.buttonControl.TextColor = Color32.op_Implicit(_labelColor.Dim(dim)); } if ((Object)(object)menuItem.selectedLabelControl != (Object)null) { ((dfControl)menuItem.selectedLabelControl).Color = Color32.op_Implicit(_optionColors[menuItem.m_selectedIndex % _optionColors.Count].Dim(dim)); } if ((Object)(object)menuItem.infoControl != (Object)null) { menuItem.infoControl.Text = menuItem.infoOptions[menuItem.m_selectedIndex % _infoColors.Count]; ((dfControl)menuItem.infoControl).Color = Color32.op_Implicit(_infoColors[menuItem.m_selectedIndex % _infoColors.Count].Dim(dim)); } } internal static bool HasPendingChanges() { foreach (GunfigOption item in _PendingUpdatesOnConfirm) { if (item._pendingValue != item._currentValue) { return true; } } return false; } internal void Setup(Gunfig parentConfig, string key, List<string> values, Action<string, string> update, Gunfig.Update updateType = Gunfig.Update.OnConfirm) { _control = ((Component)this).GetComponent<dfControl>(); _parent = parentConfig; _lookupKey = key; _validValues = values; _onApplyChanges = update; _updateType = updateType; if (!string.IsNullOrEmpty(key)) { _defaultValue = values[0].ProcessColors(out var _); _currentValue = _parent.Value(_lookupKey) ?? _parent.Set(_lookupKey, _defaultValue); _pendingValue = _currentValue; } ProcessColors(); ResetMenuItemState(addHandlers: true); } } internal static class GunfigMenu { internal class CustomCheckboxHandler : MonoBehaviour { public PropertyChangedEventHandler<bool> onChanged; } internal class CustomLeftRightArrowHandler : MonoBehaviour { public PropertyChangedEventHandler<string> onChanged; } internal class CustomButtonHandler : MonoBehaviour { public Action<dfControl> onClicked; } [HarmonyPatch(typeof(FullOptionsMenuController), "UpAllLevels")] private class BackOneLevelPatch { private static bool Prefix(FullOptionsMenuController __instance) { if (_MenuStack.Count == 0) { return true; } ((dfControl)_MenuStack.Pop()).IsVisible = false; if (_MenuStack.Count == 0) { return true; } __instance.cloneOptions = GameOptions.CloneOptions(GameManager.Options); __instance.PreOptionsMenu.ToggleToPanel(_MenuStack.Peek(), true, true); if (Foyer.DoMainMenu) { __instance.ShwoopOpen(); } return false; } } [HarmonyPatch(typeof(FullOptionsMenuController), "ToggleToPanel")] private class ToggleToPanelPatch { [HarmonyILManipulator] private static void ToggleToPanelIL(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel loopBranch = null; if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchBgt(instr, ref loopBranch) })) { val.Remove(); val.Emit(OpCodes.Bge, (object)loopBranch); } } } [CompilerGenerated] private static class <>O { public static MouseEventHandler <0>__OpenGunfigMainMenu; public static MouseEventHandler <1>__FocusControl; public static FocusEventHandler <2>__PlayMenuCursorSound; } internal const string _GUNFIG_EXTENSION = "gunfig"; private const string _MOD_MENU_LABEL = "MOD CONFIG"; private const string _MOD_MENU_TITLE = "Modded Options"; private static List<dfControl> _RegisteredTabs = new List<dfControl>(); private static Stack<dfScrollPanel> _MenuStack = new Stack<dfScrollPanel>(); private static dfScrollPanel _GunfigMainPanel = null; private static dfScrollPanel _RefPanel = null; private static dfPanel _CachedPrototypeCheckboxWrapperPanel = null; private static dfPanel _CachedPrototypeCheckboxInnerPanel = null; private static dfCheckbox _CachedPrototypeCheckbox = null; private static dfSprite _CachedPrototypeEmptyCheckboxSprite = null; private static dfSprite _CachedPrototypeCheckedCheckboxSprite = null; private static dfLabel _CachedPrototypeCheckboxLabel = null; private static dfPanel _CachedPrototypeLeftRightWrapperPanel = null; private static dfPanel _CachedPrototypeLeftRightInnerPanel = null; private static dfLabel _CachedPrototypeLeftRightPanelLabel = null; private static dfSprite _CachedPrototypeLeftRightPanelLeftSprite = null; private static dfSprite _CachedPrototypeLeftRightPanelRightSprite = null; private static dfLabel _CachedPrototypeLeftRightPanelSelection = null; private static dfPanel _CachedPrototypeInfoWrapperPanel = null; private static dfPanel _CachedPrototypeInfoInnerPanel = null; private static dfLabel _CachedPrototypeInfoPanelLabel = null; private static dfSprite _CachedPrototypeInfoPanelLeftSprite = null; private static dfSprite _CachedPrototypeInfoPanelRightSprite = null; private static dfLabel _CachedPrototypeInfoPanelSelection = null; private static dfLabel _CachedPrototypeInfoInfoPanel = null; private static dfPanel _CachedPrototypeButtonWrapperPanel = null; private static dfPanel _CachedPrototypeButtonInnerPanel = null; private static dfButton _CachedPrototypeButton = null; private static dfPanel _CachedPrototypeLabelWrapperPanel = null; private static dfPanel _CachedPrototypeLabelInnerPanel = null; private static dfLabel _CachedPrototypeLabel = null; internal static void Init() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) new Hook((MethodBase)typeof(MainMenuFoyerController).GetMethod("InitializeMainMenu", BindingFlags.Instance | BindingFlags.Public), typeof(GunfigMenu).GetMethod("InitializeMainMenu", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(GameManager).GetMethod("Pause", BindingFlags.Instance | BindingFlags.Public), typeof(GunfigMenu).GetMethod("Pause", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(FullOptionsMenuController).GetMethod("ToggleToPanel", BindingFlags.Instance | BindingFlags.Public), typeof(GunfigMenu).GetMethod("ToggleToPanel", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(GameOptions).GetMethod("CompareSettings", BindingFlags.Static | BindingFlags.Public), typeof(GunfigMenu).GetMethod("CompareSettings", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(BraveOptionsMenuItem).GetMethod("HandleCheckboxValueChanged", BindingFlags.Instance | BindingFlags.NonPublic), typeof(GunfigMenu).GetMethod("HandleCheckboxValueChanged", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(BraveOptionsMenuItem).GetMethod("HandleLeftRightArrowValueChanged", BindingFlags.Instance | BindingFlags.NonPublic), typeof(GunfigMenu).GetMethod("HandleLeftRightArrowValueChanged", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(BraveOptionsMenuItem).GetMethod("DoSelectedAction", BindingFlags.Instance | BindingFlags.NonPublic), typeof(GunfigMenu).GetMethod("DoSelectedAction", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(BraveOptionsMenuItem).GetMethod("DoFocus", BindingFlags.Instance | BindingFlags.NonPublic), typeof(GunfigOption).GetMethod("OnGotFocus", BindingFlags.Static | BindingFlags.NonPublic)); new Hook((MethodBase)typeof(BraveOptionsMenuItem).GetMethod("SetUnselectedColors", BindingFlags.Instance | BindingFlags.NonPublic), typeof(GunfigOption).GetMethod("OnSetUnselectedColors", BindingFlags.Static | BindingFlags.NonPublic)); } private static void InitializeMainMenu(Action<MainMenuFoyerController> orig, MainMenuFoyerController mm) { PreOptionsMenuController preOptionsMenu = ((Component)GameUIRoot.Instance.PauseMenuPanel).GetComponent<PauseMenuController>().OptionsMenu.PreOptionsMenu; if (preOptionsMenu != null && !Object.op_Implicit((Object)(object)((dfControl)preOptionsMenu.m_panel).Find<dfButton>("MOD CONFIG"))) { preOptionsMenu.CreateGunfigButton(); } orig(mm); } private static void Pause(Action<GameManager> orig, GameManager gm) { PreOptionsMenuController preOptionsMenu = ((Component)GameUIRoot.Instance.PauseMenuPanel).GetComponent<PauseMenuController>().OptionsMenu.PreOptionsMenu; if (preOptionsMenu != null && !Object.op_Implicit((Object)(object)((dfControl)preOptionsMenu.m_panel).Find<dfButton>("MOD CONFIG"))) { preOptionsMenu.CreateGunfigButton(); } orig(gm); } private static void ToggleToPanel(Action<FullOptionsMenuController, dfScrollPanel, bool> orig, FullOptionsMenuController controller, dfScrollPanel targetPanel, bool doFocus) { bool flag = false; foreach (dfControl registeredTab in _RegisteredTabs) { bool flag3 = (registeredTab.IsVisible = (Object)(object)registeredTab == (Object)(object)targetPanel); flag = flag || flag3; } orig(controller, targetPanel, doFocus); if (flag) { ((dfControl)targetPanel).controls.First().RecursiveFocus(); SetOptionsPageTitle(((Object)targetPanel).name); } else { SetOptionsPageTitle("Options"); } } private static bool CompareSettings(Func<GameOptions, GameOptions, bool> orig, GameOptions clone, GameOptions source) { if (GunfigOption.HasPendingChanges()) { return false; } return orig(clone, source); } private static void HandleCheckboxValueChanged(Action<BraveOptionsMenuItem> orig, BraveOptionsMenuItem item) { orig(item); ((Component)item).GetComponent<CustomCheckboxHandler>()?.onChanged.Invoke(item.m_self, item.m_selectedIndex == 1); } private static void HandleLeftRightArrowValueChanged(Action<BraveOptionsMenuItem> orig, BraveOptionsMenuItem item) { orig(item); ((Component)item).GetComponent<CustomLeftRightArrowHandler>()?.onChanged.Invoke(item.m_self, item.labelOptions[item.m_selectedIndex]); } private static void DoSelectedAction(Action<BraveOptionsMenuItem> orig, BraveOptionsMenuItem item) { orig(item); ((Component)item).GetComponent<CustomButtonHandler>()?.onClicked(item.m_self); } private static void FocusControl(dfControl control, dfMouseEventArgs args) { control.Focus(true); } private static void PlayMenuCursorSound(dfControl control) { AkSoundEngine.PostEvent("Play_UI_menu_select_01", ((Component)control).gameObject); } private static void PlayMenuCursorSound(dfControl control, dfMouseEventArgs args) { PlayMenuCursorSound(control); } private static void PlayMenuCursorSound(dfControl control, dfFocusEventArgs args) { PlayMenuCursorSound(control); } private static void ReCacheControlsAndTabs() { _RegisteredTabs.Clear(); FullOptionsMenuController optionsMenu = ((Component)GameUIRoot.Instance.PauseMenuPanel).GetComponent<PauseMenuController>().OptionsMenu; _CachedPrototypeCheckboxWrapperPanel = ((dfControl)optionsMenu.TabVideo).Find<dfPanel>("V-SyncCheckBoxPanel"); _CachedPrototypeCheckboxInnerPanel = ((dfControl)_CachedPrototypeCheckboxWrapperPanel).Find<dfPanel>("Panel"); _CachedPrototypeCheckbox = ((dfControl)_CachedPrototypeCheckboxInnerPanel).Find<dfCheckbox>("Checkbox"); _CachedPrototypeEmptyCheckboxSprite = ((dfControl)_CachedPrototypeCheckbox).Find<dfSprite>("EmptyCheckbox"); _CachedPrototypeCheckedCheckboxSprite = ((dfControl)_CachedPrototypeCheckbox).Find<dfSprite>("CheckedCheckbox"); _CachedPrototypeCheckboxLabel = ((dfControl)_CachedPrototypeCheckboxInnerPanel).Find<dfLabel>("CheckboxLabel"); _CachedPrototypeLeftRightWrapperPanel = ((dfControl)optionsMenu.TabVideo).Find<dfPanel>("VisualPresetArrowSelectorPanel"); _CachedPrototypeLeftRightInnerPanel = ((dfControl)_CachedPrototypeLeftRightWrapperPanel).Find<dfPanel>("PanelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasy"); _CachedPrototypeLeftRightPanelLabel = ((dfControl)_CachedPrototypeLeftRightInnerPanel).Find<dfLabel>("OptionsArrowSelectorLabel"); _CachedPrototypeLeftRightPanelLeftSprite = ((dfControl)_CachedPrototypeLeftRightInnerPanel).Find<dfSprite>("OptionsArrowSelectorArrowLeft"); _CachedPrototypeLeftRightPanelRightSprite = ((dfControl)_CachedPrototypeLeftRightInnerPanel).Find<dfSprite>("OptionsArrowSelectorArrowRight"); _CachedPrototypeLeftRightPanelSelection = ((dfControl)_CachedPrototypeLeftRightInnerPanel).Find<dfLabel>("OptionsArrowSelectorSelection"); _CachedPrototypeInfoWrapperPanel = ((dfControl)optionsMenu.TabVideo).Find<dfPanel>("ResolutionArrowSelectorPanelWithInfoBox"); _CachedPrototypeInfoInnerPanel = ((dfControl)_CachedPrototypeInfoWrapperPanel).Find<dfPanel>("PanelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasy"); _CachedPrototypeInfoPanelLabel = ((dfControl)_CachedPrototypeInfoInnerPanel).Find<dfLabel>("OptionsArrowSelectorLabel"); _CachedPrototypeInfoPanelLeftSprite = ((dfControl)_CachedPrototypeInfoInnerPanel).Find<dfSprite>("OptionsArrowSelectorArrowLeft"); _CachedPrototypeInfoPanelRightSprite = ((dfControl)_CachedPrototypeInfoInnerPanel).Find<dfSprite>("OptionsArrowSelectorArrowRight"); _CachedPrototypeInfoPanelSelection = ((dfControl)_CachedPrototypeInfoInnerPanel).Find<dfLabel>("OptionsArrowSelectorSelection"); _CachedPrototypeInfoInfoPanel = ((dfControl)_CachedPrototypeInfoWrapperPanel).Find<dfLabel>("OptionsArrowSelectorInfoLabel"); _CachedPrototypeButtonWrapperPanel = ((dfControl)optionsMenu.TabControls).Find<dfPanel>("EditKeyboardBindingsButtonPanel"); _CachedPrototypeButtonInnerPanel = ((dfControl)_CachedPrototypeButtonWrapperPanel).Find<dfPanel>("PanelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasy"); _CachedPrototypeButton = ((dfControl)_CachedPrototypeButtonInnerPanel).Find<dfButton>("EditKeyboardBindingsButton"); _CachedPrototypeLabelWrapperPanel = ((dfControl)optionsMenu.TabControls).Find<dfPanel>("PlayerOneLabelPanel"); _CachedPrototypeLabelInnerPanel = ((dfControl)_CachedPrototypeLabelWrapperPanel).Find<dfPanel>("PanelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasy"); _CachedPrototypeLabel = ((dfControl)_CachedPrototypeLabelInnerPanel).Find<dfLabel>("Label"); } private static void PrintControlRecursive(dfControl control, string indent = "->", bool dissect = false) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Console.WriteLine($" {indent} control with name={((Object)control).name}, type={((object)control).GetType()}, position={control.Position}, relposition={control.RelativePosition}, size={control.Size}, anchor={control.Anchor}, pivot={control.Pivot}"); if (dissect) { Dissect.DumpFieldsAndProperties<dfControl>(control); } foreach (dfControl control2 in control.controls) { PrintControlRecursive(control2, "--" + indent); } } private static T CopyAttributes<T>(this T self, T other) where T : dfControl { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) object obj = self; dfButton val = (dfButton)((obj is dfButton) ? obj : null); if (val != null) { object obj2 = other; dfButton val2 = (dfButton)((obj2 is dfButton) ? obj2 : null); if (val2 != null) { ((dfInteractiveBase)val).Atlas = ((dfInteractiveBase)val2).Atlas; val.ClickWhenSpacePressed = val2.ClickWhenSpacePressed; val.State = val2.State; val.PressedSprite = val2.PressedSprite; val.ButtonGroup = val2.ButtonGroup; val.AutoSize = val2.AutoSize; val.TextAlignment = val2.TextAlignment; val.VerticalAlignment = val2.VerticalAlignment; val.Padding = val2.Padding; val.Font = val2.Font; val.Text = val2.Text; val.TextColor = val2.TextColor; val.HoverTextColor = val2.HoverTextColor; val.NormalBackgroundColor = val2.NormalBackgroundColor; val.HoverBackgroundColor = val2.HoverBackgroundColor; val.PressedTextColor = val2.PressedTextColor; val.PressedBackgroundColor = val2.PressedBackgroundColor; val.FocusTextColor = val2.FocusTextColor; val.FocusBackgroundColor = val2.FocusBackgroundColor; val.DisabledTextColor = val2.DisabledTextColor; val.TextScale = val2.TextScale; val.TextScaleMode = val2.TextScaleMode; val.WordWrap = val2.WordWrap; val.Shadow = val2.Shadow; val.ShadowColor = val2.ShadowColor; val.ShadowOffset = val2.ShadowOffset; } } object obj3 = self; dfPanel val3 = (dfPanel)((obj3 is dfPanel) ? obj3 : null); if (val3 != null) { object obj4 = other; dfPanel val4 = (dfPanel)((obj4 is dfPanel) ? obj4 : null); if (val4 != null) { val3.Atlas = val4.Atlas; val3.BackgroundSprite = val4.BackgroundSprite; val3.BackgroundColor = val4.BackgroundColor; val3.Padding = val4.Padding; } } object obj5 = self; dfCheckbox val5 = (dfCheckbox)((obj5 is dfCheckbox) ? obj5 : null); if (val5 != null) { object obj6 = other; dfCheckbox val6 = (dfCheckbox)((obj6 is dfCheckbox) ? obj6 : null); if (val6 == null) { } } object obj7 = self; dfSprite val7 = (dfSprite)((obj7 is dfSprite) ? obj7 : null); if (val7 != null) { object obj8 = other; dfSprite val8 = (dfSprite)((obj8 is dfSprite) ? obj8 : null); if (val8 != null) { val7.Atlas = val8.Atlas; val7.SpriteName = val8.SpriteName; val7.Flip = val8.Flip; val7.FillDirection = val8.FillDirection; val7.FillAmount = val8.FillAmount; val7.InvertFill = val8.InvertFill; } } object obj9 = self; dfLabel val9 = (dfLabel)((obj9 is dfLabel) ? obj9 : null); if (val9 != null) { object obj10 = other; dfLabel val10 = (dfLabel)((obj10 is dfLabel) ? obj10 : null); if (val10 != null) { val9.Atlas = val10.Atlas; val9.Font = val10.Font; val9.BackgroundSprite = val10.BackgroundSprite; val9.BackgroundColor = val10.BackgroundColor; val9.TextScale = val10.TextScale; val9.TextScaleMode = val10.TextScaleMode; val9.CharacterSpacing = val10.CharacterSpacing; val9.ColorizeSymbols = val10.ColorizeSymbols; val9.ProcessMarkup = true; val9.ShowGradient = val10.ShowGradient; val9.BottomColor = val10.BottomColor; val9.Text = val10.Text; val9.AutoSize = val10.AutoSize; val9.AutoHeight = val10.AutoHeight; val9.WordWrap = val10.WordWrap; val9.TextAlignment = val10.TextAlignment; val9.VerticalAlignment = val10.VerticalAlignment; val9.Outline = val10.Outline; val9.OutlineSize = val10.OutlineSize; val9.OutlineColor = val10.OutlineColor; val9.Shadow = val10.Shadow; val9.ShadowColor = val10.ShadowColor; val9.ShadowOffset = val10.ShadowOffset; val9.Padding = val10.Padding; val9.TabSize = val10.TabSize; } } object obj11 = self; dfScrollbar val11 = (dfScrollbar)((obj11 is dfScrollbar) ? obj11 : null); if (val11 != null) { object obj12 = other; dfScrollbar val12 = (dfScrollbar)((obj12 is dfScrollbar) ? obj12 : null); if (val12 != null) { val11.ControlledByRightStick = val12.ControlledByRightStick; val11.atlas = val12.atlas; val11.orientation = val12.orientation; val11.rawValue = val12.rawValue; val11.minValue = val12.minValue; val11.maxValue = val12.maxValue; val11.stepSize = val12.stepSize; val11.scrollSize = val12.scrollSize; val11.increment = val12.increment; ref dfControl thumb = ref val11.thumb; dfSprite self2 = ((dfControl)val11).AddControl<dfSprite>(); dfControl thumb2 = val12.thumb; thumb = (dfControl)(object)self2.CopyAttributes<dfSprite>((dfSprite)(object)((thumb2 is dfSprite) ? thumb2 : null)); ref dfControl track = ref val11.track; dfSprite self3 = ((dfControl)val11).AddControl<dfSprite>(); dfControl track2 = val12.track; track = (dfControl)(object)self3.CopyAttributes<dfSprite>((dfSprite)(object)((track2 is dfSprite) ? track2 : null)); val11.incButton = val12.incButton; val11.decButton = val12.decButton; val11.thumbPadding = val12.thumbPadding; val11.autoHide = val12.autoHide; } } ((dfControl)self).AllowSignalEvents = ((dfControl)other).AllowSignalEvents; ((dfControl)self).MinimumSize = ((dfControl)other).MinimumSize; ((dfControl)self).MaximumSize = ((dfControl)other).MaximumSize; ((dfControl)self).TabIndex = ((dfControl)other).TabIndex; ((dfControl)self).IsInteractive = ((dfControl)other).IsInteractive; ((dfControl)self).Pivot = ((dfControl)other).Pivot; ((dfControl)self).RelativePosition = ((dfControl)other).RelativePosition; ((dfControl)self).HotZoneScale = ((dfControl)other).HotZoneScale; ((MonoBehaviour)(object)self).useGUILayout = ((MonoBehaviour)(object)other).useGUILayout; ((dfControl)self).Color = ((dfControl)other).Color; ((dfControl)self).DisabledColor = ((dfControl)other).DisabledColor; ((dfControl)self).Anchor = ((dfControl)other).Anchor; ((dfControl)self).CanFocus = ((dfControl)other).CanFocus; ((dfControl)self).AutoFocus = ((dfControl)other).AutoFocus; ((dfControl)self).Size = ((dfControl)other).Size; ((dfControl)self).Opacity = ((dfControl)other).Opacity; ((Behaviour)(object)self).enabled = ((Behaviour)(object)other).enabled; ((dfControl)self).renderOrder = ((dfControl)other).renderOrder; ((dfControl)self).isControlClipped = ((dfControl)other).isControlClipped; return self; } private static void CreateGunfigButton(this PreOptionsMenuController preOptions) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown _GunfigMainPanel = null; dfPanel panel = preOptions.m_panel; dfButton val = ((dfControl)panel).Find<dfButton>("AudioTab (1)"); dfControl down = ((Component)val).GetComponent<UIKeyControls>().down; List<dfButton> list = new List<dfButton>(); foreach (dfControl control in ((dfControl)panel).Controls) { dfButton val2 = (dfButton)(object)((control is dfButton) ? control : null); if (val2 != null) { list.Add(val2); } } list.Sort((dfButton a, dfButton b) => (((dfControl)a).Position.y < ((dfControl)b).Position.y) ? 1 : (-1)); float y = ((dfControl)list.First()).Position.y; float y2 = ((dfControl)list.Last()).Position.y; float num = (y2 - y) / (float)list.Count; for (int i = 0; i < list.Count; i++) { ((dfControl)list[i]).Position = Vector3Extensions.WithY(((dfControl)list[i]).Position, y + num * (float)i); } dfButton val3 = ((dfControl)panel).AddControl<dfButton>().CopyAttributes<dfButton>(val); val3.Text = "MOD CONFIG"; ((Object)val3).name = "MOD CONFIG"; ((dfControl)val3).Position = Vector3Extensions.WithY(((dfControl)val3).Position, y2); object obj = <>O.<0>__OpenGunfigMainMenu; if (obj == null) { MouseEventHandler val4 = OpenGunfigMainMenu; <>O.<0>__OpenGunfigMainMenu = val4; obj = (object)val4; } ((dfControl)val3).Click += (MouseEventHandler)obj; object obj2 = <>O.<1>__FocusControl; if (obj2 == null) { MouseEventHandler val5 = FocusControl; <>O.<1>__FocusControl = val5; obj2 = (object)val5; } ((dfControl)val3).MouseEnter += (MouseEventHandler)obj2; object obj3 = <>O.<2>__PlayMenuCursorSound; if (obj3 == null) { FocusEventHandler val6 = PlayMenuCursorSound; <>O.<2>__PlayMenuCursorSound = val6; obj3 = (object)val6; } ((dfControl)val3).GotFocus += (FocusEventHandler)obj3; UIKeyControls val7 = ((Component)val3).gameObject.AddComponent<UIKeyControls>(); val7.button = val3; val7.selectOnAction = true; val7.clearRepeatingOnSelect = true; val7.up = (dfControl)(object)val; val7.down = down; ((Component)val).GetComponent<UIKeyControls>().down = (dfControl)(object)val3; ((Component)down).GetComponent<UIKeyControls>().up = (dfControl)(object)val3; ((dfControl)val3).PerformLayout(); ((dfControl)panel).PerformLayout(); } private static void OpenGunfigMainMenu(dfControl control, dfMouseEventArgs args) { _MenuStack.Clear(); RegenerateGunfigMainPanel(); OpenSubMenu(_GunfigMainPanel); } private static void RegenerateGunfigMainPanel() { if ((Object)(object)_GunfigMainPanel != (Object)null) { return; } ReCacheControlsAndTabs(); Stopwatch stopwatch = Stopwatch.StartNew(); _GunfigMainPanel = NewOptionsPanel("Modded Options"); foreach (Gunfig activeConfig in Gunfig._ActiveConfigs) { activeConfig.RegenConfigPage().Finalize(); if (activeConfig._BaseGunfig == activeConfig) { ((Component)_GunfigMainPanel.AddButton(activeConfig._modName)).gameObject.AddComponent<GunfigOption>().Setup(activeConfig, null, Gunfig._DefaultValues, activeConfig.OpenConfigPage, Gunfig.Update.Immediate); } } _GunfigMainPanel.Finalize(); stopwatch.Stop(); GunfigDebug.Log($" Options panels built in {stopwatch.ElapsedMilliseconds} milliseconds"); } internal static dfScrollPanel NewOptionsPanel(string name) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) FullOptionsMenuController optionsMenu = ((Component)GameUIRoot.Instance.PauseMenuPanel).GetComponent<PauseMenuController>().OptionsMenu; if (_RefPanel == null) { _RefPanel = ResourceManager.LoadAssetBundle("shared_auto_001").LoadAsset<GameObject>("UI Root").GetComponentInChildren<FullOptionsMenuController>() .TabVideo; } dfScrollPanel refPanel = _RefPanel; dfScrollPanel val = ((dfControl)optionsMenu.m_panel).AddControl<dfScrollPanel>(); ((dfControl)val).SuspendLayout(); val.UseScrollMomentum = refPanel.UseScrollMomentum; val.ScrollWithArrowKeys = refPanel.ScrollWithArrowKeys; val.Atlas = refPanel.Atlas; val.BackgroundSprite = refPanel.BackgroundSprite; val.BackgroundColor = refPanel.BackgroundColor; val.ScrollPadding = refPanel.ScrollPadding; val.WrapLayout = refPanel.WrapLayout; val.FlowDirection = refPanel.FlowDirection; val.FlowPadding = refPanel.FlowPadding; val.ScrollPosition = refPanel.ScrollPosition; val.ScrollWheelAmount = refPanel.ScrollWheelAmount; val.HorzScrollbar = refPanel.HorzScrollbar; val.VertScrollbar = optionsMenu.TabVideo.VertScrollbar; val.WheelScrollDirection = refPanel.WheelScrollDirection; val.UseVirtualScrolling = refPanel.UseVirtualScrolling; val.VirtualScrollingTile = refPanel.VirtualScrollingTile; ((dfControl)val).CanFocus = ((dfControl)refPanel).CanFocus; ((dfControl)val).AllowSignalEvents = ((dfControl)refPanel).AllowSignalEvents; ((dfControl)val).IsEnabled = ((dfControl)refPanel).IsEnabled; ((dfControl)val).IsVisible = ((dfControl)refPanel).IsVisible; ((dfControl)val).IsInteractive = ((dfControl)refPanel).IsInteractive; ((dfControl)val).Tooltip = ((dfControl)refPanel).Tooltip; ((dfControl)val).Anchor = ((dfControl)refPanel).Anchor; ((dfControl)val).Opacity = ((dfControl)refPanel).Opacity; ((dfControl)val).Color = ((dfControl)refPanel).Color; ((dfControl)val).DisabledColor = ((dfControl)refPanel).DisabledColor; ((dfControl)val).Pivot = ((dfControl)refPanel).Pivot; ((dfControl)val).Width = ((dfControl)refPanel).Width; ((dfControl)val).Height = ((dfControl)refPanel).Height; ((dfControl)val).MinimumSize = ((dfControl)refPanel).MinimumSize; ((dfControl)val).MaximumSize = ((dfControl)refPanel).MaximumSize; ((dfControl)val).TabIndex = ((dfControl)refPanel).TabIndex; ((dfControl)val).ClipChildren = ((dfControl)refPanel).ClipChildren; ((dfControl)val).InverseClipChildren = ((dfControl)refPanel).InverseClipChildren; ((dfControl)val).IsLocalized = ((dfControl)refPanel).IsLocalized; ((dfControl)val).HotZoneScale = ((dfControl)refPanel).HotZoneScale; ((MonoBehaviour)val).useGUILayout = ((MonoBehaviour)refPanel).useGUILayout; ((dfControl)val).AutoFocus = ((dfControl)refPanel).AutoFocus; val.AutoLayout = refPanel.AutoLayout; val.AutoReset = refPanel.AutoReset; val.AutoScrollPadding = refPanel.AutoScrollPadding; val.AutoFitVirtualTiles = refPanel.AutoFitVirtualTiles; val.AutoFitVirtualTiles = refPanel.AutoFitVirtualTiles; ((dfControl)val).ClipChildren = true; ((dfControl)val).InverseClipChildren = true; val.ScrollPadding = new RectOffset(0, 0, 0, 0); val.AutoScrollPadding = new RectOffset(0, 0, 0, 0); ((dfControl)val).Size = ((dfControl)val).Size - new Vector2(0f, 50f); ((dfControl)val).ResumeLayout(); ((dfControl)val).Position = Vector3Extensions.WithY(((dfControl)refPanel).Position, 270f); ((Object)val).name = name; ((dfControl)val).PerformLayout(); ((dfControl)val).Enable(); _RegisteredTabs.Add((dfControl)(object)val); return val; } internal static dfPanel AddCheckBox(this dfScrollPanel panel, string label, PropertyChangedEventHandler<bool> onchange = null) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown dfPanel val = ((dfControl)panel).AddControl<dfPanel>().CopyAttributes<dfPanel>(_CachedPrototypeCheckboxWrapperPanel); dfPanel val2 = ((dfControl)val).AddControl<dfPanel>().CopyAttributes<dfPanel>(_CachedPrototypeCheckboxInnerPanel); dfCheckbox val3 = ((dfControl)val2).AddControl<dfCheckbox>().CopyAttributes<dfCheckbox>(_CachedPrototypeCheckbox); dfSprite checkboxUnchecked = ((dfControl)val3).AddControl<dfSprite>().CopyAttributes<dfSprite>(_CachedPrototypeEmptyCheckboxSprite); dfSprite checkboxChecked = ((dfControl)val3).AddControl<dfSprite>().CopyAttributes<dfSprite>(_CachedPrototypeCheckedCheckboxSprite); dfLabel val4 = ((dfControl)val2).AddControl<dfLabel>().CopyAttributes<dfLabel>(_CachedPrototypeCheckboxLabel); val4.Text = label; BraveOptionsMenuItem val5 = ((Component)val).gameObject.AddComponent<BraveOptionsMenuItem>(); val5.optionType = (BraveOptionsOptionType)0; val5.itemType = (BraveOptionsMenuItemType)3; val5.labelControl = val4; val5.checkboxChecked = (dfControl)(object)checkboxChecked; val5.checkboxUnchecked = (dfControl)(object)checkboxUnchecked; val5.selectOnAction = true; val5.checkboxChecked.IsVisible = val5.m_selectedIndex == 1; object obj = <>O.<1>__FocusControl; if (obj == null) { MouseEventHandler val6 = FocusControl; <>O.<1>__FocusControl = val6; obj = (object)val6; } ((dfControl)val).MouseEnter += (MouseEventHandler)obj; object obj2 = <>O.<2>__PlayMenuCursorSound; if (obj2 == null) { FocusEventHandler val7 = PlayMenuCursorSound; <>O.<2>__PlayMenuCursorSound = val7; obj2 = (object)val7; } ((dfControl)val).GotFocus += (FocusEventHandler)obj2; ((Object)val).name = label + " panel"; panel.RegisterBraveMenuItem((dfControl)(object)val); if (onchange != null) { CustomCheckboxHandler orAddComponent = GameObjectExtensions.GetOrAddComponent<CustomCheckboxHandler>(((Component)val5).gameObject); orAddComponent.onChanged = (PropertyChangedEventHandler<bool>)(object)Delegate.Combine((Delegate?)(object)orAddComponent.onChanged, (Delegate?)(object)onchange); } return val; } internal static dfPanel AddArrowBox(this dfScrollPanel panel, string label, List<string> options, List<string> info = null, PropertyChangedEventHandler<string> onchange = null, bool compact = true) { //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown bool flag = info != null && info.Count > 0 && info.Count == options.Count; dfPanel val = ((dfControl)panel).AddControl<dfPanel>().CopyAttributes<dfPanel>(flag ? _CachedPrototypeInfoWrapperPanel : _CachedPrototypeLeftRightWrapperPanel); dfPanel val2 = ((dfControl)val).AddControl<dfPanel>().CopyAttributes<dfPanel>(flag ? _CachedPrototypeInfoInnerPanel : _CachedPrototypeLeftRightInnerPanel); dfLabel val3 = ((dfControl)val2).AddControl<dfLabel>().CopyAttributes<dfLabel>(flag ? _CachedPrototypeInfoPanelLabel : _CachedPrototypeLeftRightPanelLabel); dfLabel val4 = ((dfControl)val2).AddControl<dfLabel>().CopyAttributes<dfLabel>(flag ? _CachedPrototypeInfoPanelSelection : _CachedPrototypeLeftRightPanelSelection); dfSprite left = ((dfControl)val2).AddControl<dfSprite>().CopyAttributes<dfSprite>(flag ? _CachedPrototypeInfoPanelLeftSprite : _CachedPrototypeLeftRightPanelLeftSprite); dfSprite right = ((dfControl)val2).AddControl<dfSprite>().CopyAttributes<dfSprite>(flag ? _CachedPrototypeInfoPanelRightSprite : _CachedPrototypeLeftRightPanelRightSprite); dfLabel val5 = (flag ? ((dfControl)val).AddControl<dfLabel>().CopyAttributes<dfLabel>(_CachedPrototypeInfoInfoPanel) : null); val3.Text = label; val4.Text = options[0]; if ((Object)(object)val5 != (Object)null) { val5.Text = info[0]; } if (compact) { if (flag) { int num = 1; foreach (string item in info) { num = Mathf.Max(num, item.Split(new char[1] { '\n' }).Length); } ((dfControl)val).Size = ((dfControl)val).Size - new Vector2(0f, 66f - 22f * (float)num); } else { ((dfControl)val).Size = ((dfControl)val).Size - new Vector2(0f, 8f); } } BraveOptionsMenuItem val6 = ((Component)val).gameObject.AddComponent<BraveOptionsMenuItem>(); val6.optionType = (BraveOptionsOptionType)0; val6.itemType = (BraveOptionsMenuItemType)(flag ? 1 : 0); val6.labelControl = val3; val6.selectedLabelControl = val4; val6.infoControl = val5; val6.labelOptions = options.ToArray(); val6.infoOptions = (flag ? info.ToArray() : null); val6.left = (dfControl)(object)left; val6.right = (dfControl)(object)right; val6.selectOnAction = true; object obj = <>O.<1>__FocusControl; if (obj == null) { MouseEventHandler val7 = FocusControl; <>O.<1>__FocusControl = val7; obj = (object)val7; } ((dfControl)val).MouseEnter += (MouseEventHandler)obj; object obj2 = <>O.<2>__PlayMenuCursorSound; if (obj2 == null) { FocusEventHandler val8 = PlayMenuCursorSound; <>O.<2>__PlayMenuCursorSound = val8; obj2 = (object)val8; } ((dfControl)val).GotFocus += (FocusEventHandler)obj2; ((Object)val).name = label + " panel"; panel.RegisterBraveMenuItem((dfControl)(object)val); if (onchange != null) { CustomLeftRightArrowHandler orAddComponent = GameObjectExtensions.GetOrAddComponent<CustomLeftRightArrowHandler>(((Component)val6).gameObject); orAddComponent.onChanged = (PropertyChangedEventHandler<string>)(object)Delegate.Combine((Delegate?)(object)orAddComponent.onChanged, (Delegate?)(object)onchange); } return val; } internal static dfPanel AddButton(this dfScrollPanel panel, string label, Action<dfControl> onclick = null) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown dfPanel val = ((dfControl)panel).AddControl<dfPanel>().CopyAttributes<dfPanel>(_CachedPrototypeButtonWrapperPanel); dfPanel val2 = ((dfControl)val).AddControl<dfPanel>().CopyAttributes<dfPanel>(_CachedPrototypeButtonInnerPanel); dfButton val3 = ((dfControl)val2).AddControl<dfButton>().CopyAttributes<dfButton>(_CachedPrototypeButton); val3.Text = label; BraveOptionsMenuItem val4 = ((Component)val).gameObject.AddComponent<BraveOptionsMenuItem>(); val4.optionType = (BraveOptionsOptionType)0; val4.itemType = (BraveOptionsMenuItemType)4; val4.buttonControl = val3; val4.selectOnAction = true; object obj = <>O.<1>__FocusControl; if (obj == null) { MouseEventHandler val5 = FocusControl; <>O.<1>__FocusControl = val5; obj = (object)val5; } ((dfControl)val).MouseEnter += (MouseEventHandler)obj; object obj2 = <>O.<2>__PlayMenuCursorSound; if (obj2 == null) { FocusEventHandler val6 = PlayMenuCursorSound; <>O.<2>__PlayMenuCursorSound = val6; obj2 = (object)val6; } ((dfControl)val).GotFocus += (FocusEventHandler)obj2; ((Object)val).name = label + " panel"; panel.RegisterBraveMenuItem((dfControl)(object)val); if (onclick != null) { CustomButtonHandler orAddComponent = GameObjectExtensions.GetOrAddComponent<CustomButtonHandler>(((Component)val4).gameObject); orAddComponent.onClicked = (Action<dfControl>)Delegate.Combine(orAddComponent.onClicked, onclick); } return val; } internal static dfPanel AddLabel(this dfScrollPanel panel, string label, bool compact = true) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) dfPanel val = ((dfControl)panel).AddControl<dfPanel>().CopyAttributes<dfPanel>(_CachedPrototypeLabelWrapperPanel); dfPanel val2 = ((dfControl)val).AddControl<dfPanel>().CopyAttributes<dfPanel>(_CachedPrototypeLabelInnerPanel); dfLabel val3 = ((dfControl)val2).AddControl<dfLabel>().CopyAttributes<dfLabel>(_CachedPrototypeLabel); val3.Text = label.ProcessColors(out var color); ((dfControl)val3).Color = Color32.op_Implicit(color); if (compact) { ((dfControl)val).Size = ((dfControl)val).Size - new Vector2(0f, 56f); ((dfControl)val2).Position = ((dfControl)val2).Position + new Vector3(0f, 56f, 0f); } ((Object)val).name = label + " panel"; return val; } private static void RegisterBraveMenuItem(this dfScrollPanel panel, dfControl item) { for (int num = ((dfControl)panel).Controls.Count - 2; num >= 0; num--) { dfControl val = ((dfControl)panel).controls[num]; BraveOptionsMenuItem component = ((Component)val).GetComponent<BraveOptionsMenuItem>(); if (component != null) { ((Component)item).GetComponent<BraveOptionsMenuItem>().up = val; component.down = item; break; } } } private static void RecursiveFocus(this dfControl control, bool isRoot = true) { control.canFocus = isRoot; control.AutoFocus = true; foreach (dfControl control2 in control.controls) { control2.RecursiveFocus(isRoot: false); } } private static void Finalize(this dfScrollPanel panel) { dfControl obj = ((dfControl)panel).controls.Last(); obj.Height += 16f; foreach (dfControl control in ((dfControl)panel).controls) { BraveOptionsMenuItem component = ((Component)control).GetComponent<BraveOptionsMenuItem>(); if (component != null) { ((Component)control).GetComponent<GunfigOption>()?.UpdateColors(component, dim: true); } } } internal static void OpenSubMenu(dfScrollPanel panel) { if (_MenuStack.Count > 0) { ((dfControl)_MenuStack.Peek()).IsVisible = false; } _MenuStack.Push(panel); ((Component)GameUIRoot.Instance.PauseMenuPanel).GetComponent<PauseMenuController>().OptionsMenu.PreOptionsMenu.ToggleToPanel(panel, true, true); } private static void SetOptionsPageTitle(string title) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) FullOptionsMenuController optionsMenu = ((Component)GameUIRoot.Instance.PauseMenuPanel).GetComponent<PauseMenuController>().OptionsMenu; if (optionsMenu != null) { dfLabel val = ((dfControl)optionsMenu.m_panel).Find<dfLabel>("Title"); val.Text = title.ProcessColors(out var color); ((dfControl)val).Color = Color32.op_Implicit(color); } } } public static class C { public static readonly bool DEBUG_BUILD = false; public const string MOD_NAME = "Gunfig"; public const string MOD_INT_NAME = "Gunfiguration"; public const string MOD_VERSION = "1.1.3"; public const string MOD_GUID = "pretzel.etg.gunfig"; public const string MOD_PREFIX = "gf"; public static readonly Color MOD_COLOR = new Color(1f, 1f, 0.75f); } [BepInPlugin("pretzel.etg.gunfig", "Gunfiguration", "1.1.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Initialisation : BaseUnityPlugin { public static Initialisation Instance; public void Start() { ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart); } public void GMStart(GameManager manager) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) try { Stopwatch stopwatch = Stopwatch.StartNew(); Instance = this; GunfigMenu.Init(); QoLConfig.Init(); Harmony val = new Harmony("pretzel.etg.gunfig"); val.PatchAll(); stopwatch.Stop(); ETGModConsole.Log((object)("Initialized <color=#" + ColorUtility.ToHtmlStringRGB(C.MOD_COLOR).ToLower() + ">Gunfig v1.1.3</color> in " + (float)stopwatch.ElapsedMilliseconds / 1000f + " seconds"), false); } catch (Exception ex) { ETGModConsole.Log((object)ex.Message, false); ETGModConsole.Log((object)ex.StackTrace, false); } } } public class GunfigDebug { public static void Log(object text) { if (C.DEBUG_BUILD) { ETGModConsole.Log(text, false); } } public static void Warn(string text) { if (C.DEBUG_BUILD) { ETGModConsole.Log((object)("<color=#ffffaaff>" + text + "</color>"), false); } } } public static class Dissect { public static void DumpComponents(this GameObject g) { Component[] components = g.GetComponents(typeof(object)); foreach (Component val in components) { ETGModConsole.Log((object)(" " + ((object)val).GetType().Name), false); } } public static void DumpFieldsAndProperties<T>(T o) { Type typeFromHandle = typeof(T); FieldInfo[] fields = typeFromHandle.GetFields(); foreach (FieldInfo fieldInfo in fields) { Console.WriteLine($"field {fieldInfo.Name} = {fieldInfo.GetValue(o)}"); } foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(o)) { Console.WriteLine(" prop {0} = {1}", property.Name, property.GetValue(o)); } } public static void CompareFieldsAndProperties<T>(T o1, T o2) { Type typeFromHandle = typeof(T); FieldInfo[] fields = typeFromHandle.GetFields(); foreach (FieldInfo fieldInfo in fields) { try { if (fieldInfo.GetValue(o1) == null) { if (fieldInfo.GetValue(o2) != null) { g