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.Core.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 Main_Menu_Toggle; public static ConfigElement Force_Unlock_Mouse; public static ConfigElement Force_Unlock_Keybind; public static ConfigElement Aggressive_Force_Unlock; public static ConfigElement Default_Page_Limit; public static ConfigElement Default_Output_Path; public static ConfigElement Log_Unity_Debug; public static ConfigElement Hide_On_Startup; public static ConfigElement Startup_Delay_Time; // internal configs internal static InternalConfigHandler InternalHandler { get; private set; } public static ConfigElement ObjectExplorerData; public static ConfigElement InspectorData; public static ConfigElement CSConsoleData; 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() { Main_Menu_Toggle = new ConfigElement("Main Menu Toggle", "The UnityEngine.KeyCode to toggle the UnityExplorer Menu.", KeyCode.F7); 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_Keybind = new ConfigElement("Force Unlock Keybind", "The keybind to toggle the 'Force Unlock Mouse' setting. Only usable when UnityExplorer is open.", KeyCode.None); Aggressive_Force_Unlock = new ConfigElement("Aggressive Mouse Unlock", "Use WaitForEndOfFrame to aggressively force the Mouse to be unlocked (requires game restart).", false); Log_Unity_Debug = new ConfigElement("Log Unity Debug", "Should UnityEngine.Debug.Log messages be printed to UnityExplorer's log?", false); Default_Page_Limit = new ConfigElement("Default Page Limit", "The default maximum number of elements per 'page' in UnityExplorer.", 25); 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); // Internal configs ObjectExplorerData = new ConfigElement("ObjectExplorer", "", "", true); InspectorData = new ConfigElement("Inspector", "", "", true); CSConsoleData = new ConfigElement("CSConsole", "", "", true); } } }