mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 06:08:16 +08:00
3.1.10: Add "Hide on startup" config option
This commit is contained in:
parent
69912d7ea4
commit
2c95fec646
@ -24,7 +24,8 @@ namespace UnityExplorer.Config
|
|||||||
public int Default_Page_Limit = 25;
|
public int Default_Page_Limit = 25;
|
||||||
public string Default_Output_Path = ExplorerCore.EXPLORER_FOLDER + @"\Output";
|
public string Default_Output_Path = ExplorerCore.EXPLORER_FOLDER + @"\Output";
|
||||||
public bool Log_Unity_Debug = false;
|
public bool Log_Unity_Debug = false;
|
||||||
public bool Save_Logs_To_Disk = true;
|
public bool Hide_On_Startup = false;
|
||||||
|
//public bool Save_Logs_To_Disk = true;
|
||||||
|
|
||||||
public static event Action OnConfigChanged;
|
public static event Action OnConfigChanged;
|
||||||
|
|
||||||
@ -56,24 +57,27 @@ namespace UnityExplorer.Config
|
|||||||
{
|
{
|
||||||
switch (config.KeyName)
|
switch (config.KeyName)
|
||||||
{
|
{
|
||||||
case "Main_Menu_Toggle":
|
case nameof(Main_Menu_Toggle):
|
||||||
Instance.Main_Menu_Toggle = (KeyCode)Enum.Parse(typeof(KeyCode), config.Value);
|
Instance.Main_Menu_Toggle = (KeyCode)Enum.Parse(typeof(KeyCode), config.Value);
|
||||||
break;
|
break;
|
||||||
case "Force_Unlock_Mouse":
|
case nameof(Force_Unlock_Mouse):
|
||||||
Instance.Force_Unlock_Mouse = bool.Parse(config.Value);
|
Instance.Force_Unlock_Mouse = bool.Parse(config.Value);
|
||||||
break;
|
break;
|
||||||
case "Default_Page_Limit":
|
case nameof(Default_Page_Limit):
|
||||||
Instance.Default_Page_Limit = int.Parse(config.Value);
|
Instance.Default_Page_Limit = int.Parse(config.Value);
|
||||||
break;
|
break;
|
||||||
case "Log_Unity_Debug":
|
case nameof(Log_Unity_Debug):
|
||||||
Instance.Log_Unity_Debug = bool.Parse(config.Value);
|
Instance.Log_Unity_Debug = bool.Parse(config.Value);
|
||||||
break;
|
break;
|
||||||
case "Save_Logs_To_Disk":
|
case nameof(Default_Output_Path):
|
||||||
Instance.Save_Logs_To_Disk = bool.Parse(config.Value);
|
|
||||||
break;
|
|
||||||
case "Default_Output_Path":
|
|
||||||
Instance.Default_Output_Path = config.Value;
|
Instance.Default_Output_Path = config.Value;
|
||||||
break;
|
break;
|
||||||
|
case nameof(Hide_On_Startup):
|
||||||
|
Instance.Hide_On_Startup = bool.Parse(config.Value);
|
||||||
|
break;
|
||||||
|
//case nameof(Save_Logs_To_Disk):
|
||||||
|
// Instance.Save_Logs_To_Disk = bool.Parse(config.Value);
|
||||||
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,12 +91,13 @@ namespace UnityExplorer.Config
|
|||||||
data.Sections.AddSection("Config");
|
data.Sections.AddSection("Config");
|
||||||
|
|
||||||
var sec = data.Sections["Config"];
|
var sec = data.Sections["Config"];
|
||||||
sec.AddKey("Main_Menu_Toggle", Instance.Main_Menu_Toggle.ToString());
|
sec.AddKey(nameof(Main_Menu_Toggle), Instance.Main_Menu_Toggle.ToString());
|
||||||
sec.AddKey("Force_Unlock_Mouse", Instance.Force_Unlock_Mouse.ToString());
|
sec.AddKey(nameof(Force_Unlock_Mouse), Instance.Force_Unlock_Mouse.ToString());
|
||||||
sec.AddKey("Default_Page_Limit", Instance.Default_Page_Limit.ToString());
|
sec.AddKey(nameof(Default_Page_Limit), Instance.Default_Page_Limit.ToString());
|
||||||
sec.AddKey("Log_Unity_Debug", Instance.Log_Unity_Debug.ToString());
|
sec.AddKey(nameof(Log_Unity_Debug), Instance.Log_Unity_Debug.ToString());
|
||||||
sec.AddKey("Save_Logs_To_Disk", Instance.Save_Logs_To_Disk.ToString());
|
sec.AddKey(nameof(Default_Output_Path), Instance.Default_Output_Path);
|
||||||
sec.AddKey("Default_Output_Path", Instance.Default_Output_Path);
|
sec.AddKey(nameof(Hide_On_Startup), Instance.Hide_On_Startup.ToString());
|
||||||
|
//sec.AddKey("Save_Logs_To_Disk", Instance.Save_Logs_To_Disk.ToString());
|
||||||
|
|
||||||
File.WriteAllText(INI_PATH, data.ToString());
|
File.WriteAllText(INI_PATH, data.ToString());
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,14 @@ namespace UnityExplorer
|
|||||||
public class ExplorerCore
|
public class ExplorerCore
|
||||||
{
|
{
|
||||||
public const string NAME = "UnityExplorer";
|
public const string NAME = "UnityExplorer";
|
||||||
public const string VERSION = "3.1.9";
|
public const string VERSION = "3.1.10";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.unityexplorer";
|
public const string GUID = "com.sinai.unityexplorer";
|
||||||
|
|
||||||
#if ML
|
#if ML
|
||||||
public const string EXPLORER_FOLDER = @"Mods\UnityExplorer";
|
public static string EXPLORER_FOLDER = Path.Combine("Mods", NAME);
|
||||||
#elif BIE
|
#elif BIE
|
||||||
public static string EXPLORER_FOLDER = Path.Combine(BepInEx.Paths.ConfigPath, "UnityExplorer");
|
public static string EXPLORER_FOLDER = Path.Combine(BepInEx.Paths.ConfigPath, NAME);
|
||||||
#elif STANDALONE
|
#elif STANDALONE
|
||||||
public static string EXPLORER_FOLDER
|
public static string EXPLORER_FOLDER
|
||||||
{
|
{
|
||||||
@ -110,6 +110,10 @@ namespace UnityExplorer
|
|||||||
{
|
{
|
||||||
UIManager.Init();
|
UIManager.Init();
|
||||||
Log("Initialized UnityExplorer UI.");
|
Log("Initialized UnityExplorer UI.");
|
||||||
|
|
||||||
|
if (ModConfig.Instance.Hide_On_Startup)
|
||||||
|
ShowMenu = false;
|
||||||
|
|
||||||
// InspectorManager.Instance.Inspect(Tests.TestClass.Instance);
|
// InspectorManager.Instance.Inspect(Tests.TestClass.Instance);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -16,7 +16,7 @@ namespace UnityExplorer.UI.Modules
|
|||||||
public static DebugConsole Instance { get; private set; }
|
public static DebugConsole Instance { get; private set; }
|
||||||
|
|
||||||
public static bool LogUnity { get; set; } = ModConfig.Instance.Log_Unity_Debug;
|
public static bool LogUnity { get; set; } = ModConfig.Instance.Log_Unity_Debug;
|
||||||
public static bool SaveToDisk { get; set; } = ModConfig.Instance.Save_Logs_To_Disk;
|
//public static bool SaveToDisk { get; set; } = ModConfig.Instance.Save_Logs_To_Disk;
|
||||||
|
|
||||||
internal static StreamWriter s_streamWriter;
|
internal static StreamWriter s_streamWriter;
|
||||||
|
|
||||||
@ -49,8 +49,8 @@ namespace UnityExplorer.UI.Modules
|
|||||||
|
|
||||||
// set up IO
|
// set up IO
|
||||||
|
|
||||||
if (!SaveToDisk)
|
//if (!SaveToDisk)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
var path = ExplorerCore.EXPLORER_FOLDER + @"\Logs";
|
var path = ExplorerCore.EXPLORER_FOLDER + @"\Logs";
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
//using TMPro;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
@ -19,6 +18,7 @@ namespace UnityExplorer.UI.Modules
|
|||||||
private Toggle m_unlockMouseToggle;
|
private Toggle m_unlockMouseToggle;
|
||||||
private InputField m_pageLimitInput;
|
private InputField m_pageLimitInput;
|
||||||
private InputField m_defaultOutputInput;
|
private InputField m_defaultOutputInput;
|
||||||
|
private Toggle m_hideOnStartupToggle;
|
||||||
|
|
||||||
public override void Init()
|
public override void Init()
|
||||||
{
|
{
|
||||||
@ -27,26 +27,21 @@ namespace UnityExplorer.UI.Modules
|
|||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
// not needed?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnApply()
|
internal void OnApply()
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(m_keycodeInput.text) && Enum.Parse(typeof(KeyCode), m_keycodeInput.text) is KeyCode keyCode)
|
if (!string.IsNullOrEmpty(m_keycodeInput.text) && Enum.Parse(typeof(KeyCode), m_keycodeInput.text) is KeyCode keyCode)
|
||||||
{
|
|
||||||
ModConfig.Instance.Main_Menu_Toggle = keyCode;
|
ModConfig.Instance.Main_Menu_Toggle = keyCode;
|
||||||
}
|
|
||||||
|
|
||||||
ModConfig.Instance.Force_Unlock_Mouse = m_unlockMouseToggle.isOn;
|
ModConfig.Instance.Force_Unlock_Mouse = m_unlockMouseToggle.isOn;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(m_pageLimitInput.text) && int.TryParse(m_pageLimitInput.text, out int lim))
|
if (!string.IsNullOrEmpty(m_pageLimitInput.text) && int.TryParse(m_pageLimitInput.text, out int lim))
|
||||||
{
|
|
||||||
ModConfig.Instance.Default_Page_Limit = lim;
|
ModConfig.Instance.Default_Page_Limit = lim;
|
||||||
}
|
|
||||||
|
|
||||||
ModConfig.Instance.Default_Output_Path = m_defaultOutputInput.text;
|
ModConfig.Instance.Default_Output_Path = m_defaultOutputInput.text;
|
||||||
|
|
||||||
// todo default output path
|
ModConfig.Instance.Hide_On_Startup = m_hideOnStartupToggle.isOn;
|
||||||
|
|
||||||
ModConfig.SaveSettings();
|
ModConfig.SaveSettings();
|
||||||
ModConfig.InvokeConfigChanged();
|
ModConfig.InvokeConfigChanged();
|
||||||
@ -98,6 +93,7 @@ namespace UnityExplorer.UI.Modules
|
|||||||
ConstructMouseUnlockOpt(optionsGroupObj);
|
ConstructMouseUnlockOpt(optionsGroupObj);
|
||||||
ConstructPageLimitOpt(optionsGroupObj);
|
ConstructPageLimitOpt(optionsGroupObj);
|
||||||
ConstructOutputPathOpt(optionsGroupObj);
|
ConstructOutputPathOpt(optionsGroupObj);
|
||||||
|
ConstructHideOnStartupOpt(optionsGroupObj);
|
||||||
|
|
||||||
var applyBtnObj = UIFactory.CreateButton(Content, new Color(0.2f, 0.2f, 0.2f));
|
var applyBtnObj = UIFactory.CreateButton(Content, new Color(0.2f, 0.2f, 0.2f));
|
||||||
var applyText = applyBtnObj.GetComponentInChildren<Text>();
|
var applyText = applyBtnObj.GetComponentInChildren<Text>();
|
||||||
@ -113,10 +109,34 @@ namespace UnityExplorer.UI.Modules
|
|||||||
applyBtn.onClick.AddListener(OnApply);
|
applyBtn.onClick.AddListener(OnApply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ConstructHideOnStartupOpt(GameObject optionsGroupObj)
|
||||||
|
{
|
||||||
|
var rowObj = UIFactory.CreateHorizontalGroup(optionsGroupObj, new Color(1, 1, 1, 0));
|
||||||
|
var rowGroup = rowObj.GetComponent<HorizontalLayoutGroup>();
|
||||||
|
rowGroup.childControlWidth = true;
|
||||||
|
rowGroup.childForceExpandWidth = false;
|
||||||
|
rowGroup.childControlHeight = true;
|
||||||
|
rowGroup.childForceExpandHeight = true;
|
||||||
|
var groupLayout = rowObj.AddComponent<LayoutElement>();
|
||||||
|
groupLayout.minHeight = 25;
|
||||||
|
groupLayout.flexibleHeight = 0;
|
||||||
|
groupLayout.minWidth = 200;
|
||||||
|
groupLayout.flexibleWidth = 1000;
|
||||||
|
|
||||||
|
var labelObj = UIFactory.CreateLabel(rowObj, TextAnchor.MiddleLeft);
|
||||||
|
var labelText = labelObj.GetComponent<Text>();
|
||||||
|
labelText.text = "Hide UI on startup:";
|
||||||
|
var labelLayout = labelObj.AddComponent<LayoutElement>();
|
||||||
|
labelLayout.minWidth = 150;
|
||||||
|
labelLayout.minHeight = 25;
|
||||||
|
|
||||||
|
UIFactory.CreateToggle(rowObj, out m_hideOnStartupToggle, out Text toggleText);
|
||||||
|
m_hideOnStartupToggle.isOn = ModConfig.Instance.Hide_On_Startup;
|
||||||
|
toggleText.text = "";
|
||||||
|
}
|
||||||
|
|
||||||
internal void ConstructKeycodeOpt(GameObject parent)
|
internal void ConstructKeycodeOpt(GameObject parent)
|
||||||
{
|
{
|
||||||
//public KeyCode Main_Menu_Toggle = KeyCode.F7;
|
|
||||||
|
|
||||||
var rowObj = UIFactory.CreateHorizontalGroup(parent, new Color(1, 1, 1, 0));
|
var rowObj = UIFactory.CreateHorizontalGroup(parent, new Color(1, 1, 1, 0));
|
||||||
var rowGroup = rowObj.GetComponent<HorizontalLayoutGroup>();
|
var rowGroup = rowObj.GetComponent<HorizontalLayoutGroup>();
|
||||||
rowGroup.childControlWidth = true;
|
rowGroup.childControlWidth = true;
|
||||||
@ -146,8 +166,6 @@ namespace UnityExplorer.UI.Modules
|
|||||||
|
|
||||||
internal void ConstructMouseUnlockOpt(GameObject parent)
|
internal void ConstructMouseUnlockOpt(GameObject parent)
|
||||||
{
|
{
|
||||||
//public bool Force_Unlock_Mouse = true;
|
|
||||||
|
|
||||||
var rowObj = UIFactory.CreateHorizontalGroup(parent, new Color(1, 1, 1, 0));
|
var rowObj = UIFactory.CreateHorizontalGroup(parent, new Color(1, 1, 1, 0));
|
||||||
var rowGroup = rowObj.GetComponent<HorizontalLayoutGroup>();
|
var rowGroup = rowObj.GetComponent<HorizontalLayoutGroup>();
|
||||||
rowGroup.childControlWidth = true;
|
rowGroup.childControlWidth = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user