using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("UniversalModList")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("UniversalModList")] [assembly: AssemblyTitle("UniversalModList")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } [BepInPlugin("universal.mod.list", "Universal Mod List", "1.2.2")] public class UniversalModList : BaseUnityPlugin { private static UniversalModList instance; private GameObject canvas; private bool visible; private int selectedModIndex = 0; private GameObject leftContent; private GameObject rightContent; private float originalTimeScale = 1f; private List disabledComponents = new List(); private ConfigEntry openKeybind; private static List logEntries = new List(); private static readonly int maxLogEntries = 100; private Text consoleTextComponent; private readonly Color colorBackground = new Color(0.04f, 0.02f, 0.08f, 0.96f); private readonly Color colorPanel = new Color(0.07f, 0.04f, 0.12f, 0.9f); private readonly Color colorAccent = new Color(0f, 0.9f, 1f, 1f); private readonly Color colorAccentHover = new Color(0f, 1f, 0.7f, 1f); private readonly Color colorButtonNeutral = new Color(0.12f, 0.07f, 0.22f, 0.85f); private readonly Color colorText = new Color(0f, 1f, 1f, 1f); private readonly Color colorTextWhite = new Color(0.95f, 0.98f, 1f, 1f); private readonly Color colorTitle = new Color(0.78f, 1f, 0f, 1f); private Font mainFont; private void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown instance = this; Application.logMessageReceived += new LogCallback(HandleLog); openKeybind = ((BaseUnityPlugin)this).Config.Bind("General", "Open List Hotkey", (KeyCode)282, "Hotkey to toggle the Mod List menu."); } private void Start() { try { mainFont = Font.CreateDynamicFontFromOSFont("Arial", 14); } catch { mainFont = Resources.GetBuiltinResource("Arial.ttf"); } ModEntry modEntry = new ModEntry(); modEntry.ModName = "Developer Console"; modEntry.CustomUIBuilder = BuildDevConsoleUI; modEntry.ModType = typeof(UniversalModList); ModRegistry.Register(modEntry); CreateUI(); if ((Object)(object)canvas != (Object)null) { canvas.SetActive(false); } } private void Update() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001f: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) bool flag = false; KeyCode value = openKeybind.Value; try { if (Keyboard.current != null) { Key inputSystemKey = GetInputSystemKey(value); if (((ButtonControl)Keyboard.current[inputSystemKey]).wasPressedThisFrame) { flag = true; } } } catch { } try { if (Input.GetKeyDown(value)) { flag = true; } } catch { } if (flag) { visible = !visible; if ((Object)(object)canvas != (Object)null) { canvas.SetActive(visible); if (visible) { originalTimeScale = Time.timeScale; Time.timeScale = 0f; EnsureEventSystem(); FreezeGameplayInputs(); BuildLeftMenu(); BuildRightMenu(); } else { Time.timeScale = originalTimeScale; UnfreezeGameplayInputs(); Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } } } if (visible) { Time.timeScale = 0f; Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } } private void HandleLog(string logString, string stackTrace, LogType type) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 string arg = "white"; if ((int)type == 0 || (int)type == 4) { arg = "#ff5555"; } else if ((int)type == 2) { arg = "#ffcc00"; } else if ((int)type == 3) { arg = "#aaffaa"; } string item = $"[{DateTime.Now:HH:mm:ss}] {logString}"; logEntries.Add(item); if (logEntries.Count > maxLogEntries) { logEntries.RemoveAt(0); } if (visible && (Object)(object)consoleTextComponent != (Object)null) { UpdateConsoleUI(); } } private void FreezeGameplayInputs() { disabledComponents.Clear(); try { Behaviour[] array = Object.FindObjectsOfType(); foreach (Behaviour val in array) { if ((Object)(object)val == (Object)null || !val.enabled || val is UniversalModList || ((Object)((Component)val).gameObject).name.Contains("ModMenu") || ((Object)((Component)val).gameObject).name.Contains("EventSystem")) { continue; } Type type = ((object)val).GetType(); if (type.Namespace == null || !type.Namespace.StartsWith("UnityEngine")) { string text = type.Name.ToLower(); if (text.Contains("player") || text.Contains("camera") || text.Contains("look") || text.Contains("move") || text.Contains("shoot") || text.Contains("gun") || text.Contains("weapon")) { val.enabled = false; disabledComponents.Add(val); } } } } catch { } } private void UnfreezeGameplayInputs() { foreach (Behaviour disabledComponent in disabledComponents) { if ((Object)(object)disabledComponent != (Object)null) { try { disabledComponent.enabled = true; } catch { } } } disabledComponents.Clear(); } private void EnsureEventSystem() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)EventSystem.current == (Object)null) { GameObject val = new GameObject("EventSystem"); val.AddComponent(); val.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val); } } private void CreateUI() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0081: 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) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: 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) canvas = new GameObject("ModMenuCanvas"); Object.DontDestroyOnLoad((Object)(object)canvas); Canvas val = canvas.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 9999; canvas.AddComponent(); canvas.AddComponent(); GameObject val2 = new GameObject("MenuBackground"); val2.transform.SetParent(canvas.transform, false); Image val3 = val2.AddComponent(); ((Graphic)val3).color = colorBackground; Outline val4 = val2.AddComponent(); ((Shadow)val4).effectColor = colorAccent; ((Shadow)val4).effectDistance = new Vector2(2f, 2f); RectTransform component = val2.GetComponent(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(1100f, 700f); GameObject val5 = new GameObject("HeaderTitle"); val5.transform.SetParent(val2.transform, false); Text val6 = val5.AddComponent(); val6.text = "INSTALLED MOD LIST"; val6.font = mainFont; val6.fontSize = 26; val6.alignment = (TextAnchor)3; ((Graphic)val6).color = colorTitle; RectTransform component2 = val5.GetComponent(); component2.anchorMin = new Vector2(0f, 1f); component2.anchorMax = new Vector2(1f, 1f); component2.pivot = new Vector2(0.5f, 1f); component2.anchoredPosition = new Vector2(20f, -10f); component2.sizeDelta = new Vector2(-40f, 45f); leftContent = CreateScrollablePanel("LeftPanel", new Vector2(20f, 20f), new Vector2(300f, 610f), val2.transform); rightContent = CreateScrollablePanel("RightPanel", new Vector2(340f, 20f), new Vector2(740f, 610f), val2.transform); } private GameObject CreateScrollablePanel(string name, Vector2 pos, Vector2 size, Transform parent) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0027: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_007f: 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) //IL_0093: 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_00a6: Expected O, but got Unknown //IL_00c5: 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_00e9: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent(); Image val3 = val.AddComponent(); ((Graphic)val3).color = colorPanel; Outline val4 = val.AddComponent(); ((Shadow)val4).effectColor = colorAccent * 0.5f; ((Shadow)val4).effectDistance = new Vector2(1.5f, 1.5f); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.zero; val2.pivot = Vector2.zero; val2.anchoredPosition = pos; val2.sizeDelta = size; GameObject val5 = new GameObject("Viewport"); val5.transform.SetParent(val.transform, false); RectTransform val6 = val5.AddComponent(); val6.anchorMin = Vector2.zero; val6.anchorMax = Vector2.one; val6.pivot = new Vector2(0f, 1f); val6.sizeDelta = new Vector2(-10f, -10f); val6.anchoredPosition = new Vector2(5f, -5f); val5.AddComponent(); GameObject val7 = new GameObject("Content"); val7.transform.SetParent(val5.transform, false); RectTransform val8 = val7.AddComponent(); val8.anchorMin = new Vector2(0f, 1f); val8.anchorMax = new Vector2(1f, 1f); val8.pivot = new Vector2(0.5f, 1f); val8.sizeDelta = new Vector2(0f, 0f); VerticalLayoutGroup val9 = val7.AddComponent(); ((HorizontalOrVerticalLayoutGroup)val9).spacing = 8f; ((LayoutGroup)val9).padding = new RectOffset(5, 5, 5, 5); ((HorizontalOrVerticalLayoutGroup)val9).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val9).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val9).childForceExpandWidth = true; ContentSizeFitter val10 = val7.AddComponent(); val10.verticalFit = (FitMode)2; ScrollRect val11 = val.AddComponent(); val11.content = val8; val11.viewport = val6; val11.horizontal = false; val11.vertical = true; val11.scrollSensitivity = 25f; return val7; } private void BuildLeftMenu() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00fd: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_023d: 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_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Expected O, but got Unknown if ((Object)(object)leftContent == (Object)null) { return; } foreach (Transform item in leftContent.transform) { Transform val = item; Object.Destroy((Object)(object)((Component)val).gameObject); } for (int i = 0; i < ModRegistry.Mods.Count; i++) { ModEntry modEntry = ModRegistry.Mods[i]; int index = i; GameObject val2 = new GameObject("Button_" + modEntry.ModName); val2.transform.SetParent(leftContent.transform, false); LayoutElement val3 = val2.AddComponent(); val3.minHeight = 38f; bool flag = index == selectedModIndex; Image val4 = val2.AddComponent(); ((Graphic)val4).color = (flag ? colorAccent : colorButtonNeutral); if (flag) { Outline val5 = val2.AddComponent(); ((Shadow)val5).effectColor = colorAccentHover; ((Shadow)val5).effectDistance = new Vector2(1f, 1f); } Button val6 = val2.AddComponent