using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DarkMachine.UI; using HarmonyLib; using Microsoft.CodeAnalysis; using ModMenu.Behaviors; using MonoMod.RuntimeDetour; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using WKLib.API.Input; [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: AssemblyCompany("ModMenu")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+ff030c5e689114c639667709fe467c5434a13abb")] [assembly: AssemblyProduct("ModMenu")] [assembly: AssemblyTitle("ModMenu")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ModMenu { public static class Extensions { public static GameObject Search(this GameObject go, string search) { if (!Object.op_Implicit((Object)(object)go)) { return null; } if (string.IsNullOrEmpty(search)) { return null; } Queue queue = new Queue(search.Split('/', StringSplitOptions.RemoveEmptyEntries)); Transform val = go.transform; while (queue.Count > 0) { string text = queue.Dequeue(); bool flag = false; if (text.Equals("..") && Object.op_Implicit((Object)(object)val.parent)) { flag = true; val = val.parent; } else { for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (text.Equals(((Object)((Component)child).gameObject).name)) { val = child; flag = true; break; } } } if (!flag) { return null; } } return ((Component)val).gameObject; } public static GameObject Search(this Transform tr, string search) { if (!Object.op_Implicit((Object)(object)tr)) { return null; } return ((Component)tr).gameObject.Search(search); } } internal sealed class ModMenu { private static RectTransform _settingsMenuTransform; private static RectTransform _modMenuPanel; private static Dictionary _configs; public static void Initialize(Transform target) { GameObject obj = target.Search("SettingsParent/Settings Pane"); _settingsMenuTransform = ((obj != null) ? obj.GetComponent() : null); _configs = GetModConfigs(); _modMenuPanel = UI.CreateSettingsPanel(_settingsMenuTransform, "Mods"); CreateMenuTab(); CreateModMenus(); ((Component)_modMenuPanel).gameObject.SetActive(false); } private static void CreateMenuTab() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) UI_TabGroup val = ((IEnumerable)((Component)_settingsMenuTransform).GetComponentsInChildren()).FirstOrDefault((Func)((UI_TabGroup c) => ((Object)((Component)c).gameObject).name == "Tab Selection Hor")); if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)"No tab group found"); return; } RectTransform component = ((Component)val.AddTab(Templates.MainTabButton, "Mods", ((Component)_modMenuPanel).gameObject)).GetComponent(); component.sizeDelta = new Vector2(80f, component.sizeDelta.y); } private static void CreateModMenus() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) ScrollRect val = UI.CreateScrollRect(_modMenuPanel); ((Component)val.viewport).GetComponent().softness = new Vector2Int(10, 0); Transform transform = ((Component)val).transform; RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null); val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(1f, 1f); val2.anchoredPosition = new Vector2(0f, -50f); val2.sizeDelta = new Vector2(-20f, 70f); UI_TabGroup tabGroup = UI.CreateTabGroup(val.content, ((Component)val.content).gameObject, vertical: false, supportGamepad: false, (Color?)new Color(0.3868f, 0.3868f, 0.3868f, 1f), (Color?)null, "TabMainLeft", "TabMainRight"); foreach (KeyValuePair config in _configs) { Selectable firstElement; GameObject val3 = CreateModMenu(config.Value, out firstElement); val3.SetActive(false); tabGroup.AddTab(Templates.TabButton, config.Key, val3, firstElement); } } private static GameObject CreateModMenu(ConfigEntryBase[] entries, out Selectable firstElement) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_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_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_035a: 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_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0cd1: Unknown result type (might be due to invalid IL or missing references) //IL_0cd6: 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_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: 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_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_074d: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_081f: Unknown result type (might be due to invalid IL or missing references) //IL_0843: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Unknown result type (might be due to invalid IL or missing references) //IL_08bf: Unknown result type (might be due to invalid IL or missing references) //IL_08cd: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_08eb: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) //IL_096c: Unknown result type (might be due to invalid IL or missing references) //IL_0978: Unknown result type (might be due to invalid IL or missing references) //IL_0984: Unknown result type (might be due to invalid IL or missing references) //IL_0992: Unknown result type (might be due to invalid IL or missing references) //IL_0998: Unknown result type (might be due to invalid IL or missing references) //IL_09b2: Unknown result type (might be due to invalid IL or missing references) //IL_09b7: Unknown result type (might be due to invalid IL or missing references) //IL_09bc: Unknown result type (might be due to invalid IL or missing references) //IL_09e1: Unknown result type (might be due to invalid IL or missing references) //IL_09e6: Unknown result type (might be due to invalid IL or missing references) //IL_0a44: Unknown result type (might be due to invalid IL or missing references) //IL_0a50: Unknown result type (might be due to invalid IL or missing references) //IL_0a5c: Unknown result type (might be due to invalid IL or missing references) //IL_0a6a: Unknown result type (might be due to invalid IL or missing references) //IL_0a70: Unknown result type (might be due to invalid IL or missing references) //IL_0a94: Unknown result type (might be due to invalid IL or missing references) //IL_0a99: Unknown result type (might be due to invalid IL or missing references) //IL_0a9e: Unknown result type (might be due to invalid IL or missing references) //IL_0ac3: Unknown result type (might be due to invalid IL or missing references) //IL_0ac8: Unknown result type (might be due to invalid IL or missing references) //IL_0b26: Unknown result type (might be due to invalid IL or missing references) //IL_0b32: Unknown result type (might be due to invalid IL or missing references) //IL_0b3e: Unknown result type (might be due to invalid IL or missing references) //IL_0b4c: Unknown result type (might be due to invalid IL or missing references) //IL_0b52: Unknown result type (might be due to invalid IL or missing references) //IL_0b76: Unknown result type (might be due to invalid IL or missing references) //IL_0b7b: Unknown result type (might be due to invalid IL or missing references) //IL_0b80: Unknown result type (might be due to invalid IL or missing references) //IL_0ba5: Unknown result type (might be due to invalid IL or missing references) //IL_0baa: Unknown result type (might be due to invalid IL or missing references) //IL_0c1a: Unknown result type (might be due to invalid IL or missing references) //IL_0c20: Unknown result type (might be due to invalid IL or missing references) //IL_0c5c: Unknown result type (might be due to invalid IL or missing references) //IL_0c61: Unknown result type (might be due to invalid IL or missing references) //IL_0c66: Unknown result type (might be due to invalid IL or missing references) ScrollRect val5 = UI.CreateScrollRect(_modMenuPanel); ((Component)val5.viewport).GetComponent().softness = new Vector2Int(10, 0); Transform transform = ((Component)val5).transform; RectTransform val6 = (RectTransform)(object)((transform is RectTransform) ? transform : null); val6.anchorMin = new Vector2(0f, 0f); val6.anchorMax = new Vector2(1f, 1f); val6.anchoredPosition = new Vector2(0f, -45f); val6.sizeDelta = new Vector2(-20f, -70f); HorizontalOrVerticalLayoutGroup component = ((Component)val5.content).GetComponent(); component.childControlHeight = true; component.childForceExpandHeight = true; component.spacing = 0f; ((LayoutGroup)component).childAlignment = (TextAnchor)0; firstElement = null; IEnumerable> enumerable = from entry in entries group entry by entry.Definition.Section; foreach (IGrouping item in enumerable) { RectTransform val7 = CreateEntriesColumn(val5.content); float num = 0f; Rect rect = val5.content.rect; float height = ((Rect)(ref rect)).height; float num2 = 5f; float num3 = num; rect = ((RectTransform)UI.CreateLabel(val7, item.Key).transform).rect; num = num3 + (((Rect)(ref rect)).height + num2); foreach (ConfigEntryBase entry2 in item) { string label = PrettifyName(entry2.Definition.Key); ConfigEntryBase val8 = entry2; ConfigEntryBase val9 = val8; if (!(val9 is ConfigEntry)) { if (!(val9 is ConfigEntry)) { if (!(val9 is ConfigEntry)) { if (!(val9 is ConfigEntry)) { if (!(val9 is ConfigEntry)) { if (val9 != null) { if (!entry2.SettingType.IsSubclassOf(typeof(Enum))) { if (!(val9 is ConfigEntry)) { if (!(val9 is ConfigEntry)) { if (!(val9 is ConfigEntry)) { if (!(val9 is ConfigEntry)) { if (!(val9 is ConfigEntry)) { if (val9 is ConfigEntry) { Rect val10 = (Rect)entry2.BoxedValue; UI.CreateQuadInputField(val7, label, ((Rect)(ref val10)).x.ToString(CultureInfo.InvariantCulture), ((Rect)(ref val10)).y.ToString(CultureInfo.InvariantCulture), ((Rect)(ref val10)).width.ToString(CultureInfo.InvariantCulture), ((Rect)(ref val10)).height.ToString(CultureInfo.InvariantCulture), delegate(string val1, string val2, string val3, string val4) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (float.TryParse(val1, out var result20) && float.TryParse(val2, out var result21) && float.TryParse(val3, out var result22) && float.TryParse(val4, out var result23)) { entry2.BoxedValue = (object)new Rect(result20, result21, result22, result23); } }, (ContentType)3, (CharacterValidation)3); float num4 = num; rect = ((RectTransform)Templates.InputField.transform).rect; num = num4 + (((Rect)(ref rect)).height + num2); } } else { Quaternion val11 = (Quaternion)entry2.BoxedValue; RectTransform parent = val7; string value2 = val11.x.ToString(CultureInfo.InvariantCulture); string value3 = val11.y.ToString(CultureInfo.InvariantCulture); string value4 = val11.z.ToString(CultureInfo.InvariantCulture); string value5 = val11.y.ToString(CultureInfo.InvariantCulture); Action onValueChanged = delegate(string val1, string val2, string val3, string val4) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (float.TryParse(val1, out var result16) && float.TryParse(val2, out var result17) && float.TryParse(val3, out var result18) && float.TryParse(val4, out var result19)) { entry2.BoxedValue = (object)new Quaternion(result16, result17, result18, result19); } }; Color? color = Color.red; Color? color2 = Color.green; Color? color3 = Color.blue; UI.CreateQuadInputField(parent, label, value2, value3, value4, value5, onValueChanged, (ContentType)3, (CharacterValidation)3, default(Vector2), color, color2, color3); float num5 = num; rect = ((RectTransform)Templates.InputField.transform).rect; num = num5 + (((Rect)(ref rect)).height + num2); } } else { Vector4 val12 = (Vector4)entry2.BoxedValue; RectTransform parent2 = val7; string value6 = val12.x.ToString(CultureInfo.InvariantCulture); string value7 = val12.y.ToString(CultureInfo.InvariantCulture); string value8 = val12.z.ToString(CultureInfo.InvariantCulture); string value9 = val12.y.ToString(CultureInfo.InvariantCulture); Action onValueChanged2 = delegate(string val1, string val2, string val3, string val4) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (float.TryParse(val1, out var result12) && float.TryParse(val2, out var result13) && float.TryParse(val3, out var result14) && float.TryParse(val4, out var result15)) { entry2.BoxedValue = (object)new Vector4(result12, result13, result14, result15); } }; Color? color3 = Color.red; Color? color2 = Color.green; Color? color = Color.blue; UI.CreateQuadInputField(parent2, label, value6, value7, value8, value9, onValueChanged2, (ContentType)3, (CharacterValidation)3, default(Vector2), color3, color2, color); float num6 = num; rect = ((RectTransform)Templates.InputField.transform).rect; num = num6 + (((Rect)(ref rect)).height + num2); } } else { Vector3 val13 = (Vector3)entry2.BoxedValue; RectTransform parent3 = val7; string value10 = val13.x.ToString(CultureInfo.InvariantCulture); string value11 = val13.y.ToString(CultureInfo.InvariantCulture); string value12 = val13.z.ToString(CultureInfo.InvariantCulture); Action onValueChanged3 = delegate(string val1, string val2, string val3) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (float.TryParse(val1, out var result9) && float.TryParse(val2, out var result10) && float.TryParse(val3, out var result11)) { entry2.BoxedValue = (object)new Vector3(result9, result10, result11); } }; Color? color = Color.red; Color? color2 = Color.green; Color? color3 = Color.blue; UI.CreateTrippleInputField(parent3, label, value10, value11, value12, onValueChanged3, (ContentType)3, (CharacterValidation)3, default(Vector2), color, color2, color3); float num7 = num; rect = ((RectTransform)Templates.InputField.transform).rect; num = num7 + (((Rect)(ref rect)).height + num2); } } else { Vector2 val14 = (Vector2)entry2.BoxedValue; RectTransform parent4 = val7; string value13 = val14.x.ToString(CultureInfo.InvariantCulture); string value14 = val14.y.ToString(CultureInfo.InvariantCulture); Action onValueChanged4 = delegate(string val1, string val2) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (float.TryParse(val1, out var result7) && float.TryParse(val2, out var result8)) { entry2.BoxedValue = (object)new Vector2(result7, result8); } }; Color? color2 = Color.red; Color? color = Color.green; UI.CreateDualInputField(parent4, label, value13, value14, onValueChanged4, (ContentType)3, (CharacterValidation)3, default(Vector2), color2, color); float num8 = num; rect = ((RectTransform)Templates.InputField.transform).rect; num = num8 + (((Rect)(ref rect)).height + num2); } } else { Color val15 = (Color)entry2.BoxedValue; RectTransform parent5 = val7; string value15 = val15.r.ToString(CultureInfo.InvariantCulture); string value16 = val15.g.ToString(CultureInfo.InvariantCulture); string value17 = val15.b.ToString(CultureInfo.InvariantCulture); string value18 = val15.a.ToString(CultureInfo.InvariantCulture); Action onValueChanged5 = delegate(string val1, string val2, string val3, string val4) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (float.TryParse(val1, out var result3) && float.TryParse(val2, out var result4) && float.TryParse(val3, out var result5) && float.TryParse(val4, out var result6)) { entry2.BoxedValue = (object)new Color(result3, result4, result5, result6); } }; Color? color3 = Color.red; Color? color = Color.green; Color? color2 = Color.blue; UI.CreateQuadInputField(parent5, label, value15, value16, value17, value18, onValueChanged5, (ContentType)3, (CharacterValidation)3, default(Vector2), color3, color, color2); float num9 = num; rect = ((RectTransform)Templates.InputField.transform).rect; num = num9 + (((Rect)(ref rect)).height + num2); } } else { Type enumType = entry2.SettingType; List values = Enum.GetNames(enumType).ToList(); UI.CreateDropdown(val7, label, values, values.IndexOf(entry2.BoxedValue.ToString()), delegate(int value) { object boxedValue = Enum.Parse(enumType, values[value]); entry2.BoxedValue = boxedValue; }); float num10 = num; rect = ((RectTransform)Templates.Dropdown.transform).rect; num = num10 + (((Rect)(ref rect)).height + num2); } } } else { UI.CreateKeyBindingInput(val7, label, (KeyCode)entry2.BoxedValue, delegate(KeyCode key) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) entry2.BoxedValue = key; }).Setup((Transform)(object)_settingsMenuTransform); float num11 = num; rect = ((RectTransform)((Component)Templates.KeyBindingInput).transform).rect; num = num11 + (((Rect)(ref rect)).height + num2); } } else if (entry2.Description.AcceptableValues is AcceptableValueList val16) { List valueList = val16.AcceptableValues.ToList(); UI.CreateDropdown(val7, label, valueList, valueList.IndexOf(entry2.BoxedValue.ToString()), delegate(int value) { entry2.BoxedValue = valueList[value]; }); float num12 = num; rect = ((RectTransform)Templates.Dropdown.transform).rect; num = num12 + (((Rect)(ref rect)).height + num2); } else { UI.CreateInputField(val7, label, entry2.BoxedValue.ToString(), delegate(string value) { entry2.BoxedValue = value; }, (ContentType)0, (CharacterValidation)0); float num13 = num; rect = ((RectTransform)Templates.InputField.transform).rect; num = num13 + (((Rect)(ref rect)).height + num2); } } else if (entry2.Description.AcceptableValues is AcceptableValueRange val17) { int minValue = val17.MinValue; int maxValue = val17.MaxValue; UI.CreateSlider(val7, label, (int)entry2.BoxedValue, delegate(float value) { entry2.BoxedValue = (int)value; }, minValue, maxValue, 1f, "0"); float num14 = num; rect = ((RectTransform)Templates.Slider.transform).rect; num = num14 + (((Rect)(ref rect)).height + num2); } else { UI.CreateInputField(val7, label, entry2.BoxedValue.ToString(), delegate(string value) { if (int.TryParse(value, out var result2)) { entry2.BoxedValue = result2; } }, (ContentType)2, (CharacterValidation)2); float num15 = num; rect = ((RectTransform)Templates.InputField.transform).rect; num = num15 + (((Rect)(ref rect)).height + num2); } } else if (entry2.Description.AcceptableValues is AcceptableValueRange val18) { float minValue2 = val18.MinValue; float maxValue2 = val18.MaxValue; UI.CreateSlider(val7, label, (float)entry2.BoxedValue, delegate(float value) { entry2.BoxedValue = value; }, minValue2, maxValue2, 0f); float num16 = num; rect = ((RectTransform)Templates.Slider.transform).rect; num = num16 + (((Rect)(ref rect)).height + num2); } else { UI.CreateInputField(val7, label, entry2.BoxedValue.ToString(), delegate(string value) { if (float.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out var result)) { entry2.BoxedValue = result; } }, (ContentType)3, (CharacterValidation)3); float num17 = num; rect = ((RectTransform)Templates.InputField.transform).rect; num = num17 + (((Rect)(ref rect)).height + num2); } } else { UI.CreateToggle(val7, label, (bool)entry2.BoxedValue, delegate(bool isOn) { entry2.BoxedValue = isOn; }); float num18 = num; rect = ((RectTransform)Templates.Toggle.transform).rect; num = num18 + (((Rect)(ref rect)).height + num2); } if (!Object.op_Implicit((Object)(object)firstElement)) { firstElement = ((Component)((Transform)val7).GetChild(((Transform)val7).childCount - 1)).GetComponentInChildren(true); } if (num >= height - 50f) { val7 = CreateEntriesColumn(val5.content); num = 0f; rect = val5.content.rect; height = ((Rect)(ref rect)).height; } } } return ((Component)val5).gameObject; } private static RectTransform CreateEntriesColumn(RectTransform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) RectTransform val = new GameObject("column").AddComponent(); ((Transform)val).SetParent((Transform)(object)parent, false); val.anchorMin = new Vector2(0f, 0f); val.anchorMax = new Vector2(0f, 1f); val.anchoredPosition = new Vector2(0f, 0f); val.sizeDelta = new Vector2(300f, 0f); VerticalLayoutGroup val2 = ((Component)val).gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val2).spacing = 5f; return val; } private static Dictionary GetModConfigs() { Dictionary dictionary = new Dictionary(); foreach (PluginInfo item in Chainloader.PluginInfos.Values.OrderBy((PluginInfo p) => p.Metadata.Name)) { List list = new List(); foreach (ConfigEntryBase item2 in ((IEnumerable>)item.Instance.Config).Select((KeyValuePair configEntry) => configEntry.Value)) { ConfigDescription description = item2.Description; object[] array = ((description != null) ? description.Tags : null); if (array == null || !array.Contains("Hidden")) { list.Add(item2); } } if (list.Count > 0) { dictionary.TryAdd(PrettifyName(item.Metadata.Name), list.ToArray()); } } return dictionary; } private static string PrettifyName(string input) { input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2"); input = Regex.Replace(input, "([A-Z])([A-Z][a-z])", "$1 $2"); input = Regex.Replace(input, "\\s+", " "); input = Regex.Replace(input, "([A-Z]\\.)\\s([A-Z]\\.)", "$1$2"); return input.Trim(); } } [BepInPlugin("ModMenu", "ModMenu", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal sealed class Plugin : BaseUnityPlugin { public static ManualLogSource Log { get; private set; } private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("ModMenu.patch"); val.PatchAll(); new Hook((MethodBase)AccessTools.Method(typeof(UI_SettingsMenu), "Start", (Type[])null, (Type[])null), (Delegate)new Action, UI_SettingsMenu>(UI_SettingsMenu_StartHook)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ModMenu is loaded!"); } private static void UI_SettingsMenu_StartHook(Action orig, UI_SettingsMenu self) { Templates.LoadTemplates(((Component)self).transform); if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent())) { ((Component)self).gameObject.AddComponent(); } } } public static class Templates { public static GameObject Button; public static GameObject MainTabButton; public static GameObject Toggle; public static GameObject Dropdown; public static GameObject Slider; public static GameObject TabButton; public static GameObject SettingsPanel; public static GameObject InputField; public static UI_TabGroup TabGroup; public static ScrollRect ScrollRect; public static TMP_Text Label; public static KeyCodeInput KeyBindingInput; private static RectTransform _settingsRoot; private static GameObject _templateContainer; private static bool _loaded; public static void LoadTemplates(Transform target) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) if (_loaded) { return; } _templateContainer = new GameObject("[TemplateContainer]"); Object.DontDestroyOnLoad((Object)(object)_templateContainer); _templateContainer.SetActive(false); GameObject obj = target.Search("SettingsParent/Settings Pane"); _settingsRoot = ((obj != null) ? obj.GetComponent() : null); if (!CheckValidity((Object)(object)_settingsRoot, "settingsRoot")) { return; } Button = MakeTemplate(((Transform)(object)_settingsRoot).Search("Save And Close")); ((Object)Button).name = "Button"; if (!CheckValidity((Object)(object)Button, "button")) { return; } Object.DestroyImmediate((Object)(object)Button.GetComponent()); Button.GetComponent().onSubmit = false; MainTabButton = MakeTemplate(((Transform)(object)_settingsRoot).Search("Tab Selection Hor/Accessibility")); if (!CheckValidity((Object)(object)MainTabButton, "mainTabButton")) { return; } ((Object)MainTabButton).name = "MainTabButton"; ((UnityEventBase)MainTabButton.GetComponent