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-04-07 17:20:42 +10:00
|
|
|
|
public static ConfigElement<KeyCode> Main_Menu_Toggle;
|
|
|
|
|
public static ConfigElement<bool> Force_Unlock_Mouse;
|
2021-04-16 18:24:31 +10:00
|
|
|
|
public static ConfigElement<KeyCode> Force_Unlock_Keybind;
|
|
|
|
|
public static ConfigElement<bool> Aggressive_Force_Unlock;
|
2021-04-07 17:20:42 +10:00
|
|
|
|
public static ConfigElement<int> Default_Page_Limit;
|
|
|
|
|
public static ConfigElement<string> Default_Output_Path;
|
|
|
|
|
public static ConfigElement<bool> Log_Unity_Debug;
|
|
|
|
|
public static ConfigElement<bool> Hide_On_Startup;
|
2021-04-11 20:45:02 +10:00
|
|
|
|
public static ConfigElement<float> Startup_Delay_Time;
|
2021-04-07 17:20:42 +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-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()
|
|
|
|
|
{
|
|
|
|
|
Main_Menu_Toggle = new ConfigElement<KeyCode>("Main Menu Toggle",
|
|
|
|
|
"The UnityEngine.KeyCode to toggle the UnityExplorer Menu.",
|
2021-03-31 01:42:32 +11:00
|
|
|
|
KeyCode.F7);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
Force_Unlock_Keybind = new ConfigElement<KeyCode>("Force Unlock Keybind",
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
Aggressive_Force_Unlock = new ConfigElement<bool>("Aggressive Mouse Unlock",
|
2021-04-29 21:01:08 +10:00
|
|
|
|
"Use WaitForEndOfFrame to aggressively force the Mouse to be unlocked (requires game restart).",
|
2021-04-16 18:24:31 +10:00
|
|
|
|
false);
|
|
|
|
|
|
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_Page_Limit = new ConfigElement<int>("Default Page Limit",
|
|
|
|
|
"The default maximum number of elements per 'page' in UnityExplorer.",
|
2021-03-31 01:42:32 +11:00
|
|
|
|
25);
|
2021-03-30 19:50:04 +11:00
|
|
|
|
|
|
|
|
|
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-03-31 01:42:32 +11:00
|
|
|
|
// Internal configs
|
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-03-30 19:50:04 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|