Decompiled source of WKLib v0.2.3
plugins/WKLib.dll
Decompiled 2 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.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using Imui.Controls; using Imui.Core; using Imui.IO; using Imui.IO.Events; using Imui.IO.Touch; using Imui.IO.UGUI; using Imui.Rendering; using Imui.Style; using ImuiBepInEx.API; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using WKLib.API; using WKLib.API.Assets; using WKLib.API.Config; using WKLib.API.Input; using WKLib.API.UI; using WKLib.Core.Attributes; using WKLib.Core.Classes; using WKLib.Core.Config; using WKLib.Core.Config.Converters; using WKLib.Core.UI; using WKLib.Core.UI.Windows; using WKLib.Examples.UI; using WKLib.Utilities; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("WKLib")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.2.3.0")] [assembly: AssemblyInformationalVersion("0.2.3+062d1f5bd928f5cf8e87168ae3295ace1c91ea47")] [assembly: AssemblyProduct("WKLib")] [assembly: AssemblyTitle("WKLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.3.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 WKLib { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.monksilly.WKLib", "WKLib", "0.2.3")] public class WKLibPlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__5_0; public static UnityAction <>9__5_1; internal void <OnSceneLoaded>b__5_0() { MonoSingleton<RootPanel>.Instance.IsOpen = !MonoSingleton<RootPanel>.Instance.IsOpen; EventSystem.current.SetSelectedGameObject((GameObject)null); } internal void <OnSceneLoaded>b__5_1() { MonoSingleton<RootPanel>.Instance.IsOpen = !MonoSingleton<RootPanel>.Instance.IsOpen; EventSystem.current.SetSelectedGameObject((GameObject)null); } } public const string GUID = "com.monksilly.WKLib"; public const string NAME = "WKLib"; public const string VERSION = "0.2.3"; private static Harmony harmony; private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown WKLog.Initialize(((BaseUnityPlugin)this).Logger); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; harmony = new Harmony("com.monksilly.WKLib"); Type[] types = typeof(WKLibPlugin).Assembly.GetTypes(); foreach (Type type in types) { if (type.GetCustomAttribute<PatchOnEntryAttribute>() != null) { harmony.PatchAll(type); } } WKLog.Info("Plugin WKLib v0.2.3 is loaded!"); SceneManager.sceneLoaded -= OnSceneLoaded; SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown bool flag = false; if (((Scene)(ref scene)).name == "Main-Menu") { GameObject obj = GameObject.Find("Canvas - Main Menu/Main Menu/Version Text"); TextMeshProUGUI val = ((obj != null) ? obj.GetComponent<TextMeshProUGUI>() : null); if (val != null) { ((TMP_Text)val).text = ((TMP_Text)val).text + string.Format(" (wklib-{0}) ({1} Mods)", "0.2.3", Chainloader.PluginInfos.Count); } GameObject val2 = GameObject.Find("Canvas - Main Menu/Main Menu/Support Menu/Update Info"); if (!((Object)(object)val2 != (Object)null)) { return; } GameObject val3 = Object.Instantiate<GameObject>(val2, val2.transform.parent); val3.transform.SetSiblingIndex(0); ((Object)val3).name = "Toggle Overlay"; UI_MenuButton component = val3.GetComponent<UI_MenuButton>(); if (component != null) { Object.DestroyImmediate((Object)(object)component); } TextMeshProUGUI componentInChildren = val3.GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).text = "Toggle Overlay"; } Button component2 = val3.GetComponent<Button>(); if (!((Object)(object)component2 != (Object)null)) { return; } ((UnityEventBase)component2.onClick).RemoveAllListeners(); ButtonClickedEvent onClick = component2.onClick; object obj2 = <>c.<>9__5_0; if (obj2 == null) { UnityAction val4 = delegate { MonoSingleton<RootPanel>.Instance.IsOpen = !MonoSingleton<RootPanel>.Instance.IsOpen; EventSystem.current.SetSelectedGameObject((GameObject)null); }; <>c.<>9__5_0 = val4; obj2 = (object)val4; } ((UnityEvent)onClick).AddListener((UnityAction)obj2); return; } GameObject val5 = GameObject.Find("GameManager/Canvas/Pause/Pause Menu/Pause Buttons/Pause Layout"); if (!((Object)(object)val5 != (Object)null)) { return; } Transform val6 = val5.transform.Find("Gap.01"); Transform val7 = val5.transform.Find("Settings"); if (!((Object)(object)val6 != (Object)null) || !((Object)(object)val7 != (Object)null)) { return; } GameObject val8 = Object.Instantiate<GameObject>(((Component)val6).gameObject, ((Component)val6).transform.parent); val8.transform.SetSiblingIndex(val6.parent.childCount - 1); ((Object)val8).name = "Gap.03"; GameObject val9 = Object.Instantiate<GameObject>(((Component)val7).gameObject, ((Component)val7).transform.parent); val9.transform.SetSiblingIndex(val7.parent.childCount - 1); ((Object)val9).name = "Toggle Overlay"; UI_MenuButton component3 = val9.GetComponent<UI_MenuButton>(); if (component3 != null) { Object.DestroyImmediate((Object)(object)component3); } TextMeshProUGUI componentInChildren2 = val9.GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren2 != (Object)null) { ((TMP_Text)componentInChildren2).text = "TOGGLE OVERLAY"; } Button component4 = val9.GetComponent<Button>(); if (!((Object)(object)component4 != (Object)null)) { return; } ((UnityEventBase)component4.onClick).RemoveAllListeners(); ButtonClickedEvent onClick2 = component4.onClick; object obj3 = <>c.<>9__5_1; if (obj3 == null) { UnityAction val10 = delegate { MonoSingleton<RootPanel>.Instance.IsOpen = !MonoSingleton<RootPanel>.Instance.IsOpen; EventSystem.current.SetSelectedGameObject((GameObject)null); }; <>c.<>9__5_1 = val10; obj3 = (object)val10; } ((UnityEvent)onClick2).AddListener((UnityAction)obj3); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } Object.Destroy((Object)(object)MonoSingleton<RootPanel>.Instance.ImuiPanel.Canvas); SceneManager.sceneLoaded -= OnSceneLoaded; WKLog.Info("Plugin WKLib unloaded!"); } } } namespace WKLib.Utilities { internal static class WKLog { private static ManualLogSource _log; internal static void Initialize(ManualLogSource logSource) { _log = logSource; } public static void Info(object msg) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)$"[WKLib] {msg}"); } } public static void Warn(object msg) { ManualLogSource log = _log; if (log != null) { log.LogWarning((object)$"[WKLib] {msg}"); } } public static void Error(object msg) { ManualLogSource log = _log; if (log != null) { log.LogError((object)$"[WKLib] {msg}"); } } public static void Debug(object msg) { ManualLogSource log = _log; if (log != null) { log.LogDebug((object)$"[WKLib] {msg}"); } } } } namespace WKLib.Examples.UI { [Flags] internal enum DemoEnumFlags { None = 0, Flag1 = 1, Flag2 = 2, Flag3 = 4, Flag1And3 = 5 } internal struct DemoTreeNode { public string Name; public DemoTreeNode[] Childrens; public DemoTreeNode(string name, params DemoTreeNode[] childrens) { Name = name; Childrens = childrens; } } public static class DemoWindow { private static char[] formatBuffer = new char[256]; private static bool checkboxValue; private static int selectedValue = -1; private static float bouncingBallSize = 22f; private static float bouncingBallSpeed = 1f; private static int bouncingBallTrail = 32; private static float bouncingBallTime; private static string[] values = new string[12] { "Value 1", "Value 2", "Value 3", "Value 4", "Value 5", "Value 6", "Value 7", "Value 8", "Value 9", "Value 10", "Value 11", "Value 12" }; private static string textWithHint = string.Empty; private static string singleLineText = "Single line text edit"; private static string multiLineText = "Multiline text\nedit"; private static float floatValue = 10.5f; private static int intValue = 105; private static bool isReadOnly; private static bool customDropdownOpen; private static ImDropdownPreviewType dropdownPreview; private static bool[] checkboxes = new bool[4]; private static int clicks; private static int nestedFoldouts; private static bool showPlusMinusButtons = true; private static bool useNumericSlider = false; private static DemoEnumFlags demoFlags; private static int largeTableRows = 131072; private static int largeTableColumns = 512; private static float largeTableColumnSize = 150f; private static bool largeTableScrollable = true; private static bool largeTableResizable = true; private static Vector2 vec2 = new Vector2(1f, 2f); private static Vector3 vec3 = new Vector3(1f, 2f, 3f); private static Vector4 vec4 = new Vector4(1f, 2f, 3f, 4f); private static Vector2Int vec2int = new Vector2Int(1, 2); private static Vector3Int vec3int = new Vector3Int(1, 2, 3); private static bool textEditWrap; private static bool selectMultipleValues = false; private static HashSet<string> selectedNodes = new HashSet<string>(8); private static readonly DemoTreeNode[] treeNodes = new DemoTreeNode[3] { new DemoTreeNode("Node 0", new DemoTreeNode("Node 1"), new DemoTreeNode("Node 2")), new DemoTreeNode("Node 3"), new DemoTreeNode("Node 4", new DemoTreeNode("Node 5", new DemoTreeNode("Node 6"), new DemoTreeNode("Node 7"))) }; private static HashSet<int> selectedValues = new HashSet<int>(values.Length); public static void Draw(ImGui gui, ref bool open) { //IL_0017: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00df: Unknown result type (might be due to invalid IL or missing references) if (ImWindow.BeginWindow(gui, "Demo", ref open, ImSize.op_Implicit((700f, 700f)), (ImWindowFlag)16)) { ImMenuBar.BeginMenuBar(gui); DrawMenuBarItems(gui, ref open); ImMenuBar.EndMenuBar(gui); if (ImFoldout.BeginFoldout(gui, "Controls".AsSpan(), default(ImSize), false)) { ImLayoutUtility.BeginIndent(gui); DrawControlsPage(gui, ref open); ImLayoutUtility.EndIndent(gui); ImFoldout.EndFoldout(gui); } gui.BeginReadOnly(isReadOnly); if (ImFoldout.BeginFoldout(gui, "Layout".AsSpan(), default(ImSize), false)) { ImLayoutUtility.BeginIndent(gui); DrawLayoutPage(gui); ImLayoutUtility.EndIndent(gui); ImFoldout.EndFoldout(gui); } if (ImFoldout.BeginFoldout(gui, "Tables".AsSpan(), default(ImSize), false)) { ImLayoutUtility.BeginIndent(gui); DrawTablesPage(gui); ImLayoutUtility.EndIndent(gui); ImFoldout.EndFoldout(gui); } gui.EndReadOnly(); ImWindow.EndWindow(gui); } } private static void DrawControlsPage(ImGui gui, ref bool open) { //IL_0013: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: 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_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: 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_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06dc: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) ImCheckbox.Checkbox(gui, ref isReadOnly, "Read Only".AsSpan(), default(ImSize)); gui.BeginReadOnly(isReadOnly); ImLayoutUtility.AddSpacingIfLayoutFrameNotEmpty(gui); ImLayoutUtility.BeginHorizontal(gui, 0f, 0f); if (ImButton.Button(gui, Format("Clicks ".AsSpan(), clicks, "0".AsSpan()), ImSize.op_Implicit((ImSizeMode)2), (ImButtonFlag)0)) { clicks++; } if (ImButton.Button(gui, "Reset Clicks".AsSpan(), ImSize.op_Implicit((ImSizeMode)0), (ImButtonFlag)0)) { clicks = 0; } ImLayoutUtility.EndHorizontal(gui); ImCheckbox.Checkbox(gui, ref checkboxValue, "Checkbox".AsSpan(), default(ImSize)); ImLayoutUtility.AddSpacingIfLayoutFrameNotEmpty(gui); ImLayoutUtility.BeginHorizontal(gui, 0f, 0f); ImText.Text(gui, "Dropdown preview mode: ".AsSpan(), false, (ImTextOverflow)0); ImRadio.Radio<ImDropdownPreviewType>(gui, ref dropdownPreview, true); ImLayoutUtility.EndHorizontal(gui); ReadOnlySpan<string> readOnlySpan = values; ReadOnlySpan<char> readOnlySpan2 = "Dropdown without value selected".AsSpan(); ImDropdownPreviewType val = dropdownPreview; ImDropdown.Dropdown(gui, ref selectedValue, readOnlySpan, default(ImSize), val, readOnlySpan2); ReadOnlySpan<char> readOnlySpan3 = "Custom Dropdown".AsSpan(); val = dropdownPreview; if (ImDropdown.BeginDropdown(gui, readOnlySpan3, default(ImSize), val)) { if (ImMenu.Menu(gui, "Menu Item".AsSpan())) { ImDropdown.CloseDropdown(gui); } ImTooltip.TooltipAtLastControl(gui, "Will close dropdown on click".AsSpan(), (ImTooltipShow)1); if (ImMenu.BeginMenu(gui, "Sub Menu Inside Dropdown".AsSpan())) { ImText.Text(gui, "Hello there".AsSpan(), false, (ImTextOverflow)0); ImMenu.EndMenu(gui); } ImCheckbox.Checkbox(gui, ref checkboxValue, "Checkbox".AsSpan(), default(ImSize)); ImSeparator.Separator(gui, "Nested dropdown, if that's want you really want".AsSpan()); ReadOnlySpan<string> readOnlySpan4 = values; readOnlySpan2 = "Nothing".AsSpan(); val = dropdownPreview; ImDropdown.Dropdown(gui, ref selectedValue, readOnlySpan4, default(ImSize), val, readOnlySpan2); ImDropdown.EndDropdown(gui); } ImSeparator.Separator(gui, "Text editors".AsSpan()); readOnlySpan2 = "Write something here".AsSpan(); ImTextEdit.TextEdit(gui, ref textWithHint, default(ImSize), (bool?)null, 0, (ImTouchKeyboardType)0, readOnlySpan2); bool? flag = false; ImTextEdit.TextEdit(gui, ref singleLineText, default(ImSize), flag, 0, (ImTouchKeyboardType)0, default(ReadOnlySpan<char>)); ImCheckbox.Checkbox(gui, ref textEditWrap, "Wrap Text".AsSpan(), default(ImSize)); ImStyleScope<bool> val2 = ImControlStyleExtensions.StyleScope<bool>(gui, ref gui.Style.TextEdit.TextWrap, ref textEditWrap); try { flag = true; ImTextEdit.TextEdit(gui, ref multiLineText, default(ImSize), flag, 0, (ImTouchKeyboardType)0, default(ReadOnlySpan<char>)); } finally { val2.Dispose(); } ImSeparator.Separator(gui, "Sliders (with tooltips)".AsSpan()); DrawSlidersDemo(gui); ImSeparator.Separator(gui, "Selection list (you can select multiple values)".AsSpan()); ImList.BeginList(gui, ImSize.op_Implicit((ImLayoutUtility.GetLayoutWidth(gui), ImList.GetEnclosingHeight(gui, ImLayoutUtility.GetRowsHeightWithSpacing(gui, 3))))); for (int i = 0; i < values.Length; i++) { bool flag2 = selectedValues.Contains(i); if (ImList.ListItem(gui, flag2, values[i].AsSpan())) { if (flag2) { selectedValues.Remove(i); } else { selectedValues.Add(i); } } } ImList.EndList(gui); ImSeparator.Separator(gui, "Numeric editors".AsSpan()); gui.BeginReadOnly(useNumericSlider); ImCheckbox.Checkbox(gui, ref showPlusMinusButtons, "Enable Plus/Minus buttons".AsSpan(), default(ImSize)); gui.EndReadOnly(); ImCheckbox.Checkbox(gui, ref useNumericSlider, "Enable Slider".AsSpan(), default(ImSize)); ImNumericEditFlag val3 = (ImNumericEditFlag)0; val3 = (ImNumericEditFlag)(val3 | (showPlusMinusButtons ? 1 : 0)); val3 = (ImNumericEditFlag)(val3 | (useNumericSlider ? 2 : 0)); ImNumericEditFlag val4 = val3; readOnlySpan2 = "0.0### kg".AsSpan(); ImNumericEdit.NumericEdit(gui, ref floatValue, default(ImSize), readOnlySpan2, 0.05f, float.MinValue, float.MaxValue, val4); val4 = val3; readOnlySpan2 = "0 miles".AsSpan(); ImNumericEdit.NumericEdit(gui, ref intValue, default(ImSize), readOnlySpan2, 1, int.MinValue, int.MaxValue, val4); ImLayoutUtility.AddSpacingIfLayoutFrameNotEmpty(gui); ImSeparator.Separator(gui, "Radio buttons (enum flags)".AsSpan()); ImRadio.Radio<DemoEnumFlags>(gui, ref demoFlags, true); ImSeparator.Separator(gui, "Dropdown (enum flags)".AsSpan()); ImDropdown.Dropdown<DemoEnumFlags>(gui, ref demoFlags, default(ImSize), (ImDropdownPreviewType)0); ImSeparator.Separator(gui, "Trees".AsSpan()); DrawTreeDemo(gui); ImSeparator.Separator(gui, "Nested Foldout".AsSpan()); NestedFoldout(gui, 0, ref nestedFoldouts); ImSeparator.Separator(gui, "Floating menu".AsSpan()); ImRect val5 = ImLayoutUtility.AddLayoutRect(gui, ImLayoutUtility.GetLayoutWidth(gui), ImLayoutUtility.GetRowHeight(gui)); ImMenuBar.BeginMenuBar(gui, val5); DrawMenuBarItems(gui, ref open); ImMenuBar.EndMenuBar(gui); ImSeparator.Separator(gui, "Tabs".AsSpan()); ImLayoutUtility.AddSpacing(gui); ImTabsPane.BeginTabsPane(gui, ImLayoutUtility.AddLayoutRect(gui, ImLayoutUtility.GetLayoutWidth(gui), ImLayoutUtility.GetRowsHeightWithSpacing(gui, 2)), (ImTabsPaneFlags)0); for (int j = 0; j < 4; j++) { Span<char> span = gui.Formatter.Concat("Tab ".AsSpan(), j); if (ImTabsPane.BeginTab(gui, (ReadOnlySpan<char>)span)) { ImText.Text(gui, (ReadOnlySpan<char>)span, false, (ImTextOverflow)0); ImTabsPane.EndTab(gui); } } ImTabsPane.EndTabsPane(gui); ImSeparator.Separator(gui, "Vectors (float)".AsSpan()); ImText.Text(gui, "Two component vector".AsSpan(), false, (ImTextOverflow)0); ImVector.Vector(gui, ref vec2, default(ImSize)); ImText.Text(gui, "Three component vector".AsSpan(), false, (ImTextOverflow)0); ImVector.Vector(gui, ref vec3, default(ImSize)); ImText.Text(gui, "Four component vector".AsSpan(), false, (ImTextOverflow)0); ImVector.Vector(gui, ref vec4, default(ImSize)); ImSeparator.Separator(gui, "Vectors (int)".AsSpan()); ImText.Text(gui, "Two component vector".AsSpan(), false, (ImTextOverflow)0); ImVector.Vector(gui, ref vec2int, default(ImSize)); ImText.Text(gui, "Three component vector".AsSpan(), false, (ImTextOverflow)0); ImVector.Vector(gui, ref vec3int, default(ImSize)); gui.EndReadOnly(); } private static void DrawSelectableTreeDemo(ImGui gui) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) ImCheckbox.Checkbox(gui, ref selectMultipleValues, "Select multiple values".AsSpan(), default(ImSize)); ImLayoutUtility.BeginHorizontal(gui, 0f, 0f); ImText.Text(gui, "Selected nodes: ".AsSpan(), false, (ImTextOverflow)0); foreach (string selectedNode in selectedNodes) { ImText.Text(gui, selectedNode.AsSpan(), false, (ImTextOverflow)0); ImLayoutUtility.AddSpacing(gui); } ImLayoutUtility.EndHorizontal(gui); for (int i = 0; i < treeNodes.Length; i++) { Node(ref treeNodes[i]); } void Node(ref DemoTreeNode node) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0049: 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) ImTreeNodeFlags val = (ImTreeNodeFlags)((selectMultipleValues ? 1 : 0) | ((node.Childrens.Length == 0) ? 4 : 0)); bool selected2 = selectedNodes.Contains(node.Name); ImGui obj = gui; ReadOnlySpan<char> readOnlySpan = node.Name.AsSpan(); ImTreeNodeFlags val2 = val; bool flag = ImTree.BeginTreeNode(obj, ref selected2, readOnlySpan, default(ImSize), val2); SetSelected(node.Name, selected2); if (flag) { for (int j = 0; j < node.Childrens.Length; j++) { Node(ref node.Childrens[j]); } ImTree.EndTreeNode(gui); } } static void SetSelected(string name, bool selected) { if (selected) { if (!selectMultipleValues) { selectedNodes.Clear(); } selectedNodes.Add(name); } else { selectedNodes.Remove(name); } } } private static void DrawTreeDemo(ImGui gui) { //IL_000e: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) ImTree.TreeNode(gui, "Node 0".AsSpan(), default(ImSize), (ImTreeNodeFlags)0); if (ImTree.BeginTreeNode(gui, "Node 1".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { ImTree.TreeNode(gui, "Node 3".AsSpan(), default(ImSize), (ImTreeNodeFlags)0); if (ImTree.BeginTreeNode(gui, "Node 4".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { ImTree.TreeNode(gui, "Node 5".AsSpan(), default(ImSize), (ImTreeNodeFlags)0); ImTree.EndTreeNode(gui); } ImTree.EndTreeNode(gui); } ImTree.TreeNode(gui, "Node 5".AsSpan(), default(ImSize), (ImTreeNodeFlags)0); if (ImTree.BeginTreeNode(gui, "Selectable nodes demo".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { DrawSelectableTreeDemo(gui); ImTree.EndTreeNode(gui); } } private static void DrawSlidersDemo(ImGui gui) { //IL_003b: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00eb: Unknown result type (might be due to invalid IL or missing references) DrawBouncingBall(gui); ImSlider.SliderHeader(gui, "Size".AsSpan(), bouncingBallSize, "0.00 px".AsSpan()); ImSlider.Slider(gui, ref bouncingBallSize, 1f, ImLayoutUtility.GetRowHeight(gui), default(ImSize), 0f, (ImSliderFlag)0); ImTooltip.TooltipAtLastControl(gui, "Size of the circles in pixels".AsSpan(), (ImTooltipShow)1); ImSlider.SliderHeader(gui, "Speed".AsSpan(), bouncingBallSpeed, "0.##".AsSpan()); ImSlider.Slider(gui, ref bouncingBallSpeed, -2f, 2f, default(ImSize), 0f, (ImSliderFlag)0); ImTooltip.TooltipAtLastControl(gui, "Speed of moving circles".AsSpan(), (ImTooltipShow)1); ImSlider.SliderHeader(gui, "Trail Length".AsSpan(), (float)bouncingBallTrail, default(ReadOnlySpan<char>)); ImSlider.Slider(gui, ref bouncingBallTrail, 1, 256, default(ImSize), 32, (ImSliderFlag)1); ImTooltip.TooltipAtLastControl(gui, "Number of circles drawn".AsSpan(), (ImTooltipShow)1); } private static void DrawMenuBarItems(ImGui gui, ref bool windowOpen) { if (!ImMenu.BeginMenu(gui, "Demo".AsSpan())) { return; } if (ImMenu.BeginMenu(gui, "Custom Menus".AsSpan())) { ImLayoutUtility.BeginVertical(gui, 300f, 0f); DrawSlidersDemo(gui); ImLayoutUtility.EndVertical(gui); ImMenu.EndMenu(gui); } if (ImMenu.BeginMenu(gui, "Recursive".AsSpan())) { DrawMenuBarItems(gui, ref windowOpen); ImMenu.EndMenu(gui); } ImSeparator.Separator(gui); if (ImMenu.BeginMenu(gui, "Test".AsSpan())) { if (ImMenu.BeginMenu(gui, "Same name submenu".AsSpan())) { ImMenu.Menu(gui, "Item".AsSpan()); ImMenu.EndMenu(gui); } gui.PushId("Next Menu".AsSpan()); if (ImMenu.BeginMenu(gui, "Same name submenu".AsSpan())) { ImMenu.Menu(gui, "Item".AsSpan()); ImMenu.EndMenu(gui); } gui.PopId(); ImMenu.EndMenu(gui); } ImSeparator.Separator(gui); if (ImMenu.Menu(gui, "Close".AsSpan())) { windowOpen = false; } ImMenu.EndMenu(gui); } private static void DrawLayoutPage(ImGui gui) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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) ImLayoutUtility.AddSpacing(gui); ImLayoutUtility.BeginHorizontal(gui, 0f, 0f); for (int i = 0; i < 3; i++) { ImButton.Button(gui, "Horizontal".AsSpan(), ImSize.op_Implicit((ImSizeMode)2), (ImButtonFlag)0); } ImLayoutUtility.EndHorizontal(gui); ImLayoutUtility.AddSpacing(gui); ImLayoutUtility.BeginVertical(gui, 0f, 0f); for (int j = 0; j < 3; j++) { ImButton.Button(gui, "Vertical".AsSpan(), ImSize.op_Implicit((ImSizeMode)2), (ImButtonFlag)0); } ImLayoutUtility.EndVertical(gui); ImLayoutUtility.AddSpacing(gui); ImGridState val = ImGrid.BeginGrid(gui, 5, ImLayoutUtility.GetRowHeight(gui)); for (int k = 0; k < 12; k++) { ImText.TextAutoSize(gui, Format("Grid cell ".AsSpan(), k, "0".AsSpan()), ImGrid.GridNextCell(gui, ref val), false); } ImGrid.EndGrid(gui, ref val); } private static void DrawTablesPage(ImGui gui) { //IL_000e: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034c: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) if (ImTree.BeginTreeNode(gui, "Simple".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { _ = ref ImTable.BeginTable(gui, 4, default(ImSize), (ImTableFlag)0); for (int i = 0; i < 5; i++) { ImTable.TableNextRow(gui); for (int j = 0; j < 4; j++) { ImTable.TableNextColumn(gui); ImText.Text(gui, (ReadOnlySpan<char>)gui.Formatter.Concat("Hello At ".AsSpan(), gui.Formatter.Format((long)j, default(ReadOnlySpan<char>)), ":".AsSpan(), gui.Formatter.Format((long)i, default(ReadOnlySpan<char>))), false, (ImTextOverflow)0); } } ImTable.EndTable(gui); ImSeparator.Separator(gui, "Resizable Columns".AsSpan()); _ = ref ImTable.BeginTable(gui, 4, default(ImSize), (ImTableFlag)1); for (int k = 0; k < 5; k++) { ImTable.TableNextRow(gui); for (int l = 0; l < 4; l++) { ImTable.TableNextColumn(gui); ImText.Text(gui, (ReadOnlySpan<char>)gui.Formatter.Concat("Hello At ".AsSpan(), gui.Formatter.Format((long)l, default(ReadOnlySpan<char>)), ":".AsSpan(), gui.Formatter.Format((long)k, default(ReadOnlySpan<char>))), true, (ImTextOverflow)0); } } ImTable.EndTable(gui); ImTree.EndTreeNode(gui); } if (ImTree.BeginTreeNode(gui, "With Scroll Bars".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { _ = ref ImTable.BeginTable(gui, 4, ImSize.op_Implicit((ImLayoutUtility.GetLayoutWidth(gui), 200f)), (ImTableFlag)0); for (int m = 0; m < 12; m++) { ImTable.TableNextRow(gui); for (int n = 0; n < 4; n++) { ImTable.TableNextColumn(gui); ImText.Text(gui, (ReadOnlySpan<char>)gui.Formatter.Concat("Hello At ".AsSpan(), gui.Formatter.Format((long)n, default(ReadOnlySpan<char>)), ":".AsSpan(), gui.Formatter.Format((long)m, default(ReadOnlySpan<char>))), true, (ImTextOverflow)0); } } ImTable.EndTable(gui); ImTree.EndTreeNode(gui); } if (!ImTree.BeginTreeNode(gui, "Large Tables".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { return; } NumEditWithLabel(gui, ref largeTableRows, "Rows".AsSpan(), 1, 4194304); NumEditWithLabel(gui, ref largeTableColumns, "Columns".AsSpan(), 1, 4096); NumEditWithLabel(gui, ref largeTableColumnSize, "Col. Size".AsSpan(), 50f, 300f); ImCheckbox.Checkbox(gui, ref largeTableResizable, "Resizable Columns".AsSpan(), default(ImSize)); ImCheckbox.Checkbox(gui, ref largeTableScrollable, "Scrollable".AsSpan(), default(ImSize)); ImSize val = (largeTableScrollable ? new ImSize(ImLayoutUtility.GetLayoutWidth(gui), 300f) : new ImSize((ImSizeMode)0)); ImTableFlag val2 = (ImTableFlag)(largeTableResizable ? 1 : 0); ref ImTableState reference = ref ImTable.BeginTable(gui, largeTableColumns, val, val2); ImTable.TableSetRowsHeight(gui, ImLayoutUtility.GetTextLineHeight(gui) + ((ImPadding)(ref gui.Style.Table.CellPadding)).Vertical); for (int num = 0; num < largeTableColumns; num++) { ImTable.TableSetColumnWidth(gui, num, largeTableColumnSize); } ImTextSettings val3 = default(ImTextSettings); ((ImTextSettings)(ref val3))..ctor(gui.Style.Layout.TextSize, new ImAlignment(0.5f, 0.5f), false, (ImTextOverflow)1); ImTableRowsRange val4 = ImTable.TableGetVisibleRows(gui, largeTableRows); ImTableColumnsRange val5 = ImTable.TableGetVisibleColumns(gui); for (int num2 = val4.Min; num2 < val4.Max; num2++) { ImTable.TableSetRow(gui, num2, ref reference); for (int num3 = val5.Min; num3 < val5.Max; num3++) { ImTable.TableSetColumn(gui, num3, ref reference); ImText.Text(gui, (ReadOnlySpan<char>)gui.Formatter.Concat(gui.Formatter.Format((long)num3, default(ReadOnlySpan<char>)), "x".AsSpan(), gui.Formatter.Format((long)num2, default(ReadOnlySpan<char>))), ref val3); } } ImTable.EndTable(gui); ImTree.EndTreeNode(gui); } private static void NumEditWithLabel(ImGui gui, ref int value, ReadOnlySpan<char> label, int min, int max) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) ImLayoutUtility.AddSpacingIfLayoutFrameNotEmpty(gui); ImLayoutUtility.BeginHorizontal(gui, 0f, 0f); ImText.Text(gui, label, gui.Layout.AddRect(150f, ImLayoutUtility.GetRowHeight(gui)), false, (ImTextOverflow)0); ImNumericEdit.NumericEdit(gui, ref value, default(ImSize), default(ReadOnlySpan<char>), 1, min, max, (ImNumericEditFlag)1); ImLayoutUtility.EndHorizontal(gui); } private static void NumEditWithLabel(ImGui gui, ref float value, ReadOnlySpan<char> label, float min, float max) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) ImLayoutUtility.AddSpacingIfLayoutFrameNotEmpty(gui); ImLayoutUtility.BeginHorizontal(gui, 0f, 0f); ImText.Text(gui, label, gui.Layout.AddRect(150f, ImLayoutUtility.GetRowHeight(gui)), false, (ImTextOverflow)0); ImNumericEdit.NumericEdit(gui, ref value, default(ImSize), default(ReadOnlySpan<char>), 0.1f, min, max, (ImNumericEditFlag)1); ImLayoutUtility.EndHorizontal(gui); } public static void DrawBouncingBall(ImGui gui) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) ImRect val = ImRectUtility.WithPadding(ImLayoutUtility.AddLayoutRectWithSpacing(gui, ImLayoutUtility.GetLayoutWidth(gui), ImLayoutUtility.GetRowHeight(gui) * 1.25f), bouncingBallSize / 2f, bouncingBallSize / 2f, 0f, 0f); float num = Time.unscaledDeltaTime * bouncingBallSpeed; bouncingBallTime += num; for (int i = 0; i < bouncingBallTrail; i++) { float num2 = mod(bouncingBallTime + (float)i * 0.01f * bouncingBallSpeed, 2f); float num3 = ((num2 <= 1f) ? num2 : (1f - (num2 - 1f))); float num4 = 0.5f + Mathf.Sin((bouncingBallTime + (float)i * 0.01f * bouncingBallSpeed) * MathF.PI * 2f) * 0.25f; Vector2 pointAtNormalPosition = ((ImRect)(ref val)).GetPointAtNormalPosition(num3, num4); Color32 val2 = ImColorUtility.WithAlpha(gui.Style.Text.Color, Mathf.Pow((float)(i + 1) / (float)bouncingBallTrail, 6f)); gui.Canvas.Circle(pointAtNormalPosition, bouncingBallSize * 0.5f, val2); } static float mod(float x, float y) { return (x % y + y) % y; } } public static void NestedFoldout(ImGui gui, int current, ref int total) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00a1: 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) ReadOnlySpan<char> readOnlySpan = ((current == 0) ? "Nested Foldout".AsSpan() : Format("Nested Foldout ".AsSpan(), current, "0".AsSpan())); if (!ImFoldout.BeginFoldout(gui, readOnlySpan, default(ImSize), false)) { return; } ImLayoutUtility.BeginIndent(gui); if (current < total) { NestedFoldout(gui, current + 1, ref total); } else if (current == total) { if (total == 8) { ImText.Text(gui, "Let's just stop here".AsSpan(), false, (ImTextOverflow)0); if (ImButton.Button(gui, "Reset".AsSpan(), default(ImSize), (ImButtonFlag)0)) { total = 0; } } else if (ImButton.Button(gui, "Add one more".AsSpan(), default(ImSize), (ImButtonFlag)0)) { total++; } } ImLayoutUtility.EndIndent(gui); ImFoldout.EndFoldout(gui); } private static ReadOnlySpan<char> Format(ReadOnlySpan<char> prefix, float value, ReadOnlySpan<char> format = default(ReadOnlySpan<char>)) { Span<char> destination = new Span<char>(formatBuffer); prefix.CopyTo(destination); int length = prefix.Length; value.TryFormat(destination.Slice(length, destination.Length - length), out var charsWritten, format); return destination.Slice(0, prefix.Length + charsWritten); } } } namespace WKLib.Core.UI { internal class OverlayState : MonoBehaviour { public static List<PopupSettings> Popups = new List<PopupSettings>(); private Dictionary<GraphicRaycaster, bool> _originalState = new Dictionary<GraphicRaycaster, bool>(); private CL_GameManager gameManager = null; private GraphicRaycaster mainGraphicRaycaster = null; private bool isOpen = false; public bool IsOpen { get { return isOpen; } set { if ((Object)(object)gameManager == (Object)null) { GameObject obj = GameObject.Find("GameManager"); gameManager = ((obj != null) ? obj.GetComponent<CL_GameManager>() : null); } bool flag = (Object)(object)gameManager != (Object)null && gameManager.loading; bool flag2 = (Object)(object)gameManager != (Object)null && gameManager.reviving; if (!flag && !flag2) { if (isOpen == value) { return; } } else { value = false; } isOpen = value; bool flag3 = (Object)(object)gameManager != (Object)null && gameManager.isPaused; bool inUse = OS_Manager.inUse; bool flag4 = (Object)(object)gameManager != (Object)null && Object.op_Implicit((Object)(object)gameManager.pauseMenu); bool flag5 = (Object)(object)gameManager != (Object)null && gameManager.canPause; if (isOpen) { _originalState.Clear(); if (flag4) { if (flag3) { return; } if (!inUse && flag5 && !flag && !flag2) { CL_GameManager obj2 = gameManager; if (obj2 != null) { obj2.Pause(); } return; } isOpen = false; PopupSettings popupSettings = new PopupSettings(); if (inUse) { popupSettings.PopupText = "Cannot open overlay in terminal."; } else if (!flag5) { popupSettings.PopupText = "Cannot open because game cannot be paused."; } else if (flag) { popupSettings.PopupText = "Cannot open overlay because the game is loading."; } else if (flag2) { popupSettings.PopupText = "Cannot open overlay because the player is reviving."; } popupSettings.TimeTillClose = Time.realtimeSinceStartup + popupSettings.PopupTime; Popups.Add(popupSettings); } else { if (!((Object)(object)mainGraphicRaycaster != (Object)null)) { return; } GraphicRaycaster[] array = Object.FindObjectsOfType<GraphicRaycaster>(); GraphicRaycaster[] array2 = array; foreach (GraphicRaycaster val in array2) { if (!((Object)(object)val == (Object)null)) { _originalState[val] = ((UIBehaviour)val).IsActive(); ((Behaviour)val).enabled = false; } } ((Behaviour)mainGraphicRaycaster).enabled = true; } return; } if (flag4) { if (flag3 && !inUse && flag5 && !flag && !flag2) { CL_GameManager obj3 = gameManager; if (obj3 != null) { obj3.UnPause(); } } return; } foreach (KeyValuePair<GraphicRaycaster, bool> item in _originalState) { if (!((Object)(object)item.Key == (Object)null)) { ((Behaviour)item.Key).enabled = true; } } } } private void OnEnable() { mainGraphicRaycaster = ((Component)this).gameObject.GetComponent<GraphicRaycaster>(); } public void Draw(ImGui gui) { foreach (PopupSettings popup in Popups) { if (Time.realtimeSinceStartup < popup.TimeTillClose) { QuickPopupWindow.Draw(gui, popup.PopupText); } } } } internal class RootPanel : MonoSingleton<RootPanel> { public ImGui gui = null; public ImuiPanel ImuiPanel = null; public ThemeController ThemeController = null; public OverlayState OverlayState = null; private bool isDemoOpen = false; public bool IsOpen { get { return OverlayState.IsOpen; } set { OverlayState.IsOpen = value; } } public override void OnEnable() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown base.OnEnable(); SceneManager.sceneLoaded -= OnSceneChange; SceneManager.sceneLoaded += OnSceneChange; ((Object)ImuiPanel.Canvas).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)ImuiPanel.Canvas); ImuiUnityGUIBackend component = ((Component)((Component)this).transform).GetComponent<ImuiUnityGUIBackend>(); if (gui == null) { gui = new ImGui((IImuiRenderer)(object)component, (IImuiInput)(object)component); } OverlayState = ((Component)this).gameObject.GetComponent<OverlayState>(); if ((Object)(object)OverlayState == (Object)null) { OverlayState = ((Component)this).gameObject.AddComponent<OverlayState>(); } ThemeController = ((Component)this).gameObject.GetComponent<ThemeController>(); if ((Object)(object)ThemeController == (Object)null) { ThemeController = ((Component)this).gameObject.AddComponent<ThemeController>(); } ThemeController.SetTheme(gui); void OnSceneChange(Scene scene, LoadSceneMode loadSceneMode) { if ((bool)ConfigManager.AutoCloseOverlay) { IsOpen = false; } } } private void Update() { ThemeController.DetectChanges(gui); gui.BeginFrame(); if (ConfigManager.OverlayKey.Value.IsPressed(gui)) { IsOpen = !IsOpen; } InputUtility.HandleInput(gui); HandleAPIInput(); OverlayState.Draw(gui); if (IsOpen) { DrawRootMenuBar(); } ChangeLogWindow.Draw(gui, IsOpen); ConfigWindow.Draw(gui, IsOpen); if ((bool)ConfigManager.EnableDemoWindow) { DemoWindow.Draw(gui, ref isDemoOpen); } ModListWindow.Draw(gui, IsOpen); DrawAPIWindows(); if (InputUtility.GetKeyDown((KeyCode)13)) { gui.ResetActiveControl(); } gui.EndFrame(); gui.Render(); } private void DrawRootMenuBar() { ImMenuBar.BeginMenuBar(gui); if (ImMenu.BeginMenu(gui, "General".AsSpan())) { ImMenu.Menu(gui, "Open mod list".AsSpan(), ref ModListWindow.isOpen); ImMenu.Menu(gui, "Open config menu".AsSpan(), ref ConfigWindow.isOpen); if ((bool)ConfigManager.EnableDemoWindow) { ImMenu.Menu(gui, "Open demo menu".AsSpan(), ref isDemoOpen); } ImSeparator.Separator(gui); ImMenu.Menu(gui, "Open changelog".AsSpan(), ref ChangeLogWindow.isOpen); ImSeparator.Separator(gui); if (ImMenu.Menu(gui, "Close menu".AsSpan())) { IsOpen = false; } ImMenu.EndMenu(gui); } if (ImMenu.BeginMenu(gui, "Windows".AsSpan())) { if (ImMenu.Menu(gui, "Close all windows".AsSpan())) { ConfigWindow.isOpen = false; ModListWindow.isOpen = false; CloseAPIWindows(); } ImMenu.EndMenu(gui); } ImMenuBar.EndMenuBar(gui); } private void DrawAPIWindows() { foreach (WKLibAPI internalAPI in WKLibAPI.internalAPIs) { if (internalAPI == null) { continue; } foreach (WKLibWindow window in internalAPI.Windows) { window?.Draw(gui, IsOpen); } } } private void HandleAPIInput() { foreach (WKLibAPI internalAPI in WKLibAPI.internalAPIs) { if (internalAPI == null) { continue; } foreach (WKLibWindow window in internalAPI.Windows) { window?.HandleInput(gui); } } } private void CloseAPIWindows() { foreach (WKLibAPI internalAPI in WKLibAPI.internalAPIs) { if (internalAPI == null) { continue; } foreach (WKLibWindow window in internalAPI.Windows) { if (window != null) { window.isOpen = false; } } } } } internal class ThemeController : MonoBehaviour { public ImTheme BaseTheme = SetBaseTheme(ImThemeBuiltin.Dark()); private Vector2 lastScreenSize = new Vector2(0f, 0f); public static ImTheme SetBaseTheme(ImTheme theme) { //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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00cc: 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) theme.Background = new Color(0f, 0f, 0f, 1f); theme.Foreground = new Color(1f, 1f, 1f, 1f); theme.Accent = ConfigManager.ThemeSettings.Value.AccentColor; theme.Control = new Color(0.15f, 0.15f, 0.15f, 1f); theme.Contrast = (ConfigManager.ThemeSettings.Value.HighContrast ? 1f : 0f); theme.BorderContrast = 1f; theme.TextSize = 16f; theme.BorderRadius = 1f; theme.ReadOnlyColorMultiplier = 0.25f; return theme; } public void DetectChanges(ImGui gui) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if ((float)Screen.width != lastScreenSize.x || (float)Screen.height != lastScreenSize.y) { lastScreenSize = new Vector2((float)Screen.width, (float)Screen.height); } } public void DrawAppearanceEditor(ImGui gui) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (ImCheckbox.Checkbox(gui, ref ConfigManager.ThemeSettings.RefValue.HighContrast, "High contrast".AsSpan(), default(ImSize))) { BaseTheme.Contrast = (ConfigManager.ThemeSettings.Value.HighContrast ? 1f : 0f); SetTheme(gui); CoreSettings.Instance.DefaultConfigFile.SaveAsync(); } if (ImColorEdit.ColorEdit(gui, ref ConfigManager.ThemeSettings.RefValue.AccentColor, default(ImSize))) { BaseTheme.Accent = ConfigManager.ThemeSettings.Value.AccentColor; SetTheme(gui); CoreSettings.Instance.DefaultConfigFile.SaveAsync(); } } public static bool DrawThemeEditor(ImGui gui, ref ImTheme theme) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_052a: 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_0584: Unknown result type (might be due to invalid IL or missing references) bool flag = false; ImSeparator.Separator(gui, "Colors".AsSpan()); using (new UIUtility.LabeledScope(gui, "Foreground".AsSpan())) { flag |= ImColorEdit.ColorEdit(gui, ref theme.Foreground, default(ImSize)); } using (new UIUtility.LabeledScope(gui, "Background".AsSpan())) { flag |= ImColorEdit.ColorEdit(gui, ref theme.Background, default(ImSize)); } using (new UIUtility.LabeledScope(gui, "Accent".AsSpan())) { flag |= ImColorEdit.ColorEdit(gui, ref theme.Accent, default(ImSize)); } using (new UIUtility.LabeledScope(gui, "Control".AsSpan())) { flag |= ImColorEdit.ColorEdit(gui, ref theme.Control, default(ImSize)); } using (new UIUtility.LabeledScope(gui, "Contrast".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.Contrast, default(ImSize), default(ReadOnlySpan<char>), 0.1f, -1f, 1f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "BorderContrast".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.BorderContrast, default(ImSize), default(ReadOnlySpan<char>), 0.1f, -1f, 2f, (ImNumericEditFlag)2); } ImSeparator.Separator(gui, "Values".AsSpan()); using (new UIUtility.LabeledScope(gui, "TextSize".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.TextSize, default(ImSize), default(ReadOnlySpan<char>), 0.1f, 4f, 128f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "Spacing".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.Spacing, default(ImSize), default(ReadOnlySpan<char>), 0.1f, 0f, 32f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "InnerSpacing".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.InnerSpacing, default(ImSize), default(ReadOnlySpan<char>), 0.1f, 0f, 32f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "Indent".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.Indent, default(ImSize), default(ReadOnlySpan<char>), 0.1f, 0f, 128f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "ExtraRowHeight".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.ExtraRowHeight, default(ImSize), default(ReadOnlySpan<char>), 0.1f, 0f, 128f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "ScrollBarSize".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.ScrollBarSize, default(ImSize), default(ReadOnlySpan<char>), 0.1f, 2f, 128f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "WindowBorderRadius".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.WindowBorderRadius, default(ImSize), default(ReadOnlySpan<char>), 0.1f, 0f, 32f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "WindowBorderThickness".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.WindowBorderThickness, default(ImSize), default(ReadOnlySpan<char>), 0.5f, 0f, 8f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "BorderRadius".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.BorderRadius, default(ImSize), default(ReadOnlySpan<char>), 0.1f, 0f, 16f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "BorderThickness".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.BorderThickness, default(ImSize), default(ReadOnlySpan<char>), 0.5f, 0f, 8f, (ImNumericEditFlag)2); } using (new UIUtility.LabeledScope(gui, "ReadOnlyColorMultiplier".AsSpan())) { flag |= ImNumericEdit.NumericEdit(gui, ref theme.ReadOnlyColorMultiplier, default(ImSize), default(ReadOnlySpan<char>), 0.1f, 0f, 8f, (ImNumericEditFlag)2); } return flag; } public void SetTheme(ImGui gui) { gui.SetTheme(ref BaseTheme); } } } namespace WKLib.Core.UI.Windows { internal class ChangeLogWindow { public static bool isOpen; public static void Draw(ImGui gui, bool isRootPanelOpen) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) if (isRootPanelOpen && ImWindow.BeginWindow(gui, "WKLib changelog", ref isOpen, new ImSize(500f, 400f), (ImWindowFlag)0)) { ImSeparator.Separator(gui, "Versions".AsSpan()); if (ImTree.BeginTreeNode(gui, "Version 0.2.3".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { ImText.Text(gui, "+ Change config system default saving folder location, dont use WKLib as the default".AsSpan(), false, (ImTextOverflow)0); ImText.Text(gui, "+ Fix configs not saving as jsons".AsSpan(), false, (ImTextOverflow)0); ImTree.EndTreeNode(gui); } if (ImTree.BeginTreeNode(gui, "Version 0.2.2".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { ImText.Text(gui, "+ Fix plugin object being deleted".AsSpan(), false, (ImTextOverflow)0); ImText.Text(gui, "+ Fix error on scene loaded".AsSpan(), false, (ImTextOverflow)0); ImTree.EndTreeNode(gui); } if (ImTree.BeginTreeNode(gui, "Version 0.2.1".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { ImText.Text(gui, "+ Change config system saving and loading".AsSpan(), false, (ImTextOverflow)0); ImTree.EndTreeNode(gui); } if (ImTree.BeginTreeNode(gui, "Version 0.2.0".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { ImText.Text(gui, "+ Added ChangeLog window".AsSpan(), false, (ImTextOverflow)0); ImText.Text(gui, "+ Updated AssetService".AsSpan(), false, (ImTextOverflow)0); ImText.Text(gui, "+ Added Overlay button on main menu and pause menu".AsSpan(), false, (ImTextOverflow)0); ImTree.EndTreeNode(gui); } if (ImTree.BeginTreeNode(gui, "Version 0.1.0".AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { ImText.Text(gui, "+ Reworked UI and Config API".AsSpan(), false, (ImTextOverflow)0); ImTree.EndTreeNode(gui); } ImWindow.EndWindow(gui); } } } internal static class ConfigWindow { public static bool isOpen = true; public static void Draw(ImGui gui, bool isRootPanelOpen) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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) if (!isRootPanelOpen || !ImWindow.BeginWindow(gui, "WKLib config", ref isOpen, new ImSize(300f, 400f), (ImWindowFlag)0)) { return; } ImSeparator.Separator(gui, "General".AsSpan()); if (gui.SimpleKeybind("Overlay key", ref ConfigManager.OverlayKey.RefValue)) { CoreSettings.Instance.DefaultConfigFile.SaveAsync(); } if (Object.op_Implicit((Object)(object)CommandConsole.instance)) { bool flag = !CommandConsole.hasCheated && CommandConsole.cheatsEnabled; if (ImCheckbox.Checkbox(gui, ref CommandConsole.cheatsEnabled, "Enabled cheats".AsSpan(), default(ImSize)) || flag) { if (CommandConsole.cheatsEnabled) { CommandConsole.instance.EnableCheatsCommand(new string[1] { "true" }); } else { CommandConsole.instance.EnableCheatsCommand(new string[1] { "false" }); } } } ImSeparator.Separator(gui, "Appearance".AsSpan()); MonoSingleton<RootPanel>.Instance.ThemeController.DrawAppearanceEditor(gui); ImSeparator.Separator(gui, "Debug".AsSpan()); ImCheckbox.Checkbox(gui, ref ConfigManager.AdvancedSettings.RefValue, "Advanced settings".AsSpan(), default(ImSize)); if ((bool)ConfigManager.AdvancedSettings) { if (ImCheckbox.Checkbox(gui, ref ConfigManager.AutoCloseOverlay.RefValue, "Automatically close overlay".AsSpan(), default(ImSize))) { CoreSettings.Instance.DefaultConfigFile.SaveAsync(); } if (ImCheckbox.Checkbox(gui, ref ConfigManager.EnableDemoWindow.RefValue, "Enable demo window".AsSpan(), default(ImSize))) { CoreSettings.Instance.DefaultConfigFile.SaveAsync(); } } ImWindow.EndWindow(gui); } } internal static class ModListWindow { public static bool isOpen = true; public static void Draw(ImGui gui, bool open) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (!open || !ImWindow.BeginWindow(gui, "Mod list", ref isOpen, new ImSize(250f, 500f), (ImWindowFlag)0)) { return; } ImLayoutUtility.BeginVertical(gui, 0f, 0f); foreach (WKLibAPI internalAPI in WKLibAPI.internalAPIs) { if (internalAPI != null && internalAPI.ModTab != null && ImTree.BeginTreeNode(gui, internalAPI.ModTab.DisplayName.AsSpan(), default(ImSize), (ImTreeNodeFlags)0)) { internalAPI.ModTab.DrawSubMenu(gui); ImTree.EndTreeNode(gui); } } ImLayoutUtility.EndVertical(gui); ImWindow.EndWindow(gui); } public static void HandleInput(ImGui gui, bool open) { } } internal static class QuickPopupWindow { public static void Draw(ImGui gui, string text) { //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (!(text.Trim() == string.Empty)) { Vector2 val = ImText.MeasureTextSize(gui, text.AsSpan()); ImWindow.BeginWindow(gui, "Popup", new ImSize(val.x * 1.5f, ImLayoutUtility.GetRowHeight(gui) * 5f), (ImWindowFlag)0); ImText.Text(gui, text.AsSpan(), false, (ImTextOverflow)0); ImWindow.EndWindow(gui); } } } } namespace WKLib.Core.Patches { [PatchOnEntry] [HarmonyPatch] internal static class CL_GameManagerPatch { [HarmonyPatch(typeof(CL_GameManager), "UnPause")] [HarmonyPostfix] private static void CL_GameManager_UnPause(CL_GameManager __instance) { if (!((Object)(object)MonoSingleton<RootPanel>.Instance == (Object)null) && (bool)ConfigManager.AutoCloseOverlay && MonoSingleton<RootPanel>.Instance.IsOpen && !__instance.isPaused) { MonoSingleton<RootPanel>.Instance.IsOpen = false; } } } [PatchOnEntry] [HarmonyPatch] internal static class InputManagerPatch { [HarmonyPatch(typeof(InputManager), "Start")] [HarmonyPostfix] private static void InputManager_Start(InputManager __instance) { if (!((Object)(object)MonoSingleton<RootPanel>.Instance != (Object)null)) { ImuiPanel val = ImuiBepInExAPI.CreateImuiPanel(); ((Component)val.Backend).gameObject.SetActive(false); RootPanel rootPanel = ((Component)val.Backend).gameObject.AddComponent<RootPanel>(); rootPanel.ImuiPanel = val; ((Component)val.Backend).gameObject.SetActive(true); } } } } namespace WKLib.Core.Config { internal static class ConfigManager { public static ConfigValue<KeyBind> OverlayKey = new ConfigValue<KeyBind>("OverlayKey", new KeyBind((KeyCode)287)); public static ConfigValue<bool> AdvancedSettings = new ConfigValue<bool>("AdvancedSettings", currentValue: false); public static ConfigValue<bool> AutoCloseOverlay = new ConfigValue<bool>("AutoCloseOverlay", currentValue: true); public static ConfigValue<bool> EnableDemoWindow = new ConfigValue<bool>("EnableDemoWindow", currentValue: false); public static ConfigValue<ThemeConfig> ThemeSettings = new ConfigValue<ThemeConfig>("ThemeSettings", new ThemeConfig()); } internal class CoreSettings { private static CoreSettings instance; public static CoreSettings Instance { get { if (instance == null) { instance = new CoreSettings(); } return instance; } } public string BasePath { get; } internal ConfigFile DefaultConfigFile { get; private set; } public JsonSerializerSettings JsonSerializerSettings { get; } = new JsonSerializerSettings(); private CoreSettings() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown JsonSerializerSettings.Converters.Add((JsonConverter)(object)new ColorJsonConverter()); BasePath = Paths.ConfigPath; if (!Directory.Exists(BasePath)) { Directory.CreateDirectory(BasePath); } DefaultConfigFile = new ConfigFile(Path.Combine(BasePath, "WKLib", "DefaultConfig.json")); } } internal class ThemeConfig : IEquatable<ThemeConfig>, ICloneable { public bool HighContrast = false; public Color AccentColor = new Color(0.05f, 0.45f, 0.75f, 1f); public ThemeConfig() { }//IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) public ThemeConfig(bool highContrast, Color accentColor) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) HighContrast = highContrast; AccentColor = accentColor; } public object Clone() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new ThemeConfig(HighContrast, AccentColor); } public override int GetHashCode() { return HighContrast.GetHashCode() + ((object)(Color)(ref AccentColor)).GetHashCode(); } public bool Equals(ThemeConfig other) { //IL_001c: 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) if (other == null) { return false; } return HighContrast == other.HighContrast && AccentColor == other.AccentColor; } public override bool Equals(object obj) { return Equals(obj as ThemeConfig); } } } namespace WKLib.Core.Config.Converters { internal sealed class ColorJsonConverter : JsonConverter<Color> { public override void WriteJson(JsonWriter writer, Color value, JsonSerializer serializer) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0030: Unknown result type (might be due to invalid IL or missing references) writer.WriteStartArray(); writer.WriteValue(value.r); writer.WriteValue(value.g); writer.WriteValue(value.b); writer.WriteValue(value.a); writer.WriteEndArray(); } public override Color ReadJson(JsonReader reader, Type objectType, Color existingValue, bool hasExistingValue, JsonSerializer serializer) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) JArray val = JArray.Load(reader); float num = ((((JContainer)val).Count > 0) ? val[0].ToObject<float>() : 0f); float num2 = ((((JContainer)val).Count > 1) ? val[1].ToObject<float>() : 0f); float num3 = ((((JContainer)val).Count > 2) ? val[2].ToObject<float>() : 0f); float num4 = ((((JContainer)val).Count > 3) ? val[3].ToObject<float>() : 1f); return new Color(num, num2, num3, num4); } } } namespace WKLib.Core.Classes { [DefaultExecutionOrder(-200)] internal abstract class MonoSingleton : MonoBehaviour { } internal abstract class MonoSingleton<T> : MonoSingleton where T : MonoSingleton<T> { private static T instance; public static T Instance { get { return instance; } set { instance = value; } } public virtual void Awake() { if (Object.op_Implicit((Object)(object)Instance) && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)this); } else { Instance = (T)this; } } public virtual void OnEnable() { Instance = (T)this; } } } namespace WKLib.Core.Attributes { [AttributeUsage(AttributeTargets.Class, Inherited = false)] internal sealed class PatchOnEntryAttribute : Attribute { } } namespace WKLib.API { public class WKLibAPI { internal static List<WKLibAPI> internalAPIs = new List<WKLibAPI>(); public string DisplayName = string.Empty; public string GUID = string.Empty; public List<WKLibWindow> Windows = new List<WKLibWindow>(); public ModTab ModTab = null; public ConfigFolder ConfigFolder = null; public ConfigFile DefaultConfigFile = null; public AssetService AssetService = null; private WKLibAPI(string displayName, string guid, string defaultConfigFileName) { DisplayName = displayName; GUID = guid; ConfigFolder = new ConfigFolder(displayName); DefaultConfigFile = ConfigFolder.GetOrCreateConfigFile(defaultConfigFileName); AssetService = new AssetService(this); } public static WKLibAPI Create(string displayName, string guid) { return Create_Internal(displayName, guid); } public static WKLibAPI Create(string displayName, string guid, string defaultConfigFileName) { return Create_Internal(displayName, guid, defaultConfigFileName); } private static WKLibAPI Create_Internal(string displayName, string guid, string defaultConfigFileName = "DefaultConfig") { foreach (WKLibAPI internalAPI in internalAPIs) { if (string.Equals(guid, internalAPI.GUID)) { throw new Exception(displayName + " collides with " + internalAPI.DisplayName + ", they both have the same guid, " + guid); } } WKLibAPI wKLibAPI = new WKLibAPI(displayName, guid, defaultConfigFileName); internalAPIs.Add(wKLibAPI); internalAPIs.Sort((WKLibAPI a, WKLibAPI b) => string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase)); return wKLibAPI; } public void AddWindow(WKLibWindow window) { if (!Windows.Contains(window)) { Windows.Add(window); } } public void AddToModList(ModTab modTab) { if (ModTab != null) { throw new Exception("Mod tab already exists, cant add new one"); } ModTab = modTab; } public void Destroy() { if (internalAPIs.Contains(this)) { internalAPIs.Remove(this); } } } } namespace WKLib.API.UI { [Serializable] public class KeyBind : IEquatable<KeyBind>, ICloneable { [JsonIgnore] private bool _isHeld; [JsonProperty] [JsonConverter(typeof(StringEnumConverter))] public KeyCode KeyCode { get; set; } public KeyBind() { } public KeyBind(KeyCode KeyCode) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) this.KeyCode = KeyCode; } public unsafe bool SetToPressedKey(ImGui gui) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_001f: Invalid comparison between Unknown and I4 //IL_002a: 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_0032: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < gui.Input.KeyboardEventsCount; i++) { ImKeyboardEvent keyboardEvent = Unsafe.Read<ImKeyboardEvent>((void*)gui.Input.GetKeyboardEvent(i)); if ((int)keyboardEvent.Type == 1) { if ((int)keyboardEvent.Key == 27) { KeyCode = (KeyCode)0; return true; } KeyCode = keyboardEvent.Key; return true; } } return false; } public unsafe bool IsPressed(ImGui gui) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0051: Invalid comparison between Unknown and I4 //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 if (!IsSet()) { return false; } bool result = false; for (int i = 0; i < gui.Input.KeyboardEventsCount; i++) { ImKeyboardEvent keyboardEvent = Unsafe.Read<ImKeyboardEvent>((void*)gui.Input.GetKeyboardEvent(i)); if (keyboardEvent.Key != KeyCode) { continue; } if ((int)keyboardEvent.Type == 1) { if (!_isHeld) { result = true; _isHeld = true; } } else if ((int)keyboardEvent.Type == 2) { _isHeld = false; } } return result; } public unsafe bool IsDown(ImGui gui) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) //IL_0030: Invalid comparison between Unknown and I4 //IL_003d: 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_0044: Unknown result type (might be due to invalid IL or missing references) if (!IsSet()) { return false; } for (int i = 0; i < gui.Input.KeyboardEventsCount; i++) { ImKeyboardEvent keyboardEvent = Unsafe.Read<ImKeyboardEvent>((void*)gui.Input.GetKeyboardEvent(i)); if ((int)keyboardEvent.Type == 1 && keyboardEvent.Key == KeyCode) { return true; } } return false; } public bool IsSet() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 return (int)KeyCode > 0; } public object Clone() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return new KeyBind(KeyCode); } public override int GetHashCode() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) KeyCode keyCode = KeyCode; return ((object)(KeyCode)(ref keyCode)).GetHashCode(); } public bool Equals(KeyBind other) { //IL_000e: 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) if (other == null) { return false; } return KeyCode == other.KeyCode; } public override bool Equals(object obj) { return Equals(obj as KeyBind); } } public abstract class ModTab { public abstract string DisplayName { get; } public abstract void DrawSubMenu(ImGui gui); } public class PopupSettings { public string PopupText = ""; public float PopupTime = 2.5f; public float TimeTillClose = -1f; public PopupSettings() { } public PopupSettings(string text, float seconds = 2.5f) { PopupText = text; PopupTime = seconds; TimeTillClose = Time.realtimeSinceStartup + PopupTime; } } public static class UIUtility { public struct LabeledScope : IDisposable { private ImGui gui; public LabeledScope(ImGui gui, ReadOnlySpan<char> label, float firstRectSize = 0.4f) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) this.gui = gui; gui.PushId(label); ImLayoutUtility.AddSpacingIfLayoutFrameNotEmpty(gui); ImLayoutUtility.BeginHorizontal(gui, 0f, 0f); ImRect val = ImLayoutUtility.AddLayoutRect(gui, ImLayoutUtility.GetLayoutWidth(gui) * firstRectSize, ImLayoutUtility.GetRowHeight(gui)); ImText.Text(gui, label, val, false, (ImTextOverflow)1); ImLayoutUtility.BeginVertical(gui, 0f, 0f); } public void Dispose() { ImLayoutUtility.EndVertical(gui); ImLayoutUtility.EndHorizontal(gui); gui.PopId(); } } public static bool SimpleKeybind(this ImGui gui, string label, ref KeyBind keyBind) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_00b3: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) bool result = false; uint controlId = gui.GetControlId(label.AsSpan()); gui.PushId(controlId); ImLayoutUtility.AddSpacingIfLayoutFrameNotEmpty(gui); ImLayoutUtility.BeginHorizontal(gui, 0f, 0f); ImRect val = ImLayoutUtility.AddLayoutRect(gui, ImLayoutUtility.GetLayoutWidth(gui) * 0.8f, ImLayoutUtility.GetRowHeight(gui)); ImText.Text(gui, label.AsSpan(), val, false, (ImTextOverflow)1); ImLayoutUtility.BeginVertical(gui, 0f, 0f); if (gui.GetActiveControl() == controlId) { ImButton.Button(gui, "...".AsSpan(), default(ImSize), (ImButtonFlag)0); if (keyBind.SetToPressedKey(gui)) { result = true; gui.ResetActiveControl(); } } else { KeyCode keyCode = keyBind.KeyCode; if (ImButton.Button(gui, ((object)(KeyCode)(ref keyCode)).ToString().AsSpan(), default(ImSize), (ImButtonFlag)0)) { gui.SetActiveControl(controlId, (ImControlFlag)0); } } ImLayoutUtility.EndVertical(gui); ImLayoutUtility.EndHorizontal(gui); gui.PopId(); return result; } public static void ShowPopupForTime(string text, float seconds = 2.5f) { OverlayState.Popups.Add(new PopupSettings(text, seconds)); } } public abstract class WKLibWindow { public bool isOpen = false; public abstract void Draw(ImGui gui, bool isRootPanelOpen); public abstract void HandleInput(ImGui gui); } } namespace WKLib.API.Input { public static class InputUtility { private static Dictionary<KeyCode, bool> keysDictionary = new Dictionary<KeyCode, bool>(); public unsafe static void HandleInput(ImGui gui) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_009a: 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: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (keysDictionary.Keys.Count <= 0) { foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { keysDictionary[value] = false; } } for (int i = 0; i < gui.Input.KeyboardEventsCount; i++) { ImKeyboardEvent keyboardEvent = Unsafe.Read<ImKeyboardEvent>((void*)gui.Input.GetKeyboardEvent(i)); KeyCode key2 = keyboardEvent.Key; bool flag = (int)keyboardEvent.Type == 1; bool flag2 = (int)keyboardEvent.Type == 2; if (flag) { keysDictionary[key2] = true; } else if (flag2) { keysDictionary[key2] = false; } } } public static bool GetKeyDown(KeyCode key) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (keysDictionary.TryGetValue(key, out var value)) { return value; } throw new Exception("No key (" + ((object)(KeyCode)(ref key)).ToString() + ") could be found in InputUtility.keysDictionary."); } } } namespace WKLib.API.Config { public class ConfigFile { private Dictionary<string, JToken> parsedCache = new Dictionary<string, JToken>(); private List<ConfigValueBase> registeredValues = new List<ConfigValueBase>(); private readonly SemaphoreSlim saveLock = new SemaphoreSlim(1, 1); public string FilePath { get; private set; } public string FullFileName { get; private set; } public string FileName { get; private set; } public ConfigFile(string filePath) { Initialize(filePath); } public ConfigFile(ConfigFolder configFolder, string fileName) { if (configFolder == null) { throw new ArgumentNullException("configFolder"); } Initialize(Path.Combine(configFolder.BasePath, fileName)); } public ConfigFile(WKLibAPI API, string fileName) { if (API == null) { throw new ArgumentNullException("API"); } if (API.ConfigFolder == null) { throw new ArgumentNullException("ConfigFolder"); } Initialize(Path.Combine(API.ConfigFolder.BasePath, fileName)); } private void Initialize(string filePath) { if (string.IsNullOrWhiteSpace(filePath)) { throw new ArgumentNullException("filePath"); } FilePath = (Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase) ? filePath : (filePath + ".json")); FullFileName = Path.GetFileName(FilePath); FileName = Path.GetFileNameWithoutExtension(FilePath); try { LoadFromDisk(); } catch (Exception ex) { Debug.LogError((object)("Failed to load config file (" + filePath + "): " + ex.Message)); } } public bool TryGetParsedToken(string key, out JToken token) { token = null; if (string.IsNullOrEmpty(key)) { return false; } if (parsedCache.TryGetValue(key, out token)) { return true; } return false; } public bool TryGetParsedValueObject(string key, out object value) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 value = null; if (TryGetParsedToken(key, out var token)) { if (token == null || (int)token.Type == 10) { return false; } try { JsonSerializerSettings jsonSerializerSettings = CoreSettings.Instance.JsonSerializerSettings; string text = token.ToString((Formatting)0, Array.Empty<JsonConverter>()); value = JsonConvert.DeserializeObject(text, jsonSerializerSettings); } catch { return false; } return true; } return false; } public void RegisterConfigValue(ConfigValueBase configValue) { if (string.IsNullOrEmpty(configValue.Key)) { return; } lock (registeredValues) { ConfigValueBase configValueBase = registeredValues.Find((ConfigValueBase cValue) => string.Equals(cValue.Key, configValue.Key)); if (configValueBase != null) { Debug.LogError((object)("Existing config key, " + configValue.Key + " is already registered.")); } else { registeredValues.Add(configValue); } } } public void LoadFromDisk() { JObject val = null; if (File.Exists(FilePath)) { try { string text = File.ReadAllText(FilePath); if (!string.IsNullOrWhiteSpace(text)) { val = JObject.Parse(text); } } catch { val = null; } } parsedCache.Clear(); if (val != null) { foreach (JProperty item in val.Properties()) { parsedCache[item.Name] = item.Value.DeepClone(); } } lock (registeredValues) { foreach (ConfigValueBase registeredValue in registeredValues) { if (parsedCache.TryGetValue(registeredValue.Key, out var value)) { registeredValue.LoadFromJToken(value); } } } } public async Task SaveAsync() { await saveLock.WaitAsync().ConfigureAwait(continueOnCapturedContext: false); try { JsonSerializerSettings settings = CoreSettings.Instance.JsonSerializerSettings; JsonSerializer serializer = JsonSerializer.Create(settings); JObject root = new JObject(); lock (registeredValues) { foreach (ConfigValueBase v in registeredValues) { JToken valueToken = (JToken)((v.GetBoxedValue() == null) ? ((object)JValue.CreateNull()) : ((object)JToken.FromObject(v.GetBoxedValue(), serializer))); root[v.Key] = valueToken; } } string text = (((JToken)root).HasValues ? ((JToken)root).ToString((Formatting)1, Array.Empty<JsonConverter>()) : "{}"); string dir = Path.GetDirectoryName(FilePath); if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir)) { Directory.CreateDirectory(dir); } await File.WriteAllTextAsync(FilePath, text).ConfigureAwait(continueOnCapturedContext: false); parsedCache.Clear(); if (!((JToken)root).HasValues) { return; } foreach (JProperty p in root.Properties()) { parsedCache[p.Name] = p.Value.DeepClone(); } } catch (Exception ex) { Exception e = ex; Debug.LogError((object)("Error while saving config, " + e.Message)); } finally { saveLock.Release(); } } public void SaveSync() { SaveAsync().GetAwaiter().GetResult(); } } public class ConfigFolder { [CompilerGenerated] private sealed class <EnumerateFiles>d__23 : IEnumerable<ConfigFile>, IEnumerable, IEnumerator<ConfigFile>, IEnumerator, IDisposable { private int <>1__state; private ConfigFile <>2__current; private int <>l__initialThreadId; public ConfigFolder <>4__this; private List<ConfigFile> <>s__1; private bool <>s__2; private List<ConfigFile>.Enumerator <>s__3; private ConfigFile <f>5__4; private List<ConfigFolder> <>s__5; private bool <>s__6; private List<ConfigFolder>.Enumerator <>s__7; private ConfigFolder <sf>5__8; private IEnumerator<ConfigFile> <>s__9; private ConfigFile <f>5__10; ConfigFile IEnumerator<ConfigFile>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EnumerateFiles>d__23(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; switch (num) { case -4: case -3: case 1: try { if (num == -4 || num == 1) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } break; case -7: case -6: case -5: case 2: try { if ((uint)(num - -7) > 1u && num != 2) { break; } try { if (num == -7 || num == 2) { try { } finally { <>m__Finally5(); } } } finally { <>m__Finally4(); } } finally { <>m__Finally3(); } break; } <>s__1 = null; <>s__3 = default(List<ConfigFile>.Enumerator); <f>5__4 = null; <>s__5 = null; <>s__7 = default(List<ConfigFolder>.Enumerator); <sf>5__8 = null; <>s__9 = null; <f>5__10 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>s__1 = <>4__this.files; <>s__2 = false; <>1__state = -3; Monitor.Enter(<>s__1, ref <>s__2); <>s__3 = <>4__this.files.GetEnumerator(); <>1__state = -4; goto IL_00c3; case 1: <>1__state = -4; <f>5__4 = null; goto IL_00c3; case 2: { <>1__state = -7; <f>5__10 = null; goto IL_01b0; } IL_00c3: if (<>s__3.MoveNext()) { <f>5__4 = <>s__3.Current; <>2__current = <f>5__4; <>1__state = 1; return true; } <>m__Finally2(); <>s__3 = default(List<ConfigFile>.Enumerator); <>m__Finally1(); <>s__1 = null; <>s__5 = <>4__this.subFolders; <>s__6 = false; <>1__state = -5; Monitor.Enter(<>s__5, ref <>s__6); <>s__7 = <>4__this.subFolders.GetEnumerator(); <>1__state = -6; goto IL_01d2; IL_01d2: if (<>s__7.MoveNext()) { <sf>5__8 = <>s__7.Current; <>s__9 = <sf>5__8.EnumerateFiles().GetEnumerator(); <>1__state = -7; goto IL_01b0; } <>m__Finally4(); <>s__7 = default(List<ConfigFolder>.Enumerator); <>m__Finally3(); <>s__5 = null; return false; IL_01b0: if (<>s__9.MoveNext()) { <f>5__10 = <>s__9.Current; <>2__current = <f>5__10; <>1__state = 2; return true; } <>m__Finally5(); <>s__9 = null; <sf>5__8 = null; goto IL_01d2; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__2) { Monitor.Exit(<>s__1); } } private void <>m__Finally2() { <>1__state = -3; ((IDisposable)<>s__3).Dispose(); } private void <>m__Finally3() { <>1__state = -1; if (<>s__6) { Monitor.Exit(<>s__5); } } private void <>m__Finally4() { <>1__state = -5; ((IDisposable)<>s__7).Dispose(); } private void <>m__Finally5() { <>1__state = -6; if (<>s__9 != null) { <>s__9.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<ConfigFile> IEnumerable<ConfigFile>.GetEnumerator() { <EnumerateFiles>d__23 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new <EnumerateFiles>d__23(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<ConfigFile>)this).GetEnumerator(); } } private List<ConfigFolder> subFolders = new List<ConfigFolder>(); private List<ConfigFile> files = new List<ConfigFile>(); public string BasePath { get; private set; } public string FolderName { get; private set; } public ConfigFolder(string folderName) { if (string.IsNullOrWhiteSpace(folderName)) { throw new ArgumentNullException("folderName"); } FolderName = folderName; BasePath = Path.Combine(CoreSettings.Instance.BasePath, folderName); if (!Directory.Exists(BasePath