mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 14:17:51 +08:00
1.8.21
* Fixed a bug when editing a Text Field and the input string is `null`. Only affected Il2Cpp games, appeared in 1.8.0. * Added a menu page for editing the Explorer Settings in-game, called `Options`. * Added a new setting for default Items per Page Limit (for all "Pages" in Explorer).
This commit is contained in:
parent
b4b5f1ec93
commit
748e0cabcb
@ -269,6 +269,7 @@ namespace Explorer
|
|||||||
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
|
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
|
||||||
GUILayout.Label($"[{i}]", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label($"[{i}]", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
|
|
||||||
|
GUI.skin.label.alignment = TextAnchor.MiddleLeft;
|
||||||
GUILayout.Label("Key:", new GUILayoutOption[] { GUILayout.Width(40) });
|
GUILayout.Label("Key:", new GUILayoutOption[] { GUILayout.Width(40) });
|
||||||
key.DrawValue(window, (window.width / 2) - 80f);
|
key.DrawValue(window, (window.width / 2) - 80f);
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ namespace Explorer
|
|||||||
|
|
||||||
public KeyCode Main_Menu_Toggle = KeyCode.F7;
|
public KeyCode Main_Menu_Toggle = KeyCode.F7;
|
||||||
public Vector2 Default_Window_Size = new Vector2(550, 700);
|
public Vector2 Default_Window_Size = new Vector2(550, 700);
|
||||||
|
public int Default_Page_Limit = 20;
|
||||||
|
|
||||||
public static void OnLoad()
|
public static void OnLoad()
|
||||||
{
|
{
|
||||||
|
@ -243,6 +243,7 @@
|
|||||||
<Compile Include="Extensions\ReflectionExtensions.cs" />
|
<Compile Include="Extensions\ReflectionExtensions.cs" />
|
||||||
<Compile Include="Helpers\InputHelper.cs" />
|
<Compile Include="Helpers\InputHelper.cs" />
|
||||||
<Compile Include="Menu\CursorControl.cs" />
|
<Compile Include="Menu\CursorControl.cs" />
|
||||||
|
<Compile Include="Menu\MainMenu\Pages\OptionsPage.cs" />
|
||||||
<Compile Include="Tests\TestClass.cs" />
|
<Compile Include="Tests\TestClass.cs" />
|
||||||
<Compile Include="UnstripFixes\GUIUnstrip.cs" />
|
<Compile Include="UnstripFixes\GUIUnstrip.cs" />
|
||||||
<Compile Include="UnstripFixes\Internal_LayoutUtility.cs" />
|
<Compile Include="UnstripFixes\Internal_LayoutUtility.cs" />
|
||||||
|
@ -5,7 +5,7 @@ namespace Explorer
|
|||||||
public class ExplorerCore
|
public class ExplorerCore
|
||||||
{
|
{
|
||||||
public const string NAME = "Explorer (" + PLATFORM + ", " + MODLOADER + ")";
|
public const string NAME = "Explorer (" + PLATFORM + ", " + MODLOADER + ")";
|
||||||
public const string VERSION = "1.8.2";
|
public const string VERSION = "1.8.21";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.explorer";
|
public const string GUID = "com.sinai.explorer";
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace Explorer
|
|||||||
CalculateMaxOffset();
|
CalculateMaxOffset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int m_itemsPerPage = 20;
|
private int m_itemsPerPage = ModConfig.Instance.Default_Page_Limit;
|
||||||
|
|
||||||
public int ItemCount
|
public int ItemCount
|
||||||
{
|
{
|
||||||
|
@ -17,11 +17,15 @@ namespace Explorer
|
|||||||
Pages.Add(new ScenePage());
|
Pages.Add(new ScenePage());
|
||||||
Pages.Add(new SearchPage());
|
Pages.Add(new SearchPage());
|
||||||
Pages.Add(new ConsolePage());
|
Pages.Add(new ConsolePage());
|
||||||
|
Pages.Add(new OptionsPage());
|
||||||
|
|
||||||
for (int i = 0; i < Pages.Count; i++)
|
for (int i = 0; i < Pages.Count; i++)
|
||||||
{
|
{
|
||||||
var page = Pages[i];
|
var page = Pages[i];
|
||||||
page.Init();
|
page.Init();
|
||||||
|
|
||||||
|
// If page failed to init, it will remove itself from the list. Lower the iterate counter.
|
||||||
|
if (!Pages.Contains(page)) i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
99
src/Menu/MainMenu/Pages/OptionsPage.cs
Normal file
99
src/Menu/MainMenu/Pages/OptionsPage.cs
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Explorer.Tests;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Explorer
|
||||||
|
{
|
||||||
|
public class OptionsPage : WindowPage
|
||||||
|
{
|
||||||
|
public override string Name => "Options";
|
||||||
|
|
||||||
|
public string toggleKeyInputString = "";
|
||||||
|
public Vector2 defaultSizeInputVector;
|
||||||
|
public int defaultPageLimit;
|
||||||
|
|
||||||
|
private CacheObjectBase toggleKeyInput;
|
||||||
|
private CacheObjectBase defaultSizeInput;
|
||||||
|
private CacheObjectBase defaultPageLimitInput;
|
||||||
|
|
||||||
|
public override void Init()
|
||||||
|
{
|
||||||
|
toggleKeyInputString = ModConfig.Instance.Main_Menu_Toggle.ToString();
|
||||||
|
toggleKeyInput = CacheFactory.GetTypeAndCacheObject(typeof(OptionsPage).GetField("toggleKeyInputString"), this);
|
||||||
|
|
||||||
|
defaultSizeInputVector = ModConfig.Instance.Default_Window_Size;
|
||||||
|
defaultSizeInput = CacheFactory.GetTypeAndCacheObject(typeof(OptionsPage).GetField("defaultSizeInputVector"), this);
|
||||||
|
|
||||||
|
defaultPageLimit = ModConfig.Instance.Default_Page_Limit;
|
||||||
|
defaultPageLimitInput = CacheFactory.GetTypeAndCacheObject(typeof(OptionsPage).GetField("defaultPageLimit"), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update() { }
|
||||||
|
|
||||||
|
public override void DrawWindow()
|
||||||
|
{
|
||||||
|
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
|
||||||
|
GUILayout.Label("<color=orange><size=16><b>Settings</b></size></color>", new GUILayoutOption[0]);
|
||||||
|
GUI.skin.label.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
|
GUILayout.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
|
||||||
|
GUILayout.Label($"Menu Toggle Key:", new GUILayoutOption[] { GUILayout.Width(215f) });
|
||||||
|
toggleKeyInput.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f);
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
|
||||||
|
GUILayout.Label($"Default Window Size:", new GUILayoutOption[] { GUILayout.Width(215f) });
|
||||||
|
defaultSizeInput.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f);
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
|
||||||
|
GUILayout.Label($"Default Items per Page:", new GUILayoutOption[] { GUILayout.Width(215f) });
|
||||||
|
defaultPageLimitInput.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f);
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
if (GUILayout.Button("<color=lime><b>Apply and Save</b></color>", new GUILayoutOption[0]))
|
||||||
|
{
|
||||||
|
ApplyAndSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
|
||||||
|
//GUIUnstrip.Space(10f);
|
||||||
|
|
||||||
|
//GUI.skin.label.alignment = TextAnchor.MiddleCenter;
|
||||||
|
//GUILayout.Label("<color=orange><size=16><b>Other</b></size></color>", new GUILayoutOption[0]);
|
||||||
|
//GUI.skin.label.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
|
//GUILayout.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);
|
||||||
|
|
||||||
|
//if (GUILayout.Button("Inspect Test Class", new GUILayoutOption[0]))
|
||||||
|
//{
|
||||||
|
// WindowManager.InspectObject(TestClass.Instance, out bool _);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//GUILayout.EndVertical();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyAndSave()
|
||||||
|
{
|
||||||
|
if (Enum.Parse(typeof(KeyCode), toggleKeyInputString) is KeyCode key)
|
||||||
|
{
|
||||||
|
ModConfig.Instance.Main_Menu_Toggle = key;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning($"Could not parse '{toggleKeyInputString}' to KeyCode!");
|
||||||
|
}
|
||||||
|
|
||||||
|
ModConfig.Instance.Default_Window_Size = defaultSizeInputVector;
|
||||||
|
ModConfig.Instance.Default_Page_Limit = defaultPageLimit;
|
||||||
|
|
||||||
|
ModConfig.SaveSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,7 +10,7 @@ namespace Explorer
|
|||||||
{
|
{
|
||||||
public static ScenePage Instance;
|
public static ScenePage Instance;
|
||||||
|
|
||||||
public override string Name { get => "Scene Explorer"; }
|
public override string Name { get => "Scenes"; }
|
||||||
|
|
||||||
public PageHelper Pages = new PageHelper();
|
public PageHelper Pages = new PageHelper();
|
||||||
|
|
||||||
|
@ -150,6 +150,7 @@ namespace Explorer
|
|||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
GUI.skin.label.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
return _rect;
|
return _rect;
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,8 @@ namespace Explorer.UnstripInternals
|
|||||||
|
|
||||||
public static string TextField(string text, GUILayoutOption[] options)
|
public static string TextField(string text, GUILayoutOption[] options)
|
||||||
{
|
{
|
||||||
|
text = text ?? "";
|
||||||
|
|
||||||
int controlID = GUIUtility.GetControlID(FocusType.Keyboard);
|
int controlID = GUIUtility.GetControlID(FocusType.Keyboard);
|
||||||
GUIContent guicontent = GUIContent.Temp(text);
|
GUIContent guicontent = GUIContent.Temp(text);
|
||||||
bool flag = GUIUtility.keyboardControl != controlID;
|
bool flag = GUIUtility.keyboardControl != controlID;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user