This repository has been archived by the owner on May 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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).
- Loading branch information
Showing
10 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters