mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-16 00:07:52 +08:00
3.2.10
* The following preferences are now persistent between sessions: Active Menu Page, Scene Explorer Hide State, Debug Console Hide State * The "Resize Cursor" is now just a `↔` Text label instead of a sprite. * Added support for Unity 5.2+ games (previously was only supporting 5.6)
This commit is contained in:
@ -5,6 +5,8 @@ using IniParser;
|
||||
using IniParser.Parser;
|
||||
using UnityExplorer.UI;
|
||||
using System.Globalization;
|
||||
using UnityExplorer.Core.Inspectors;
|
||||
using UnityExplorer.UI.Main;
|
||||
|
||||
namespace UnityExplorer.Core.Config
|
||||
{
|
||||
@ -17,21 +19,17 @@ namespace UnityExplorer.Core.Config
|
||||
|
||||
internal static CultureInfo _enCulture = new CultureInfo("en-US");
|
||||
|
||||
static ExplorerConfig()
|
||||
{
|
||||
_parser.Configuration.CommentString = "#";
|
||||
|
||||
PanelDragger.OnFinishResize += PanelDragger_OnFinishResize;
|
||||
}
|
||||
|
||||
// Actual configs
|
||||
public KeyCode Main_Menu_Toggle = KeyCode.F7;
|
||||
public bool Force_Unlock_Mouse = true;
|
||||
public int Default_Page_Limit = 25;
|
||||
public string Default_Output_Path = Path.Combine(ExplorerCore.EXPLORER_FOLDER, "Output");
|
||||
public bool Log_Unity_Debug = false;
|
||||
public bool Hide_On_Startup = false;
|
||||
public string Window_Anchors = DEFAULT_WINDOW_ANCHORS;
|
||||
public KeyCode Main_Menu_Toggle = KeyCode.F7;
|
||||
public bool Force_Unlock_Mouse = true;
|
||||
public int Default_Page_Limit = 25;
|
||||
public string Default_Output_Path = Path.Combine(ExplorerCore.EXPLORER_FOLDER, "Output");
|
||||
public bool Log_Unity_Debug = false;
|
||||
public bool Hide_On_Startup = false;
|
||||
public string Window_Anchors = DEFAULT_WINDOW_ANCHORS;
|
||||
public int Active_Tab = 0;
|
||||
public bool DebugConsole_Hidden = false;
|
||||
public bool SceneExplorer_Hidden = false;
|
||||
|
||||
private const string DEFAULT_WINDOW_ANCHORS = "0.25,0.10,0.78,0.95";
|
||||
|
||||
@ -45,6 +43,12 @@ namespace UnityExplorer.Core.Config
|
||||
public static void OnLoad()
|
||||
{
|
||||
Instance = new ExplorerConfig();
|
||||
_parser.Configuration.CommentString = "#";
|
||||
|
||||
PanelDragger.OnFinishResize += PanelDragger_OnFinishResize;
|
||||
SceneExplorer.OnToggleShow += SceneExplorer_OnToggleShow;
|
||||
DebugConsole.OnToggleShow += DebugConsole_OnToggleShow;
|
||||
MainMenu.OnActiveTabChanged += MainMenu_OnActiveTabChanged;
|
||||
|
||||
if (LoadSettings())
|
||||
return;
|
||||
@ -86,6 +90,15 @@ namespace UnityExplorer.Core.Config
|
||||
case nameof(Window_Anchors):
|
||||
Instance.Window_Anchors = config.Value;
|
||||
break;
|
||||
case nameof(Active_Tab):
|
||||
Instance.Active_Tab = int.Parse(config.Value);
|
||||
break;
|
||||
case nameof(DebugConsole_Hidden):
|
||||
Instance.DebugConsole_Hidden = bool.Parse(config.Value);
|
||||
break;
|
||||
case nameof(SceneExplorer_Hidden):
|
||||
Instance.SceneExplorer_Hidden = bool.Parse(config.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,13 +112,16 @@ namespace UnityExplorer.Core.Config
|
||||
data.Sections.AddSection("Config");
|
||||
|
||||
var sec = data.Sections["Config"];
|
||||
sec.AddKey(nameof(Main_Menu_Toggle), Instance.Main_Menu_Toggle.ToString());
|
||||
sec.AddKey(nameof(Force_Unlock_Mouse), Instance.Force_Unlock_Mouse.ToString());
|
||||
sec.AddKey(nameof(Default_Page_Limit), Instance.Default_Page_Limit.ToString());
|
||||
sec.AddKey(nameof(Log_Unity_Debug), Instance.Log_Unity_Debug.ToString());
|
||||
sec.AddKey(nameof(Default_Output_Path), Instance.Default_Output_Path);
|
||||
sec.AddKey(nameof(Hide_On_Startup), Instance.Hide_On_Startup.ToString());
|
||||
sec.AddKey(nameof(Window_Anchors), GetWindowAnchorsString());
|
||||
sec.AddKey(nameof(Main_Menu_Toggle), Instance.Main_Menu_Toggle.ToString());
|
||||
sec.AddKey(nameof(Force_Unlock_Mouse), Instance.Force_Unlock_Mouse.ToString());
|
||||
sec.AddKey(nameof(Default_Page_Limit), Instance.Default_Page_Limit.ToString());
|
||||
sec.AddKey(nameof(Log_Unity_Debug), Instance.Log_Unity_Debug.ToString());
|
||||
sec.AddKey(nameof(Default_Output_Path), Instance.Default_Output_Path);
|
||||
sec.AddKey(nameof(Hide_On_Startup), Instance.Hide_On_Startup.ToString());
|
||||
sec.AddKey(nameof(Window_Anchors), GetWindowAnchorsString());
|
||||
sec.AddKey(nameof(Active_Tab), Instance.Active_Tab.ToString());
|
||||
sec.AddKey(nameof(DebugConsole_Hidden), Instance.DebugConsole_Hidden.ToString());
|
||||
sec.AddKey(nameof(SceneExplorer_Hidden), Instance.SceneExplorer_Hidden.ToString());
|
||||
|
||||
if (!Directory.Exists(ExplorerCore.Loader.ConfigFolder))
|
||||
Directory.CreateDirectory(ExplorerCore.Loader.ConfigFolder);
|
||||
@ -113,6 +129,24 @@ namespace UnityExplorer.Core.Config
|
||||
File.WriteAllText(INI_PATH, data.ToString());
|
||||
}
|
||||
|
||||
private static void SceneExplorer_OnToggleShow()
|
||||
{
|
||||
Instance.SceneExplorer_Hidden = SceneExplorer.UI.Hiding;
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private static void DebugConsole_OnToggleShow()
|
||||
{
|
||||
Instance.DebugConsole_Hidden = DebugConsole.Hiding;
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private static void MainMenu_OnActiveTabChanged(int page)
|
||||
{
|
||||
Instance.Active_Tab = page;
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
// ============ Window Anchors specific stuff ============== //
|
||||
|
||||
private static void PanelDragger_OnFinishResize()
|
||||
|
@ -224,8 +224,8 @@ namespace UnityExplorer.Core.Inspectors.Reflection
|
||||
var topGroup = topGroupObj.GetComponent<HorizontalLayoutGroup>();
|
||||
topGroup.childForceExpandHeight = false;
|
||||
topGroup.childForceExpandWidth = false;
|
||||
topGroup.childControlHeight = true;
|
||||
topGroup.childControlWidth = true;
|
||||
topGroup.SetChildControlHeight(true);
|
||||
topGroup.SetChildControlWidth(true);
|
||||
topGroup.spacing = 10;
|
||||
topGroup.padding.left = 3;
|
||||
topGroup.padding.right = 3;
|
||||
@ -243,8 +243,8 @@ namespace UnityExplorer.Core.Inspectors.Reflection
|
||||
var leftGroup = m_leftGroup.GetComponent<HorizontalLayoutGroup>();
|
||||
leftGroup.childForceExpandHeight = true;
|
||||
leftGroup.childForceExpandWidth = false;
|
||||
leftGroup.childControlHeight = true;
|
||||
leftGroup.childControlWidth = true;
|
||||
leftGroup.SetChildControlHeight(true);
|
||||
leftGroup.SetChildControlWidth(true);
|
||||
leftGroup.spacing = 4;
|
||||
|
||||
// member label
|
||||
@ -278,8 +278,8 @@ namespace UnityExplorer.Core.Inspectors.Reflection
|
||||
var rightGroup = m_rightGroup.GetComponent<VerticalLayoutGroup>();
|
||||
rightGroup.childForceExpandHeight = true;
|
||||
rightGroup.childForceExpandWidth = false;
|
||||
rightGroup.childControlHeight = true;
|
||||
rightGroup.childControlWidth = true;
|
||||
rightGroup.SetChildControlHeight(true);
|
||||
rightGroup.SetChildControlWidth(true);
|
||||
rightGroup.spacing = 2;
|
||||
rightGroup.padding.top = 4;
|
||||
rightGroup.padding.bottom = 2;
|
||||
|
@ -92,9 +92,9 @@ namespace UnityExplorer.Core.Inspectors.Reflection
|
||||
m_mainRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 25);
|
||||
var mainGroup = m_mainContent.GetComponent<VerticalLayoutGroup>();
|
||||
mainGroup.childForceExpandWidth = true;
|
||||
mainGroup.childControlWidth = true;
|
||||
mainGroup.SetChildControlWidth(true);
|
||||
mainGroup.childForceExpandHeight = true;
|
||||
mainGroup.childControlHeight = true;
|
||||
mainGroup.SetChildControlHeight(true);
|
||||
var mainLayout = m_mainContent.AddComponent<LayoutElement>();
|
||||
mainLayout.minHeight = 25;
|
||||
mainLayout.flexibleHeight = 9999;
|
||||
|
@ -296,7 +296,7 @@ namespace UnityExplorer.Core.Inspectors.Reflection
|
||||
|
||||
var scrollGroup = m_listContent.GetComponent<VerticalLayoutGroup>();
|
||||
scrollGroup.childForceExpandHeight = true;
|
||||
scrollGroup.childControlHeight = true;
|
||||
scrollGroup.SetChildControlHeight(true);
|
||||
scrollGroup.spacing = 2;
|
||||
scrollGroup.padding.top = 5;
|
||||
scrollGroup.padding.left = 5;
|
||||
|
@ -270,7 +270,7 @@ namespace UnityExplorer.Core.Inspectors.Reflection
|
||||
|
||||
var scrollGroup = m_listContent.GetComponent<VerticalLayoutGroup>();
|
||||
scrollGroup.childForceExpandHeight = true;
|
||||
scrollGroup.childControlHeight = true;
|
||||
scrollGroup.SetChildControlHeight(true);
|
||||
scrollGroup.spacing = 2;
|
||||
scrollGroup.padding.top = 5;
|
||||
scrollGroup.padding.left = 5;
|
||||
|
@ -98,8 +98,8 @@ namespace UnityExplorer.Core.Inspectors.Reflection
|
||||
var group = groupObj.GetComponent<VerticalLayoutGroup>();
|
||||
group.childForceExpandHeight = true;
|
||||
group.childForceExpandWidth = false;
|
||||
group.childControlHeight = true;
|
||||
group.childControlWidth = true;
|
||||
group.SetChildControlHeight(true);
|
||||
group.SetChildControlWidth(true);
|
||||
group.padding.top = 3;
|
||||
group.padding.left = 3;
|
||||
group.padding.right = 3;
|
||||
|
@ -155,9 +155,9 @@ namespace UnityExplorer.Core.Inspectors.Reflection
|
||||
hiddenLayout.flexibleWidth = 9000;
|
||||
var hiddenGroup = m_hiddenObj.AddComponent<HorizontalLayoutGroup>();
|
||||
hiddenGroup.childForceExpandWidth = true;
|
||||
hiddenGroup.childControlWidth = true;
|
||||
hiddenGroup.SetChildControlWidth(true);
|
||||
hiddenGroup.childForceExpandHeight = true;
|
||||
hiddenGroup.childControlHeight = true;
|
||||
hiddenGroup.SetChildControlHeight(true);
|
||||
|
||||
var inputObj = UIFactory.CreateInputField(m_hiddenObj, 14, 3);
|
||||
var inputLayout = inputObj.AddComponent<LayoutElement>();
|
||||
|
@ -308,9 +308,9 @@ namespace UnityExplorer.Core.Inspectors.Reflection
|
||||
mainRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 25);
|
||||
var mainGroup = m_valueContent.GetComponent<HorizontalLayoutGroup>();
|
||||
mainGroup.childForceExpandWidth = false;
|
||||
mainGroup.childControlWidth = true;
|
||||
mainGroup.SetChildControlWidth(true);
|
||||
mainGroup.childForceExpandHeight = false;
|
||||
mainGroup.childControlHeight = true;
|
||||
mainGroup.SetChildControlHeight(true);
|
||||
mainGroup.spacing = 4;
|
||||
mainGroup.childAlignment = TextAnchor.UpperLeft;
|
||||
var mainLayout = m_valueContent.AddComponent<LayoutElement>();
|
||||
|
@ -11,6 +11,7 @@ using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UnityExplorer.Core.Runtime.Il2Cpp
|
||||
{
|
||||
@ -107,7 +108,7 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp
|
||||
}
|
||||
}
|
||||
|
||||
public static class UnityEventExtensions
|
||||
public static class Il2CppExtensions
|
||||
{
|
||||
public static void AddListener(this UnityEvent action, Action listener)
|
||||
{
|
||||
@ -118,6 +119,9 @@ public static class UnityEventExtensions
|
||||
{
|
||||
action.AddListener(listener);
|
||||
}
|
||||
|
||||
public static void SetChildControlHeight(this HorizontalOrVerticalLayoutGroup group, bool value) => group.childControlHeight = value;
|
||||
public static void SetChildControlWidth(this HorizontalOrVerticalLayoutGroup group, bool value) => group.childControlWidth = value;
|
||||
}
|
||||
|
||||
#endif
|
@ -7,6 +7,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Core;
|
||||
using UnityExplorer.Core.CSharp;
|
||||
|
||||
@ -63,6 +64,26 @@ public static class MonoExtensions
|
||||
{
|
||||
sb.Remove(0, sb.Length);
|
||||
}
|
||||
|
||||
private static PropertyInfo pi_childControlHeight;
|
||||
|
||||
public static void SetChildControlHeight(this HorizontalOrVerticalLayoutGroup group, bool value)
|
||||
{
|
||||
if (pi_childControlHeight == null)
|
||||
pi_childControlHeight = group.GetType().GetProperty("childControlHeight");
|
||||
|
||||
pi_childControlHeight?.SetValue(group, value, null);
|
||||
}
|
||||
|
||||
private static PropertyInfo pi_childControlWidth;
|
||||
|
||||
public static void SetChildControlWidth(this HorizontalOrVerticalLayoutGroup group, bool value)
|
||||
{
|
||||
if (pi_childControlWidth == null)
|
||||
pi_childControlWidth = group.GetType().GetProperty("childControlWidth");
|
||||
|
||||
pi_childControlWidth?.SetValue(group, value, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -9,6 +9,7 @@ using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Core.Runtime;
|
||||
using UnityExplorer.UI.Main.Home;
|
||||
using UnityExplorer.Core.Config;
|
||||
|
||||
namespace UnityExplorer.Core.Inspectors
|
||||
{
|
||||
@ -58,14 +59,15 @@ namespace UnityExplorer.Core.Inspectors
|
||||
public void Init()
|
||||
{
|
||||
RefreshSceneSelector();
|
||||
|
||||
if (ExplorerConfig.Instance.SceneExplorer_Hidden)
|
||||
UI.ToggleShow();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (SceneExplorerUI.Hiding || Time.realtimeSinceStartup - m_timeOfLastSceneUpdate < UPDATE_INTERVAL)
|
||||
{
|
||||
if (UI.Hiding || Time.realtimeSinceStartup - m_timeOfLastSceneUpdate < UPDATE_INTERVAL)
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshSceneSelector();
|
||||
|
||||
|
Reference in New Issue
Block a user