using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using UnityEngine; using UnityExplorer.UI; namespace UnityExplorer.Config { public static class ConfigManager { // Each Mod Loader has its own ConfigHandler. // See the UnityExplorer.Loader namespace for the implementations. public static ConfigHandler Handler { get; private set; } public static ConfigElement Master_Toggle; public static ConfigElement Main_Navbar_Anchor; public static ConfigElement Force_Unlock_Mouse; public static ConfigElement Force_Unlock_Toggle; public static ConfigElement Aggressive_Mouse_Unlock; public static ConfigElement Disable_EventSystem_Override; public static ConfigElement Default_Output_Path; public static ConfigElement Log_Unity_Debug; public static ConfigElement Hide_On_Startup; public static ConfigElement Startup_Delay_Time; public static ConfigElement Reflection_Signature_Blacklist; // internal configs internal static InternalConfigHandler InternalHandler { get; private set; } public static ConfigElement ObjectExplorerData; public static ConfigElement InspectorData; public static ConfigElement CSConsoleData; public static ConfigElement OptionsPanelData; public static ConfigElement ConsoleLogData; public static ConfigElement HookManagerData; internal static readonly Dictionary ConfigElements = new Dictionary(); internal static readonly Dictionary InternalConfigs = new Dictionary(); public static void Init(ConfigHandler configHandler) { Handler = configHandler; Handler.Init(); InternalHandler = new InternalConfigHandler(); InternalHandler.Init(); CreateConfigElements(); Handler.LoadConfig(); InternalHandler.LoadConfig(); //InitConsoleCallback(); } internal static void RegisterConfigElement(ConfigElement configElement) { if (!configElement.IsInternal) { Handler.RegisterConfigElement(configElement); ConfigElements.Add(configElement.Name, configElement); } else { InternalHandler.RegisterConfigElement(configElement); InternalConfigs.Add(configElement.Name, configElement); } } private static void CreateConfigElements() { Master_Toggle = new ConfigElement("UnityExplorer Toggle", "The key to enable or disable UnityExplorer's menu and features.", KeyCode.F7); Main_Navbar_Anchor = new ConfigElement("Main Navbar Anchor", "The vertical anchor of the main UnityExplorer Navbar, in case you want to move it.", UIManager.VerticalAnchor.Top); Hide_On_Startup = new ConfigElement("Hide On Startup", "Should UnityExplorer be hidden on startup?", false); Force_Unlock_Mouse = new ConfigElement("Force Unlock Mouse", "Force the Cursor to be unlocked (visible) when the UnityExplorer menu is open.", true); Force_Unlock_Mouse.OnValueChanged += (bool value) => { UniverseLib.Config.ConfigManager.Force_Unlock_Mouse = value; }; Force_Unlock_Toggle = new ConfigElement("Force Unlock Toggle Key", "The keybind to toggle the 'Force Unlock Mouse' setting. Only usable when UnityExplorer is open.", KeyCode.None); Disable_EventSystem_Override = new ConfigElement("Disable EventSystem override", "If enabled, UnityExplorer will not override the EventSystem from the game.\nMay require restart to take effect.", false); Disable_EventSystem_Override.OnValueChanged += (bool value) => { UniverseLib.Config.ConfigManager.Disable_EventSystem_Override = value; }; Log_Unity_Debug = new ConfigElement("Log Unity Debug", "Should UnityEngine.Debug.Log messages be printed to UnityExplorer's log?", false); Default_Output_Path = new ConfigElement("Default Output Path", "The default output path when exporting things from UnityExplorer.", Path.Combine(ExplorerCore.Loader.ExplorerFolder, "Output")); Startup_Delay_Time = new ConfigElement("Startup Delay Time", "The delay on startup before the UI is created.", 1f); Reflection_Signature_Blacklist = new ConfigElement("Member Signature Blacklist", "Use this to blacklist certain member signatures if they are known to cause a crash or other issues.\r\n" + "Seperate signatures with a semicolon ';'.\r\n" + "For example, to blacklist Camera.main, you would add 'UnityEngine.Camera.main;'", ""); // Internal configs (panel save data) ObjectExplorerData = new ConfigElement("ObjectExplorer", "", "", true); InspectorData = new ConfigElement("Inspector", "", "", true); CSConsoleData = new ConfigElement("CSConsole", "", "", true); OptionsPanelData = new ConfigElement("OptionsPanel", "", "", true); ConsoleLogData = new ConfigElement("ConsoleLog", "", "", true); HookManagerData = new ConfigElement("HookManager", "", "", true); } } }