Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of REPOConfig v1.2.3
REPOConfig.dll
Decompiled 10 months agousing 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.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using MenuLib; using MenuLib.MonoBehaviors; using MenuLib.Structs; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("REPOConfig")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.3")] [assembly: AssemblyInformationalVersion("1.1.8+0e6abbd5173e15b6a0a267663eda01dba538620d")] [assembly: AssemblyProduct("REPOConfig")] [assembly: AssemblyTitle("REPOConfig")] [assembly: AssemblyVersion("1.2.3.0")] [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 REPOConfig { internal sealed class ConfigMenu { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static BuilderDelegate <>9__5_0; public static BuilderDelegate <>9__5_1; public static Action <>9__6_4; public static Action <>9__6_8; public static Action <>9__7_3; public static ShouldCloseMenuDelegate <>9__7_5; public static Action <>9__7_10; public static BuilderDelegate <>9__7_6; public static ScrollViewBuilderDelegate <>9__7_9; public static Func<ConfigEntryBase, string> <>9__8_0; public static ScrollViewBuilderDelegate <>9__8_2; public static Func<PluginInfo, string> <>9__9_0; public static Func<KeyValuePair<ConfigDefinition, ConfigEntryBase>, ConfigEntryBase> <>9__9_1; internal void <Initialize>b__5_0(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(186f, 32f)).labelTMP).fontSize = 28f; } internal void <Initialize>b__5_1(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(126f, 86f)); } internal void <CreateModMenu>b__6_4() { hasPopupMenuOpened = false; } internal void <CreateModMenu>b__6_8() { hasPopupMenuOpened = false; } internal void <CreateModList>b__7_3() { hasPopupMenuOpened = false; } internal bool <CreateModList>b__7_5() { if (!hasPopupMenuOpened) { return changedEntryValues.Count == 0; } return false; } internal void <CreateModList>b__7_6(Transform mainPageParent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Save Changes", (Action)delegate { KeyValuePair<ConfigEntryBase, object>[] array = changedEntryValues.ToArray(); changedEntryValues.Clear(); KeyValuePair<ConfigEntryBase, object>[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair<ConfigEntryBase, object> keyValuePair = array2[i]; var (val2, obj2) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair); object value = (val2.BoxedValue = obj2); originalEntryValues[val2] = value; } }, mainPageParent, new Vector2(370f, 18f)); } internal void <CreateModList>b__7_10() { KeyValuePair<ConfigEntryBase, object>[] array = changedEntryValues.ToArray(); changedEntryValues.Clear(); KeyValuePair<ConfigEntryBase, object>[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair<ConfigEntryBase, object> keyValuePair = array2[i]; var (val2, obj2) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair); object value = (val2.BoxedValue = obj2); originalEntryValues[val2] = value; } } internal RectTransform <CreateModList>b__7_9(Transform scrollView) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 10f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val)).rectTransform; } internal string <CreateModEntries>b__8_0(ConfigEntryBase entry) { return entry.Definition.Section; } internal RectTransform <CreateModEntries>b__8_2(Transform scrollView) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 20f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val)).rectTransform; } internal string <GetModConfigEntries>b__9_0(PluginInfo p) { return p.Metadata.Name; } internal ConfigEntryBase <GetModConfigEntries>b__9_1(KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) { return configEntry.Value; } } private static readonly Dictionary<ConfigEntryBase, object> changedEntryValues = new Dictionary<ConfigEntryBase, object>(); private static readonly Dictionary<ConfigEntryBase, object> originalEntryValues = new Dictionary<ConfigEntryBase, object>(); internal static REPOButton lastClickedModButton; private static readonly List<REPOButton> currentModButtons = new List<REPOButton>(); private static bool hasPopupMenuOpened; internal static void Initialize() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0038: 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_0043: Expected O, but got Unknown object obj = <>c.<>9__5_0; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(186f, 32f)).labelTMP).fontSize = 28f; }; <>c.<>9__5_0 = val; obj = (object)val; } MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj); object obj2 = <>c.<>9__5_1; if (obj2 == null) { BuilderDelegate val2 = delegate(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(126f, 86f)); }; <>c.<>9__5_1 = val2; obj2 = (object)val2; } MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj2); } internal static void CreateModMenu() { //IL_0054: 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_0066: 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_0089: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown changedEntryValues.Clear(); lastClickedModButton = null; REPOPopupPage repoPopupPage = MenuAPI.CreateREPOPopupPage("Mods", (PresetSide)0, false, true, 0f); repoPopupPage.scrollView.scrollSpeed = 3f; REPOPopupPage obj = repoPopupPage; Padding maskPadding = repoPopupPage.maskPadding; maskPadding.top = 35f; obj.maskPadding = maskPadding; REPOPopupPage obj2 = repoPopupPage; obj2.onEscapePressed = (ShouldCloseMenuDelegate)Delegate.Combine((Delegate?)(object)obj2.onEscapePressed, (Delegate?)(ShouldCloseMenuDelegate)delegate { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (hasPopupMenuOpened) { return false; } if (changedEntryValues.Count == 0) { return true; } MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate { repoPopupPage.ClosePage(true); changedEntryValues.Clear(); hasPopupMenuOpened = false; }, (Action)delegate { hasPopupMenuOpened = false; }); hasPopupMenuOpened = true; return false; }); repoPopupPage.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_002f: 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_0053: Unknown result type (might be due to invalid IL or missing references) ((Component)MenuAPI.CreateREPOInputField("Mod Search", (Action<string>)delegate(string s) { string text = (string.IsNullOrEmpty(s) ? null : s.ToLower().Trim()); foreach (REPOButton currentModButton in currentModButtons) { ((REPOElement)currentModButton).repoScrollViewElement.visibility = text == null || ((TMP_Text)currentModButton.labelTMP).text.ToLower().Contains(text); } repoPopupPage.scrollView.SetScrollPosition(0f); }, parent, new Vector2(83f, 272f), false, "", "")).transform.localScale = Vector3.one * 0.95f; }); CreateModList(repoPopupPage); repoPopupPage.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Back", (Action)delegate { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (changedEntryValues.Count == 0 || hasPopupMenuOpened) { repoPopupPage.ClosePage(true); } else { MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate { repoPopupPage.ClosePage(true); changedEntryValues.Clear(); hasPopupMenuOpened = false; }, (Action)delegate { hasPopupMenuOpened = false; }); hasPopupMenuOpened = true; } }, parent, new Vector2(66f, 18f)); }); repoPopupPage.OpenPage(false); } private static void CreateModList(REPOPopupPage mainModPage) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown currentModButtons.Clear(); foreach (KeyValuePair<string, ConfigEntryBase[]> modConfigEntry in GetModConfigEntries()) { var (modName, configEntryBases) = (KeyValuePair<string, ConfigEntryBase[]>)(ref modConfigEntry); mainModPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0067: Unknown result type (might be due to invalid IL or missing references) REPOButton modButton = MenuAPI.CreateREPOButton(modName, (Action)null, parent, default(Vector2)); ((TMP_Text)modButton.labelTMP).fontStyle = (FontStyles)0; if (modName.Length > 24) { REPOButton obj = modButton; Vector2 labelSize = modButton.GetLabelSize(); labelSize.x = 250f; obj.overrideButtonSize = labelSize; REPOTextScroller val = ((Component)modButton.labelTMP).gameObject.AddComponent<REPOTextScroller>(); val.maxCharacters = 24; ((MonoBehaviour)MenuManager.instance).StartCoroutine(val.Animate()); } BuilderDelegate val2 = default(BuilderDelegate); modButton.onClick = delegate { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)lastClickedModButton == (Object)(object)modButton)) { if (changedEntryValues.Count == 0) { OpenPage(); } else { MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate { changedEntryValues.Clear(); OpenPage(); hasPopupMenuOpened = false; }, (Action)delegate { hasPopupMenuOpened = false; }); hasPopupMenuOpened = true; } } }; currentModButtons.Add(modButton); return ((REPOElement)modButton).rectTransform; void OpenPage() { //IL_0064: 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_006f: Expected O, but got Unknown //IL_008e: 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) //IL_0099: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00b6: 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_00bd: Expected O, but got Unknown //IL_00c2: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown MenuAPI.CloseAllPagesAddedOnTop(); REPOPopupPage modPage = MenuAPI.CreateREPOPopupPage(modName, (PresetSide)1, false, false, 5f); modPage.scrollView.scrollSpeed = 3f; REPOPopupPage obj3 = modPage; object obj4 = <>c.<>9__7_5; if (obj4 == null) { ShouldCloseMenuDelegate val3 = () => !hasPopupMenuOpened && changedEntryValues.Count == 0; <>c.<>9__7_5 = val3; obj4 = (object)val3; } obj3.onEscapePressed = (ShouldCloseMenuDelegate)obj4; REPOPopupPage obj5 = modPage; object obj6 = <>c.<>9__7_6; if (obj6 == null) { BuilderDelegate val4 = delegate(Transform mainPageParent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Save Changes", (Action)delegate { KeyValuePair<ConfigEntryBase, object>[] array3 = changedEntryValues.ToArray(); changedEntryValues.Clear(); KeyValuePair<ConfigEntryBase, object>[] array4 = array3; for (int j = 0; j < array4.Length; j++) { KeyValuePair<ConfigEntryBase, object> keyValuePair2 = array4[j]; var (val11, obj12) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair2); object value = (val11.BoxedValue = obj12); originalEntryValues[val11] = value; } }, mainPageParent, new Vector2(370f, 18f)); }; <>c.<>9__7_6 = val4; obj6 = (object)val4; } obj5.AddElement((BuilderDelegate)obj6); REPOPopupPage obj7 = modPage; BuilderDelegate obj8 = val2; if (obj8 == null) { BuilderDelegate val5 = delegate(Transform mainPageParent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Revert", (Action)delegate { if (changedEntryValues.Count != 0) { changedEntryValues.Clear(); OpenPage(); } }, mainPageParent, new Vector2(585f, 18f)); }; BuilderDelegate val6 = val5; val2 = val5; obj8 = val6; } obj7.AddElement(obj8); modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0036: 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_0054: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) REPOButton val9 = MenuAPI.CreateREPOButton("Reset To Default", (Action)delegate { //IL_0059: Unknown result type (might be due to invalid IL or missing references) MenuAPI.OpenPopup("Reset " + modName + "'" + (modName.ToLower().EndsWith('s') ? string.Empty : "s") + " settings?", Color.red, "Are you sure you want to reset all settings back to default?", (Action)ResetToDefault, (Action)null); }, scrollView, default(Vector2)); RectTransform rectTransform = ((REPOElement)val9).rectTransform; Rect rect = modPage.maskRectTransform.rect; ((Transform)rectTransform).localPosition = Vector2.op_Implicit(new Vector2((((Rect)(ref rect)).width - val9.GetLabelSize().x) * 0.5f, 0f)); return ((REPOElement)val9).rectTransform; }, 0f, 0f); REPOPopupPage obj9 = modPage; object obj10 = <>c.<>9__7_9; if (obj10 == null) { ScrollViewBuilderDelegate val7 = delegate(Transform scrollView) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val8 = default(Vector2); ((Vector2)(ref val8))..ctor(0f, 10f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val8)).rectTransform; }; <>c.<>9__7_9 = val7; obj10 = (object)val7; } obj9.AddElementToScrollView((ScrollViewBuilderDelegate)obj10, 0f, 0f); CreateModEntries(modPage, configEntryBases); modPage.OpenPage(true); lastClickedModButton = modButton; } void ResetToDefault() { ConfigEntryBase[] array2 = configEntryBases; foreach (ConfigEntryBase obj2 in array2) { obj2.BoxedValue = obj2.DefaultValue; } changedEntryValues.Clear(); OpenPage(); } }, 0f, 0f); } } private static void CreateModEntries(REPOPopupPage modPage, ConfigEntryBase[] configEntryBases) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Expected O, but got Unknown foreach (IGrouping<string, ConfigEntryBase> group in from entry in configEntryBases group entry by entry.Definition.Section) { modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //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) REPOLabel obj7 = MenuAPI.CreateREPOLabel(FixNaming(group.Key), scrollView, default(Vector2)); ((TMP_Text)obj7.labelTMP).fontStyle = (FontStyles)1; return ((REPOElement)obj7).rectTransform; }, 0f, 0f); foreach (ConfigEntryBase entry2 in group) { string modName = FixNaming(entry2.Definition.Key); originalEntryValues.Remove(entry2); originalEntryValues.Add(entry2, entry2.BoxedValue); ConfigEntryBase val = entry2; if (!(val is ConfigEntry<bool>)) { if (!(val is ConfigEntry<float>)) { if (!(val is ConfigEntry<int>)) { if (!(val is ConfigEntry<string>)) { if (val == null || !entry2.SettingType.IsSubclassOf(typeof(Enum))) { continue; } Type enumType = entry2.SettingType; string[] values = Enum.GetNames(enumType); modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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) REPOSlider val11 = MenuAPI.CreateREPOSlider(modName, string.Empty, (Action<int>)delegate(int i) { object obj6 = Enum.Parse(enumType, values[i]); if (originalEntryValues.TryGetValue(entry2, out var value6) && obj6 == value6) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = obj6; } }, scrollView, values, entry2.BoxedValue.ToString(), default(Vector2), "", "", (BarBehavior)0); TextMeshProUGUI descriptionTMP4 = val11.descriptionTMP; TextMeshProUGUI labelTMP5 = val11.labelTMP; FontStyles fontStyle5 = (FontStyles)0; ((TMP_Text)labelTMP5).fontStyle = (FontStyles)0; ((TMP_Text)descriptionTMP4).fontStyle = fontStyle5; return ((REPOElement)val11).rectTransform; }, 0f, 0f); continue; } AcceptableValueBase acceptableValues = entry2.Description.AcceptableValues; AcceptableValueList<string> val2 = acceptableValues as AcceptableValueList<string>; if (val2 != null) { modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //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_009b: 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) REPOSlider val10 = MenuAPI.CreateREPOSlider(modName, string.Empty, (Action<string>)delegate(string s) { if (originalEntryValues.TryGetValue(entry2, out var value5) && s == (string)value5) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = s; } }, scrollView, val2.AcceptableValues, (string)entry2.BoxedValue, default(Vector2), "", "", (BarBehavior)0); TextMeshProUGUI descriptionTMP3 = val10.descriptionTMP; TextMeshProUGUI labelTMP4 = val10.labelTMP; FontStyles fontStyle4 = (FontStyles)0; ((TMP_Text)labelTMP4).fontStyle = (FontStyles)0; ((TMP_Text)descriptionTMP3).fontStyle = fontStyle4; return ((REPOElement)val10).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) string text4 = (string)entry2.DefaultValue; REPOInputField val9 = MenuAPI.CreateREPOInputField(modName, (Action<string>)delegate(string s) { if (originalEntryValues.TryGetValue(entry2, out var value4) && s == (string)value4) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = s; } }, scrollView, Vector2.zero, false, (!string.IsNullOrEmpty(text4)) ? text4 : "<NONE>", (string)entry2.BoxedValue); TextMeshProUGUI labelTMP3 = val9.labelTMP; TMP_Text inputTMP = val9.inputStringSystem.inputTMP; FontStyles fontStyle3 = (FontStyles)0; inputTMP.fontStyle = (FontStyles)0; ((TMP_Text)labelTMP3).fontStyle = fontStyle3; return ((REPOElement)val9).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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) int num9; int num10; int num12; if (entry2.Description.AcceptableValues is AcceptableValueRange<int> val7) { num9 = val7.MinValue; num10 = val7.MaxValue; } else { int num11 = Math.Abs((int)entry2.BoxedValue); num12 = ((num11 > 100) ? (-(num10 = num11 * 2)) : ((num11 != 0) ? (-(num10 = num11 * 3)) : (-(num10 = 100)))); num9 = num12; } string text3 = modName; string empty2 = string.Empty; Action<int> obj5 = delegate(int i) { if (originalEntryValues.TryGetValue(entry2, out var value3) && i == (int)value3) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = i; } }; num12 = (int)entry2.BoxedValue; int num13 = num9; int num14 = num10; REPOSlider val8 = MenuAPI.CreateREPOSlider(text3, empty2, obj5, scrollView, default(Vector2), num13, num14, num12, "", "", (BarBehavior)0); TextMeshProUGUI descriptionTMP2 = val8.descriptionTMP; TextMeshProUGUI labelTMP2 = val8.labelTMP; FontStyles fontStyle2 = (FontStyles)0; ((TMP_Text)labelTMP2).fontStyle = (FontStyles)0; ((TMP_Text)descriptionTMP2).fontStyle = fontStyle2; return ((REPOElement)val8).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_018e: Unknown result type (might be due to invalid IL or missing references) int num = 2; float num2; float num3; if (entry2.Description.AcceptableValues is AcceptableValueRange<float> val5) { num2 = val5.MinValue; num3 = val5.MaxValue; num = Mathf.Max(new int[4] { GetDecimalPlaces(num2), GetDecimalPlaces(num3), GetDecimalPlaces((float)entry2.DefaultValue), 2 }); } else { float num4 = Math.Abs((float)entry2.BoxedValue); num2 = ((num4 == 0f) ? (0f - (num3 = 100f)) : (((double)num4 <= 0.001) ? (0f - (num3 = 10f)) : (((double)num4 <= 0.01) ? (0f - (num3 = 50f)) : ((!(num4 <= 100f)) ? (0f - (num3 = num4 * 2f)) : (0f - (num3 = num4 * 3f)))))); } string text2 = modName; string empty = string.Empty; Action<float> obj4 = delegate(float f) { if (originalEntryValues.TryGetValue(entry2, out var value2) && Math.Abs(f - (float)value2) < float.Epsilon) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = f; } }; float num5 = (float)entry2.BoxedValue; float num6 = num2; float num7 = num3; int num8 = num; REPOSlider val6 = MenuAPI.CreateREPOSlider(text2, empty, obj4, scrollView, default(Vector2), num6, num7, num8, num5, "", "", (BarBehavior)0); TextMeshProUGUI descriptionTMP = val6.descriptionTMP; TextMeshProUGUI labelTMP = val6.labelTMP; FontStyles fontStyle = (FontStyles)0; ((TMP_Text)labelTMP).fontStyle = (FontStyles)0; ((TMP_Text)descriptionTMP).fontStyle = fontStyle; return ((REPOElement)val6).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_004d: 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) string text = modName; Action<bool> obj2 = delegate(bool b) { if (originalEntryValues.TryGetValue(entry2, out var value) && b == (bool)value) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = b; } }; bool flag = (bool)entry2.BoxedValue; REPOToggle obj3 = MenuAPI.CreateREPOToggle(text, obj2, scrollView, default(Vector2), "ON", "OFF", flag); ((TMP_Text)obj3.labelTMP).fontStyle = (FontStyles)0; return ((REPOElement)obj3).rectTransform; }, 0f, 0f); } object obj = <>c.<>9__8_2; if (obj == null) { ScrollViewBuilderDelegate val3 = delegate(Transform scrollView) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0f, 20f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val4)).rectTransform; }; <>c.<>9__8_2 = val3; obj = (object)val3; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f); } } private static Dictionary<string, ConfigEntryBase[]> GetModConfigEntries() { Dictionary<string, ConfigEntryBase[]> dictionary = new Dictionary<string, ConfigEntryBase[]>(); foreach (PluginInfo item in Chainloader.PluginInfos.Values.OrderBy((PluginInfo p) => p.Metadata.Name)) { List<ConfigEntryBase> list = new List<ConfigEntryBase>(); foreach (ConfigEntryBase item2 in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)item.Instance.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) => configEntry.Value)) { ConfigDescription description = item2.Description; object[] array = ((description != null) ? description.Tags : null); if (array == null || (!array.Contains("HideREPOConfig") && !array.Contains("HideFromREPOConfig"))) { list.Add(item2); } } if (list.Count > 0) { dictionary.TryAdd(FixNaming(item.Metadata.Name), list.ToArray()); } } return dictionary; } private static string FixNaming(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(); } private static int GetDecimalPlaces(float value) { string text = value.ToString(CultureInfo.InvariantCulture); int num = text.IndexOf('.'); if (num != -1) { string text2 = text; int num2 = num + 1; return text2.Substring(num2, text2.Length - num2).Length; } return 0; } } [BepInPlugin("nickklmao.repoconfig", "REPOConfig", "1.2.3")] [BepInDependency("nickklmao.menulib", "2.5.0")] internal sealed class Entry : BaseUnityPlugin { private const string MOD_NAME = "REPOConfig"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("REPOConfig"); private static ConfigEntry<bool> showInGame; private static void MenuPageMain_StartHook(Action<MenuPageMain> orig, MenuPageMain self) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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) REPOButton val = MenuAPI.CreateREPOButton("Mods", (Action)ConfigMenu.CreateModMenu, ((Component)self).transform, new Vector2(48.3f, 0f)); List<Transform> list = (from Transform transform in (IEnumerable)((Component)self).transform where ((Object)transform).name.Contains("Menu Button") orderby transform.localPosition.y descending select transform).ToList(); list.Insert(list.Count - 1, ((Component)val).transform); float num = 224f; foreach (Transform item in list) { Vector3 localPosition = item.localPosition; localPosition.y = num; item.localPosition = localPosition; num -= 30f; } orig(self); } private void Awake() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) showInGame = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show In Game", true, new ConfigDescription(string.Empty, (AcceptableValueBase)null, new object[1] { "HideFromREPOConfig" })); if (showInGame.Value) { logger.LogDebug((object)"Hooking `MenuPageMain.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageMain), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageMain>, MenuPageMain>(MenuPageMain_StartHook)); ConfigMenu.Initialize(); } } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] [Obsolete("This attribute is not used and will be removed eventually.")] public class REPOConfigEntryAttribute : Attribute { public REPOConfigEntryAttribute(string displayName) { } public REPOConfigEntryAttribute(string displayName, int min, int max, string prefix = "", string postfix = "") { } public REPOConfigEntryAttribute(string displayName, float min, float max, string prefix = "", string postfix = "") { } public REPOConfigEntryAttribute(string displayName, float min, float max, int precision = 2, string prefix = "", string postfix = "") { } public REPOConfigEntryAttribute(string displayName, string prefix = "", string postfix = "") { } public REPOConfigEntryAttribute(string displayName, params string[] customOptions) { } } }