mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-04 04:22:53 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
995e2a3e93 | |||
2c95fec646 | |||
69912d7ea4 | |||
9c5596ace4 |
BIN
lib/0Harmony.dll
BIN
lib/0Harmony.dll
Binary file not shown.
BIN
lib/BepInEx.dll
BIN
lib/BepInEx.dll
Binary file not shown.
Binary file not shown.
@ -32,7 +32,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
private Text inputHighlightText;
|
private Text inputHighlightText;
|
||||||
|
|
||||||
private readonly CSharpLexer highlightLexer;
|
private readonly CSharpLexer highlightLexer;
|
||||||
private readonly StringBuilder sbHighlight;
|
//private readonly StringBuilder sbHighlight;
|
||||||
|
|
||||||
internal int m_lastCaretPos;
|
internal int m_lastCaretPos;
|
||||||
internal int m_fixCaretPos;
|
internal int m_fixCaretPos;
|
||||||
@ -68,7 +68,6 @@ The following helper methods are available:
|
|||||||
|
|
||||||
public CodeEditor()
|
public CodeEditor()
|
||||||
{
|
{
|
||||||
sbHighlight = new StringBuilder();
|
|
||||||
highlightLexer = new CSharpLexer();
|
highlightLexer = new CSharpLexer();
|
||||||
|
|
||||||
ConstructUI();
|
ConstructUI();
|
||||||
@ -76,8 +75,24 @@ The following helper methods are available:
|
|||||||
InputField.onValueChanged.AddListener((string s) => { OnInputChanged(s); });
|
InputField.onValueChanged.AddListener((string s) => { OnInputChanged(s); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static bool IsUserCopyPasting()
|
||||||
|
{
|
||||||
|
return (InputManager.GetKey(KeyCode.LeftControl) || InputManager.GetKey(KeyCode.RightControl))
|
||||||
|
&& InputManager.GetKeyDown(KeyCode.V);
|
||||||
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
|
if (s_copyPasteBuffer != null)
|
||||||
|
{
|
||||||
|
if (!IsUserCopyPasting())
|
||||||
|
{
|
||||||
|
OnInputChanged(s_copyPasteBuffer);
|
||||||
|
|
||||||
|
s_copyPasteBuffer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (EnableCtrlRShortcut)
|
if (EnableCtrlRShortcut)
|
||||||
{
|
{
|
||||||
if ((InputManager.GetKey(KeyCode.LeftControl) || InputManager.GetKey(KeyCode.RightControl))
|
if ((InputManager.GetKey(KeyCode.LeftControl) || InputManager.GetKey(KeyCode.RightControl))
|
||||||
@ -149,11 +164,18 @@ The following helper methods are available:
|
|||||||
AutoCompleter.ClearAutocompletes();
|
AutoCompleter.ClearAutocompletes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnInputChanged(string newInput, bool forceUpdate = false)
|
internal static string s_copyPasteBuffer;
|
||||||
{
|
|
||||||
string newText = newInput;
|
|
||||||
|
|
||||||
UpdateIndent(newInput);
|
public void OnInputChanged(string newText, bool forceUpdate = false)
|
||||||
|
{
|
||||||
|
if (IsUserCopyPasting())
|
||||||
|
{
|
||||||
|
//Console.WriteLine("Copy+Paste detected!");
|
||||||
|
s_copyPasteBuffer = newText;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateIndent(newText);
|
||||||
|
|
||||||
if (!forceUpdate && string.IsNullOrEmpty(newText))
|
if (!forceUpdate && string.IsNullOrEmpty(newText))
|
||||||
inputHighlightText.text = string.Empty;
|
inputHighlightText.text = string.Empty;
|
||||||
@ -203,35 +225,29 @@ The following helper methods are available:
|
|||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
sbHighlight.Length = 0;
|
//Console.WriteLine("Highlighting input text:\r\n" + inputText);
|
||||||
|
|
||||||
|
string ret = "";
|
||||||
|
|
||||||
foreach (LexerMatchInfo match in highlightLexer.GetMatches(inputText))
|
foreach (LexerMatchInfo match in highlightLexer.GetMatches(inputText))
|
||||||
{
|
{
|
||||||
for (int i = offset; i < match.startIndex; i++)
|
for (int i = offset; i < match.startIndex; i++)
|
||||||
{
|
ret += inputText[i];
|
||||||
sbHighlight.Append(inputText[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
sbHighlight.Append($"{match.htmlColor}");
|
ret += $"{match.htmlColor}";
|
||||||
|
|
||||||
for (int i = match.startIndex; i < match.endIndex; i++)
|
for (int i = match.startIndex; i < match.endIndex; i++)
|
||||||
{
|
ret += inputText[i];
|
||||||
sbHighlight.Append(inputText[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
sbHighlight.Append(CLOSE_COLOR_TAG);
|
ret += CLOSE_COLOR_TAG;
|
||||||
|
|
||||||
offset = match.endIndex;
|
offset = match.endIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = offset; i < inputText.Length; i++)
|
for (int i = offset; i < inputText.Length; i++)
|
||||||
{
|
ret += inputText[i];
|
||||||
sbHighlight.Append(inputText[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inputText = sbHighlight.ToString();
|
return ret;
|
||||||
|
|
||||||
return inputText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AutoIndentCaret()
|
private void AutoIndentCaret()
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
@ -4,27 +4,25 @@ using System.Reflection;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.Input;
|
using UnityExplorer.Input;
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Modules;
|
using UnityExplorer.UI.Modules;
|
||||||
#if CPP
|
|
||||||
using UnityExplorer.Helpers;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace UnityExplorer
|
namespace UnityExplorer
|
||||||
{
|
{
|
||||||
public class ExplorerCore
|
public class ExplorerCore
|
||||||
{
|
{
|
||||||
public const string NAME = "UnityExplorer";
|
public const string NAME = "UnityExplorer";
|
||||||
public const string VERSION = "3.1.8";
|
public const string VERSION = "3.1.11";
|
||||||
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
|
||||||
{
|
{
|
||||||
@ -112,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)
|
||||||
|
@ -55,16 +55,15 @@ namespace UnityExplorer.Inspectors
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!m_dontDestroyObject)
|
if (!s_dontDestroyObject)
|
||||||
{
|
{
|
||||||
m_dontDestroyObject = new GameObject("DontDestroyMe");
|
s_dontDestroyObject = new GameObject("DontDestroyMe");
|
||||||
GameObject.DontDestroyOnLoad(m_dontDestroyObject);
|
GameObject.DontDestroyOnLoad(s_dontDestroyObject);
|
||||||
}
|
}
|
||||||
return m_dontDestroyObject;
|
return s_dontDestroyObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
internal static GameObject s_dontDestroyObject;
|
||||||
internal static GameObject m_dontDestroyObject;
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
@ -97,22 +96,6 @@ namespace UnityExplorer.Inspectors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if CPP
|
|
||||||
// public int GetSceneHandle(string sceneName)
|
|
||||||
// {
|
|
||||||
// if (sceneName == "DontDestroyOnLoad")
|
|
||||||
// return DontDestroyScene;
|
|
||||||
|
|
||||||
// for (int i = 0; i < SceneManager.sceneCount; i++)
|
|
||||||
// {
|
|
||||||
// var scene = SceneManager.GetSceneAt(i);
|
|
||||||
// if (scene.name == sceneName)
|
|
||||||
// return scene.handle;
|
|
||||||
// }
|
|
||||||
// return -1;
|
|
||||||
// }
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
internal void OnSceneChange()
|
internal void OnSceneChange()
|
||||||
{
|
{
|
||||||
m_sceneDropdown.OnCancel(null);
|
m_sceneDropdown.OnCancel(null);
|
||||||
@ -121,8 +104,13 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void RefreshSceneSelector()
|
private void RefreshSceneSelector()
|
||||||
{
|
{
|
||||||
var names = new List<string>();
|
var newNames = new List<string>();
|
||||||
var scenes = new List<Scene>();
|
var newScenes = new List<Scene>();
|
||||||
|
|
||||||
|
if (m_currentScenes == null)
|
||||||
|
m_currentScenes = new Scene[0];
|
||||||
|
|
||||||
|
bool anyChange = SceneManager.sceneCount != m_currentScenes.Length - 1;
|
||||||
|
|
||||||
for (int i = 0; i < SceneManager.sceneCount; i++)
|
for (int i = 0; i < SceneManager.sceneCount; i++)
|
||||||
{
|
{
|
||||||
@ -131,33 +119,32 @@ namespace UnityExplorer.Inspectors
|
|||||||
if (scene == default)
|
if (scene == default)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
scenes.Add(scene);
|
if (!anyChange && !m_currentScenes.Any(it => it.GetHandle() == scene.GetHandle()))
|
||||||
names.Add(scene.name);
|
anyChange = true;
|
||||||
|
|
||||||
|
newScenes.Add(scene);
|
||||||
|
newNames.Add(scene.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
names.Add("DontDestroyOnLoad");
|
newNames.Add("DontDestroyOnLoad");
|
||||||
scenes.Add(DontDestroyScene);
|
newScenes.Add(DontDestroyScene);
|
||||||
|
|
||||||
m_sceneDropdown.options.Clear();
|
m_sceneDropdown.options.Clear();
|
||||||
|
|
||||||
foreach (string scene in names)
|
foreach (string scene in newNames)
|
||||||
{
|
{
|
||||||
m_sceneDropdown.options.Add(new Dropdown.OptionData { text = scene });
|
m_sceneDropdown.options.Add(new Dropdown.OptionData { text = scene });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!names.Contains(m_sceneDropdownText.text))
|
if (anyChange)
|
||||||
{
|
{
|
||||||
m_sceneDropdownText.text = names[0];
|
m_sceneDropdownText.text = newNames[0];
|
||||||
SetTargetScene(scenes[0]);
|
SetTargetScene(newScenes[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentScenes = scenes.ToArray();
|
m_currentScenes = newScenes.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if CPP
|
|
||||||
// public void SetTargetScene(string name) => SetTargetScene(scene.handle);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
public void SetTargetScene(Scene scene)
|
public void SetTargetScene(Scene scene)
|
||||||
{
|
{
|
||||||
if (scene == default)
|
if (scene == default)
|
||||||
@ -167,7 +154,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
#if CPP
|
#if CPP
|
||||||
GameObject[] rootObjs = SceneUnstrip.GetRootGameObjects(scene.handle);
|
GameObject[] rootObjs = SceneUnstrip.GetRootGameObjects(scene.handle);
|
||||||
#else
|
#else
|
||||||
GameObject[] rootObjs = SceneUnstrip.GetRootGameObjects(scene);
|
GameObject[] rootObjs = scene.GetRootGameObjects();
|
||||||
#endif
|
#endif
|
||||||
SetSceneObjectList(rootObjs);
|
SetSceneObjectList(rootObjs);
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -3,36 +3,25 @@ using UnityExplorer.Helpers;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace UnityExplorer.Unstrip
|
namespace UnityExplorer.Unstrip
|
||||||
{
|
{
|
||||||
public class SceneUnstrip
|
public static class SceneUnstrip
|
||||||
{
|
{
|
||||||
#if MONO
|
#if MONO
|
||||||
public static GameObject[] GetRootGameObjects(Scene scene) => scene.GetRootGameObjects();
|
private static readonly FieldInfo fi_Scene_handle = typeof(Scene).GetField("m_Handle", ReflectionHelpers.CommonFlags);
|
||||||
|
|
||||||
//public static GameObject[] GetRootGameObjects(int handle)
|
|
||||||
//{
|
|
||||||
// Scene scene = default;
|
|
||||||
// if (handle == SceneExplorer.DontDestroyHandle)
|
|
||||||
// scene = SceneExplorer.DontDestroyObject.scene;
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// for (int i = 0; i < SceneManager.sceneCount; i++)
|
|
||||||
// {
|
|
||||||
// var iscene = SceneManager.GetSceneAt(i);
|
|
||||||
// if (iscene.handle == handle)
|
|
||||||
// scene = iscene;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (scene != default && scene.handle != -1)
|
|
||||||
// return scene.GetRootGameObjects();
|
|
||||||
|
|
||||||
// return new GameObject[0];
|
|
||||||
//}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
public static int GetHandle(this Scene scene)
|
||||||
|
{
|
||||||
|
#if CPP
|
||||||
|
return scene.handle;
|
||||||
|
#else
|
||||||
|
return (int)fi_Scene_handle.GetValue(scene);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if CPP
|
#if CPP
|
||||||
//Scene.GetRootGameObjects();
|
//Scene.GetRootGameObjects();
|
||||||
|
|
||||||
@ -43,13 +32,16 @@ namespace UnityExplorer.Unstrip
|
|||||||
public static GameObject[] GetRootGameObjects(int handle)
|
public static GameObject[] GetRootGameObjects(int handle)
|
||||||
{
|
{
|
||||||
if (handle == -1)
|
if (handle == -1)
|
||||||
{
|
|
||||||
return new GameObject[0];
|
return new GameObject[0];
|
||||||
}
|
|
||||||
|
|
||||||
Il2CppSystem.Collections.Generic.List<GameObject> list = new Il2CppSystem.Collections.Generic.List<GameObject>(GetRootCount(handle));
|
int count = GetRootCount(handle);
|
||||||
|
|
||||||
d_GetRootGameObjects iCall = ICallHelper.GetICall<d_GetRootGameObjects>("UnityEngine.SceneManagement.Scene::GetRootGameObjectsInternal");
|
if (count < 1)
|
||||||
|
return new GameObject[0];
|
||||||
|
|
||||||
|
var list = new Il2CppSystem.Collections.Generic.List<GameObject>(count);
|
||||||
|
|
||||||
|
var iCall = ICallHelper.GetICall<d_GetRootGameObjects>("UnityEngine.SceneManagement.Scene::GetRootGameObjectsInternal");
|
||||||
|
|
||||||
iCall.Invoke(handle, list.Pointer);
|
iCall.Invoke(handle, list.Pointer);
|
||||||
|
|
||||||
@ -58,14 +50,14 @@ namespace UnityExplorer.Unstrip
|
|||||||
|
|
||||||
//Scene.rootCount;
|
//Scene.rootCount;
|
||||||
|
|
||||||
internal delegate int GetRootCountInternal_delegate(int handle);
|
internal delegate int d_GetRootCountInternal(int handle);
|
||||||
|
|
||||||
public static int GetRootCount(Scene scene) => GetRootCount(scene.handle);
|
public static int GetRootCount(Scene scene) => GetRootCount(scene.handle);
|
||||||
|
|
||||||
public static int GetRootCount(int handle)
|
public static int GetRootCount(int handle)
|
||||||
{
|
{
|
||||||
GetRootCountInternal_delegate iCall = ICallHelper.GetICall<GetRootCountInternal_delegate>("UnityEngine.SceneManagement.Scene::GetRootCountInternal");
|
return ICallHelper.GetICall<d_GetRootCountInternal>("UnityEngine.SceneManagement.Scene::GetRootCountInternal")
|
||||||
return iCall.Invoke(handle);
|
.Invoke(handle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user