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 Default_Tab; 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 SceneExplorerData; public static ConfigElement GameObjectInspectorData; public static ConfigElement MainWindowData; public static ConfigElement DebugConsoleData; 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); //Default_Tab = new ConfigElement("Default Tab", // "The default menu page when starting the game.", // MenuPages.Home); Log_Unity_Debug = new ConfigElement("Log Unity Debug", "Should UnityEngine.Debug.Log messages be printed to UnityExplorer's log?", false); Force_Unlock_Mouse = new ConfigElement("Force Unlock Mouse", "Force the Cursor to be unlocked (visible) when the UnityExplorer menu is open.", true); 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 SceneExplorerData = new ConfigElement("SceneExplorer", "", "", true); GameObjectInspectorData = new ConfigElement("GameObjectInspector", "", "", true); MainWindowData = new ConfigElement("MainWindow", "", "", true); DebugConsoleData = new ConfigElement("DebugConsole", "", "", true); } } }