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 ModPack v1.0.1
ModPack.dll
Decompiled 8 hours agousing System; using System.Collections.Generic; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GameImprovement.Ui; using HarmonyLib; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("0.0.0.0")] namespace ModPack { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.proigryfedorov.modpack", "ModPack", "1.0.1")] public class ModPackPlugin : BaseUnityPlugin { internal class ModTab { public string guid; public string title; public string note; } public const string PluginGuid = "com.proigryfedorov.modpack"; public const string PluginName = "ModPack"; public const string PluginVersion = "1.0.1"; public const string ItemVaultGuid = "com.proigryfedorov.itemvault"; public const string HeroStatsGuid = "com.proigryfedorov.herostats"; public const string LevelCapsGuid = "com.proigryfedorov.levelcaps"; public const string LagFixGuid = "com.proigryfedorov.lagfix"; internal static readonly ModTab[] Tabs = new ModTab[4] { new ModTab { guid = "com.proigryfedorov.itemvault", title = "Хранилище", note = "ItemVault. Сбор и раздача работают по настройкам хоста." }, new ModTab { guid = "com.proigryfedorov.herostats", title = "Статистика", note = "HeroStats. Панель, подсказки предметов, золото больше 2 млрд." }, new ModTab { guid = "com.proigryfedorov.levelcaps", title = "Уровни", note = "LevelCaps. Разделы Levels и Experience применяются после перезапуска игры." }, new ModTab { guid = "com.proigryfedorov.lagfix", title = "Оптимизация", note = "LagFix. Применяется сразу." } }; internal static readonly Dictionary<string, string> ReadOnly = new Dictionary<string, string> { { "com.proigryfedorov.itemvault/Admin/AdminMode", "включается в «Хранилище → Настройки» (только хост, с подтверждением)" } }; internal static readonly HashSet<string> Hidden = new HashSet<string> { "com.proigryfedorov.itemvault/CommandQueue/Queue" }; internal static readonly HashSet<string> NeedsRestart = new HashSet<string> { "com.proigryfedorov.levelcaps/Levels", "com.proigryfedorov.levelcaps/Experience" }; internal static ModPackPlugin Instance; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown Instance = this; Harmony val = new Harmony("com.proigryfedorov.modpack"); val.Patch((MethodBase)AccessTools.Method(typeof(PauseScreenController), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ModPackPlugin), "PauseAwakePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ModPack 1.0.1 loaded"); } private static void PauseAwakePostfix(PauseScreenController __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown try { RoR2Ui.AddPauseButton(__instance, "ModPackSettingsButton", "Настройки модов", (UnityAction)delegate { SettingsMenu.Open(__instance); }); } catch (Exception ex) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogError((object)("Не удалось добавить кнопку в меню паузы: " + ex)); } } } } internal class SettingsMenu : MonoBehaviour { private Submenu menu; private readonly List<GameObject> tabButtons = new List<GameObject>(); private TextMeshProUGUI note; private RectTransform list; private int tab; public static void Open(PauseScreenController pause) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Submenu submenu = RoR2Ui.OpenSubmenu(pause, "ModPackSettings", new Vector2(0.1f, 0.06f), new Vector2(0.9f, 0.94f)); SettingsMenu settingsMenu = submenu.root.AddComponent<SettingsMenu>(); settingsMenu.menu = submenu; settingsMenu.Build(); } private void Build() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown menu.Title("Настройки модов"); RectTransform parent = menu.Row((Transform)(object)menu.box, 46f); for (int i = 0; i < ModPackPlugin.Tabs.Length; i++) { int index = i; tabButtons.Add(menu.Button((Transform)(object)parent, ModPackPlugin.Tabs[i].title, (UnityAction)delegate { ShowTab(index); })); } note = menu.Text((Transform)(object)menu.box, "", 18f, (TextAlignmentOptions)514, RoR2Ui.MutedText); list = menu.ScrollList((Transform)(object)menu.box); RectTransform parent2 = menu.Row((Transform)(object)menu.box, 46f); TextMeshProUGUI val = menu.Text((Transform)(object)parent2, "Изменения сразу сохраняются в конфиг мода.", 16f, (TextAlignmentOptions)4097, RoR2Ui.MutedText); ((Component)val).gameObject.AddComponent<LayoutElement>().flexibleWidth = 1f; GameObject go = menu.Button((Transform)(object)parent2, "Назад", (UnityAction)delegate { menu.Close(); }); RoR2Ui.Size(go, 46f, 220f); ShowTab(0); } private void ShowTab(int index) { //IL_00cb: 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_0034: Unknown result type (might be due to invalid IL or missing references) tab = index; for (int i = 0; i < tabButtons.Count; i++) { TextMeshProUGUI[] componentsInChildren = tabButtons[i].GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val in componentsInChildren) { ((Graphic)val).color = ((i == tab) ? RoR2Ui.HeaderText : Color.white); } } ModPackPlugin.ModTab modTab = ModPackPlugin.Tabs[tab]; ((TMP_Text)note).text = modTab.note; Submenu.Clear((Transform)(object)list); if (!Chainloader.PluginInfos.TryGetValue(modTab.guid, out var value) || (Object)(object)value.Instance == (Object)null) { menu.Text((Transform)(object)list, "Мод не загружен.", 20f, (TextAlignmentOptions)513, Color.white); } else { BuildConfig(modTab.guid, value.Instance.Config); } } private void BuildConfig(string guid, ConfigFile config) { //IL_011a: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); Dictionary<string, List<ConfigEntryBase>> dictionary = new Dictionary<string, List<ConfigEntryBase>>(); foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in config) { string section = item.Key.Section; if (!ModPackPlugin.Hidden.Contains(guid + "/" + section + "/" + item.Key.Key)) { if (!dictionary.ContainsKey(section)) { dictionary[section] = new List<ConfigEntryBase>(); list.Add(section); } dictionary[section].Add(item.Value); } } foreach (string item2 in list) { string text = item2 + (ModPackPlugin.NeedsRestart.Contains(guid + "/" + item2) ? " <size=70%><color=#b8bfc8>(после перезапуска игры)</color></size>" : ""); TextMeshProUGUI val = menu.Text((Transform)(object)this.list, text, 26f, (TextAlignmentOptions)1025, RoR2Ui.HeaderText); RoR2Ui.Size(((Component)val).gameObject, 44f, -1f); foreach (ConfigEntryBase item3 in dictionary[item2]) { BuildEntry(guid, item3); } } } private void BuildEntry(string guid, ConfigEntryBase entry) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) string key = guid + "/" + entry.Definition.Section + "/" + entry.Definition.Key; RectTransform parent = menu.Row((Transform)(object)list, 46f); TextMeshProUGUI val = menu.Text((Transform)(object)parent, entry.Definition.Key, 20f, (TextAlignmentOptions)4097, Color.white); RoR2Ui.Size(((Component)val).gameObject, -1f, 300f); if (ModPackPlugin.ReadOnly.TryGetValue(key, out var value)) { TextMeshProUGUI val2 = menu.Text((Transform)(object)parent, Show(entry.BoxedValue) + " — " + value, 17f, (TextAlignmentOptions)4097, RoR2Ui.MutedText); ((Component)val2).gameObject.AddComponent<LayoutElement>().flexibleWidth = 1f; } else if (entry.SettingType == typeof(bool)) { GameObject toggle = null; toggle = menu.Button((Transform)(object)parent, OnOff(entry), (UnityAction)delegate { entry.BoxedValue = !(bool)entry.BoxedValue; RoR2Ui.SetButtonText(toggle, OnOff(entry)); }); RoR2Ui.Size(toggle, 46f, 200f); } else { TMP_InputField input = null; input = menu.Input((Transform)(object)parent, Show(entry.BoxedValue), -1f, delegate(string text2) { if (TryParse(entry, text2, out var parsed)) { entry.BoxedValue = parsed; } input.text = Show(entry.BoxedValue); }); } string text = ((entry.Description != null) ? entry.Description.Description : ""); if (!string.IsNullOrEmpty(text)) { TextMeshProUGUI val3 = menu.Text((Transform)(object)list, text, 16f, (TextAlignmentOptions)257, RoR2Ui.MutedText); ((TMP_Text)val3).margin = new Vector4(4f, 0f, 0f, 6f); } } private static string OnOff(ConfigEntryBase entry) { if (!(bool)entry.BoxedValue) { return "ВЫКЛ"; } return "ВКЛ"; } private static string Show(object value) { return Convert.ToString(value, CultureInfo.InvariantCulture); } private static bool TryParse(ConfigEntryBase entry, string text, out object parsed) { parsed = null; text = (text ?? "").Trim(); try { if (entry.SettingType == typeof(string)) { parsed = text; } else if (entry.SettingType.IsEnum) { parsed = Enum.Parse(entry.SettingType, text, ignoreCase: true); } else { parsed = Convert.ChangeType(text.Replace(',', '.'), entry.SettingType, CultureInfo.InvariantCulture); } if (entry.Description != null && entry.Description.AcceptableValues != null) { parsed = entry.Description.AcceptableValues.Clamp(parsed); } return true; } catch (ArgumentException) { return false; } catch (FormatException) { return false; } catch (OverflowException) { return false; } } } } namespace GameImprovement.Ui { internal static class RoR2Ui { public static readonly Color BoxColor = new Color(0.09f, 0.1f, 0.12f, 0.96f); public static readonly Color MutedText = new Color(0.72f, 0.75f, 0.8f); public static readonly Color HeaderText = new Color(0.95f, 0.8f, 0.45f); private static readonly FieldInfo SubmenuField = AccessTools.Field(typeof(PauseScreenController), "submenuObject"); public static GameObject AddPauseButton(PauseScreenController pause, string name, string label, UnityAction onClick) { GameObject exitGameButton = pause.exitGameButton; if ((Object)(object)exitGameButton == (Object)null) { return null; } GameObject val = CloneButton(exitGameButton, exitGameButton.transform.parent, label, onClick); ((Object)val).name = name; val.transform.SetSiblingIndex(exitGameButton.transform.GetSiblingIndex()); return val; } public static Submenu OpenSubmenu(PauseScreenController pause, string name, Vector2 anchorMin, Vector2 anchorMax) { //IL_001b: 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: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0068: 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_0093: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown GameObject val = ((!(SubmenuField != null)) ? ((GameObject)null) : ((GameObject)SubmenuField.GetValue(pause))); if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } GameObject val2 = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val3 = (RectTransform)val2.transform; ((Transform)val3).SetParent((Transform)(object)pause.rootPanel, false); Stretch(val3, Vector2.zero, Vector2.one); Image val4 = val2.AddComponent<Image>(); ((Graphic)val4).color = new Color(0f, 0f, 0f, 0.6f); RectTransform val5 = NewRect("Box", (Transform)(object)val3); Stretch(val5, anchorMin, anchorMax); ((Graphic)((Component)val5).gameObject.AddComponent<Image>()).color = BoxColor; Outline val6 = ((Component)val5).gameObject.AddComponent<Outline>(); ((Shadow)val6).effectColor = new Color(0.55f, 0.6f, 0.65f, 0.6f); ((Shadow)val6).effectDistance = new Vector2(2f, -2f); VerticalLayoutGroup val7 = ((Component)val5).gameObject.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val7).padding = new RectOffset(24, 24, 18, 18); ((HorizontalOrVerticalLayoutGroup)val7).spacing = 10f; ((HorizontalOrVerticalLayoutGroup)val7).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val7).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val7).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val7).childForceExpandHeight = false; if (SubmenuField != null) { SubmenuField.SetValue(pause, val2); } ((Component)pause.pausePanel).gameObject.SetActive(false); ((Component)pause.gameMenuPanel).gameObject.SetActive(true); ((Component)pause.mainPanel).gameObject.SetActive(false); Submenu submenu = new Submenu(); submenu.root = val2; submenu.box = val5; submenu.buttonTemplate = pause.exitGameButton; TextMeshProUGUI val8 = (((Object)(object)pause.exitGameButton != (Object)null) ? pause.exitGameButton.GetComponentInChildren<TextMeshProUGUI>(true) : null); submenu.font = (((Object)(object)val8 != (Object)null) ? ((TMP_Text)val8).font : null); return submenu; } public static GameObject CloneButton(GameObject template, Transform parent, string label, UnityAction onClick) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(template, parent); LanguageTextMeshController[] componentsInChildren = val.GetComponentsInChildren<LanguageTextMeshController>(true); foreach (LanguageTextMeshController val2 in componentsInChildren) { Object.DestroyImmediate((Object)(object)val2); } SetButtonText(val, label); Button component = val.GetComponent<Button>(); if ((Object)(object)component != (Object)null) { component.onClick = new ButtonClickedEvent(); if (onClick != null) { ((UnityEvent)component.onClick).AddListener(onClick); } } val.SetActive(true); return val; } public static void SetButtonText(GameObject button, string label) { TextMeshProUGUI[] componentsInChildren = button.GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val in componentsInChildren) { ((TMP_Text)val).text = label; } } public static RectTransform NewRect(string name, Transform parent) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent(parent, false); return val2; } public static void Stretch(RectTransform rt, Vector2 min, Vector2 max) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) rt.anchorMin = min; rt.anchorMax = max; rt.offsetMin = Vector2.zero; rt.offsetMax = Vector2.zero; ((Transform)rt).localScale = Vector3.one; } public static LayoutElement Size(GameObject go, float height, float width) { LayoutElement val = go.GetComponent<LayoutElement>(); if ((Object)(object)val == (Object)null) { val = go.AddComponent<LayoutElement>(); } if (height >= 0f) { val.minHeight = height; val.preferredHeight = height; val.flexibleHeight = 0f; } if (width >= 0f) { val.minWidth = width; val.preferredWidth = width; val.flexibleWidth = 0f; } return val; } } internal class Submenu { public const float ButtonHeight = 46f; public GameObject root; public RectTransform box; public GameObject buttonTemplate; public TMP_FontAsset font; public void Close() { if ((Object)(object)root != (Object)null) { Object.Destroy((Object)(object)root); } } public TextMeshProUGUI Text(Transform parent, string text, float size, TextAlignmentOptions align, Color color) { //IL_0041: 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) RectTransform val = RoR2Ui.NewRect("Text", parent); TextMeshProUGUI val2 = ((Component)val).gameObject.AddComponent<TextMeshProUGUI>(); if ((Object)(object)font != (Object)null) { ((TMP_Text)val2).font = font; } ((TMP_Text)val2).text = text; ((TMP_Text)val2).fontSize = size; ((TMP_Text)val2).alignment = align; ((Graphic)val2).color = color; ((Graphic)val2).raycastTarget = false; ((TMP_Text)val2).enableWordWrapping = true; return val2; } public TextMeshProUGUI Title(string text) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = Text((Transform)(object)box, text, 38f, (TextAlignmentOptions)514, Color.white); RoR2Ui.Size(((Component)val).gameObject, 48f, -1f); return val; } public GameObject Button(Transform parent, string label, UnityAction onClick) { GameObject val = RoR2Ui.CloneButton(buttonTemplate, parent, label, onClick); LayoutElement val2 = RoR2Ui.Size(val, 46f, -1f); val2.minWidth = 0f; val2.preferredWidth = 0f; val2.flexibleWidth = 1f; TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val3 in componentsInChildren) { ((TMP_Text)val3).enableAutoSizing = true; ((TMP_Text)val3).fontSizeMin = 12f; ((TMP_Text)val3).fontSizeMax = 20f; ((TMP_Text)val3).enableWordWrapping = false; } return val; } public RectTransform Row(Transform parent, float height) { RectTransform val = RoR2Ui.NewRect("Row", parent); RoR2Ui.Size(((Component)val).gameObject, height, -1f); HorizontalLayoutGroup val2 = ((Component)val).gameObject.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val2).spacing = 10f; ((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = true; ((LayoutGroup)val2).childAlignment = (TextAnchor)3; return val; } public TMP_InputField Input(Transform parent, string value, float width, UnityAction<string> onEndEdit) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0110: Unknown result type (might be due to invalid IL or missing references) RectTransform val = RoR2Ui.NewRect("Input", parent); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.02f, 0.03f, 0.04f, 0.9f); Outline val3 = ((Component)val).gameObject.AddComponent<Outline>(); ((Shadow)val3).effectColor = new Color(0.45f, 0.5f, 0.55f, 0.7f); LayoutElement val4 = RoR2Ui.Size(((Component)val).gameObject, 40f, width); if (width < 0f) { val4.flexibleWidth = 1f; } RectTransform val5 = RoR2Ui.NewRect("Text Area", (Transform)(object)val); RoR2Ui.Stretch(val5, Vector2.zero, Vector2.one); val5.offsetMin = new Vector2(10f, 4f); val5.offsetMax = new Vector2(-10f, -4f); ((Component)val5).gameObject.AddComponent<RectMask2D>(); TextMeshProUGUI val6 = Text((Transform)(object)val5, "", 20f, (TextAlignmentOptions)4097, Color.white); ((TMP_Text)val6).enableWordWrapping = false; RoR2Ui.Stretch(((TMP_Text)val6).rectTransform, Vector2.zero, Vector2.one); TMP_InputField val7 = ((Component)val).gameObject.AddComponent<TMP_InputField>(); val7.textViewport = val5; val7.textComponent = (TMP_Text)(object)val6; if ((Object)(object)font != (Object)null) { val7.fontAsset = font; } val7.pointSize = 20f; ((Selectable)val7).targetGraphic = (Graphic)(object)val2; val7.text = value ?? ""; if (onEndEdit != null) { ((UnityEvent<string>)(object)val7.onEndEdit).AddListener(onEndEdit); } return val7; } public RectTransform ScrollList(Transform parent) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown RectTransform val = RoR2Ui.NewRect("Scroll", parent); LayoutElement val2 = ((Component)val).gameObject.AddComponent<LayoutElement>(); val2.flexibleHeight = 1f; val2.minHeight = 120f; ((Graphic)((Component)val).gameObject.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.35f); ((Component)val).gameObject.AddComponent<RectMask2D>(); ScrollRect val3 = ((Component)val).gameObject.AddComponent<ScrollRect>(); val3.horizontal = false; val3.movementType = (MovementType)2; val3.scrollSensitivity = 40f; RectTransform val4 = RoR2Ui.NewRect("Content", (Transform)(object)val); val4.anchorMin = new Vector2(0f, 1f); val4.anchorMax = new Vector2(1f, 1f); val4.pivot = new Vector2(0.5f, 1f); val4.offsetMin = Vector2.zero; val4.offsetMax = Vector2.zero; VerticalLayoutGroup val5 = ((Component)val4).gameObject.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val5).padding = new RectOffset(16, 16, 10, 14); ((HorizontalOrVerticalLayoutGroup)val5).spacing = 4f; ((HorizontalOrVerticalLayoutGroup)val5).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val5).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val5).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val5).childForceExpandHeight = false; ContentSizeFitter val6 = ((Component)val4).gameObject.AddComponent<ContentSizeFitter>(); val6.verticalFit = (FitMode)2; val3.content = val4; val3.viewport = val; return val4; } public static void Clear(Transform parent) { for (int num = parent.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)parent.GetChild(num)).gameObject); } } } }