2021-03-30 19:50:04 +11:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
2021-04-01 17:13:31 +11:00
|
|
|
|
using System.Runtime.InteropServices;
|
2021-03-30 19:50:04 +11:00
|
|
|
|
using System.Text;
|
|
|
|
|
using UnityEngine;
|
2021-04-16 17:49:19 +10:00
|
|
|
|
using UnityExplorer.UI;
|
2021-03-30 19:50:04 +11:00
|
|
|
|
|
|
|
|
|
namespace UnityExplorer.Core.Config
|
|
|
|
|
{
|
|
|
|
|
public static class ConfigManager
|
|
|
|
|
{
|
2021-03-30 21:23:45 +11:00
|
|
|
|
// Each Mod Loader has its own ConfigHandler.
|
2021-03-30 19:50:04 +11:00
|
|
|
|
// See the UnityExplorer.Loader namespace for the implementations.
|
2021-03-30 21:23:45 +11:00
|
|
|
|
public static ConfigHandler Handler { get; private set; }
|
2021-03-30 19:50:04 +11:00
|
|
|
|
|
2021-06-05 19:36:09 +10:00
|
|
|
|
public static ConfigElement<KeyCode> Master_Toggle;
|
2021-05-16 21:45:09 +10:00
|
|
|
|
public static ConfigElement<UIManager.VerticalAnchor> Main_Navbar_Anchor;
|
2021-06-05 19:36:09 +10:00
|
|
|
|
public static ConfigElement<bool> Force_Unlock_Mouse;
|
|
|
|
|
public static ConfigElement<KeyCode> Force_Unlock_Toggle;
|
|
|
|
|
public static ConfigElement<bool> Aggressive_Mouse_Unlock;
|
|
|
|
|
public static ConfigElement<bool> Disable_EventSystem_Override;
|
|
|
|
|
public static ConfigElement<string> Default_Output_Path;
|
|
|
|
|
public static ConfigElement<bool> Log_Unity_Debug;
|
|
|
|
|
public static ConfigElement<bool> Hide_On_Startup;
|
|
|
|
|
public static ConfigElement<float> Startup_Delay_Time;
|
2021-04-07 17:20:42 +10:00
|
|
|
|
|
2021-06-05 19:36:09 +10:00
|
|
|
|
public static ConfigElement<string> Reflection_Signature_Blacklist;
|
2021-05-13 23:02:46 +10:00
|
|
|
|
|
2021-04-16 17:49:19 +10:00
|
|
|
|
// internal configs
|
|
|
|
|
internal static InternalConfigHandler InternalHandler { get; private set; }
|
|
|
|
|
|
2021-04-29 21:01:08 +10:00
|
|
|
|
public static ConfigElement<string> ObjectExplorerData;
|
|
|
|
|
public static ConfigElement<string> InspectorData;
|
2021-04-30 21:34:50 +10:00
|
|
|
|
public static ConfigElement<string> CSConsoleData;
|
2021-05-13 23:02:46 +10:00
|
|
|
|
public static ConfigElement<string> OptionsPanelData;
|
|
|
|
|
public static ConfigElement<string> ConsoleLogData;
|
2021-09-06 23:04:40 +10:00
|
|
|
|
public static ConfigElement<string> HookManagerData;
|
2021-03-30 19:50:04 +11:00
|
|
|
|
|
|
|
|
|
internal static readonly Dictionary<string, IConfigElement> ConfigElements = new Dictionary<string, IConfigElement>();
|
2021-04-16 17:49:19 +10:00
|
|
|
|
internal static readonly Dictionary<string, IConfigElement> InternalConfigs = new Dictionary<string, IConfigElement>();
|
2021-03-30 19:50:04 +11:00
|
|
|
|
|
2021-03-30 21:23:45 +11:00
|
|
|
|
public static void Init(ConfigHandler configHandler)
|
2021-03-30 19:50:04 +11:00
|
|
|
|
{
|
|
|
|
|
Handler = configHandler;
|
|
|
|
|
Handler.Init();
|
|
|
|
|
|
2021-04-16 17:49:19 +10:00
|
|
|
|
InternalHandler = new InternalConfigHandler();
|
|
|
|
|
InternalHandler.Init();
|
|
|
|
|
|
2021-03-30 19:50:04 +11:00
|
|
|
|
CreateConfigElements();
|
|
|
|
|
|
|
|
|
|
Handler.LoadConfig();
|
2021-04-16 17:49:19 +10:00
|
|
|
|
InternalHandler.LoadConfig();
|
2021-03-30 19:50:04 +11:00
|
|
|
|
|
2021-04-16 17:49:19 +10:00
|
|
|
|
//InitConsoleCallback();
|
2021-03-30 19:50:04 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static void RegisterConfigElement<T>(ConfigElement<T> configElement)
|
|
|
|
|
{
|
2021-04-16 17:49:19 +10:00
|
|
|
|
if (!configElement.IsInternal)
|
|
|
|
|
{
|
|
|
|
|
Handler.RegisterConfigElement(configElement);
|
|
|
|
|
ConfigElements.Add(configElement.Name, configElement);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
InternalHandler.RegisterConfigElement(configElement);
|
|
|
|
|
InternalConfigs.Add(configElement.Name, configElement);
|
|
|
|
|
}
|
2021-03-30 19:50:04 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void CreateConfigElements()
|
|
|
|
|
{
|
2021-05-15 06:20:07 +10:00
|
|
|
|
Master_Toggle = new ConfigElement<KeyCode>("UnityExplorer Toggle",
|
|
|
|
|
"The key to enable or disable UnityExplorer's menu and features.",
|
2021-03-31 01:42:32 +11:00
|
|
|
|
KeyCode.F7);
|
|
|
|
|
|
2021-05-16 21:45:09 +10:00
|
|
|
|
Main_Navbar_Anchor = new ConfigElement<UIManager.VerticalAnchor>("Main Navbar Anchor",
|
|
|
|
|
"The vertical anchor of the main UnityExplorer Navbar, in case you want to move it.",
|
|
|
|
|
UIManager.VerticalAnchor.Top);
|
|
|
|
|
|
2021-03-31 01:42:32 +11:00
|
|
|
|
Hide_On_Startup = new ConfigElement<bool>("Hide On Startup",
|
|
|
|
|
"Should UnityExplorer be hidden on startup?",
|
|
|
|
|
false);
|
|
|
|
|
|
2021-04-16 18:24:31 +10:00
|
|
|
|
Force_Unlock_Mouse = new ConfigElement<bool>("Force Unlock Mouse",
|
|
|
|
|
"Force the Cursor to be unlocked (visible) when the UnityExplorer menu is open.",
|
|
|
|
|
true);
|
2021-12-02 18:35:46 +11:00
|
|
|
|
Force_Unlock_Mouse.OnValueChanged += (bool value) =>
|
|
|
|
|
{
|
|
|
|
|
UniverseLib.Config.ConfigManager.Force_Unlock_Mouse = value;
|
|
|
|
|
};
|
2021-04-16 18:24:31 +10:00
|
|
|
|
|
2021-05-13 23:02:46 +10:00
|
|
|
|
Force_Unlock_Toggle = new ConfigElement<KeyCode>("Force Unlock Toggle Key",
|
2021-04-16 18:24:31 +10:00
|
|
|
|
"The keybind to toggle the 'Force Unlock Mouse' setting. Only usable when UnityExplorer is open.",
|
2021-04-28 20:47:48 +10:00
|
|
|
|
KeyCode.None);
|
2021-04-16 18:24:31 +10:00
|
|
|
|
|
2021-05-26 18:02:10 +10:00
|
|
|
|
Disable_EventSystem_Override = new ConfigElement<bool>("Disable EventSystem override",
|
|
|
|
|
"If enabled, UnityExplorer will not override the EventSystem from the game.\n<b>May require restart to take effect.</b>",
|
2021-04-16 18:24:31 +10:00
|
|
|
|
false);
|
2021-12-02 18:35:46 +11:00
|
|
|
|
Disable_EventSystem_Override.OnValueChanged += (bool value) =>
|
|
|
|
|
{
|
|
|
|
|
UniverseLib.Config.ConfigManager.Disable_EventSystem_Override = value;
|
|
|
|
|
};
|
2021-04-16 18:24:31 +10:00
|
|
|
|
|
2021-03-31 01:42:32 +11:00
|
|
|
|
Log_Unity_Debug = new ConfigElement<bool>("Log Unity Debug",
|
|
|
|
|
"Should UnityEngine.Debug.Log messages be printed to UnityExplorer's log?",
|
2021-03-30 19:50:04 +11:00
|
|
|
|
false);
|
|
|
|
|
|
|
|
|
|
Default_Output_Path = new ConfigElement<string>("Default Output Path",
|
|
|
|
|
"The default output path when exporting things from UnityExplorer.",
|
2021-03-31 01:42:32 +11:00
|
|
|
|
Path.Combine(ExplorerCore.Loader.ExplorerFolder, "Output"));
|
2021-03-30 19:50:04 +11:00
|
|
|
|
|
2021-04-11 20:45:02 +10:00
|
|
|
|
Startup_Delay_Time = new ConfigElement<float>("Startup Delay Time",
|
|
|
|
|
"The delay on startup before the UI is created.",
|
|
|
|
|
1f);
|
|
|
|
|
|
2021-05-28 15:51:03 +10:00
|
|
|
|
Reflection_Signature_Blacklist = new ConfigElement<string>("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" +
|
2021-07-07 23:27:43 +10:00
|
|
|
|
"For example, to blacklist Camera.main, you would add 'UnityEngine.Camera.main;'",
|
2021-05-28 15:51:03 +10:00
|
|
|
|
"");
|
2021-05-13 23:02:46 +10:00
|
|
|
|
|
|
|
|
|
// Internal configs (panel save data)
|
2021-03-30 19:50:04 +11:00
|
|
|
|
|
2021-04-29 21:01:08 +10:00
|
|
|
|
ObjectExplorerData = new ConfigElement<string>("ObjectExplorer", "", "", true);
|
|
|
|
|
InspectorData = new ConfigElement<string>("Inspector", "", "", true);
|
2021-04-30 21:34:50 +10:00
|
|
|
|
CSConsoleData = new ConfigElement<string>("CSConsole", "", "", true);
|
2021-05-13 23:02:46 +10:00
|
|
|
|
OptionsPanelData = new ConfigElement<string>("OptionsPanel", "", "", true);
|
|
|
|
|
ConsoleLogData = new ConfigElement<string>("ConsoleLog", "", "", true);
|
2021-09-06 23:04:40 +10:00
|
|
|
|
HookManagerData = new ConfigElement<string>("HookManager", "", "", true);
|
2021-03-30 19:50:04 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|