mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-22 16:42:38 +08:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
1c5306b7c8 | |||
ea1e183c4a | |||
8080129d58 | |||
4b8298fd2e | |||
ad055b4383 | |||
23483a6108 |
@ -6,6 +6,10 @@
|
||||
An in-game explorer and a suite of debugging tools for <a href="https://docs.unity3d.com/Manual/IL2CPP.html">IL2CPP</a> and <b>Mono</b> Unity games, to aid with modding development.
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Supports most Unity games from versions 5.2 to 2020+.
|
||||
</p>
|
||||
|
||||
## Releases [](../../releases/latest) [](../../releases) [](../../releases/latest)
|
||||
|
||||
| Mod Loader | IL2CPP | Mono |
|
||||
|
@ -19,6 +19,7 @@ namespace UnityExplorer.Core.Config
|
||||
|
||||
public static ConfigElement<KeyCode> Main_Menu_Toggle;
|
||||
public static ConfigElement<bool> Force_Unlock_Mouse;
|
||||
public static ConfigElement<bool> Aggressive_Force_Unlock;
|
||||
public static ConfigElement<MenuPages> Default_Tab;
|
||||
public static ConfigElement<int> Default_Page_Limit;
|
||||
public static ConfigElement<string> Default_Output_Path;
|
||||
@ -78,6 +79,10 @@ namespace UnityExplorer.Core.Config
|
||||
"Force the Cursor to be unlocked (visible) when the UnityExplorer menu is open.",
|
||||
true);
|
||||
|
||||
Aggressive_Force_Unlock = new ConfigElement<bool>("Aggressive Mouse Unlock",
|
||||
"Use WaitForEndOfFrame to aggressively force the Mouse to be unlocked (requires game restart).",
|
||||
false);
|
||||
|
||||
Default_Page_Limit = new ConfigElement<int>("Default Page Limit",
|
||||
"The default maximum number of elements per 'page' in UnityExplorer.",
|
||||
25);
|
||||
|
@ -7,6 +7,7 @@ using BF = System.Reflection.BindingFlags;
|
||||
using UnityExplorer.Core.Config;
|
||||
using UnityExplorer.Core;
|
||||
using UnityExplorer.UI;
|
||||
using System.Collections;
|
||||
#if ML
|
||||
using Harmony;
|
||||
#else
|
||||
@ -48,6 +49,34 @@ namespace UnityExplorer.Core.Input
|
||||
|
||||
Unlock = ConfigManager.Force_Unlock_Mouse.Value;
|
||||
ConfigManager.Force_Unlock_Mouse.OnValueChanged += (bool val) => { Unlock = val; };
|
||||
|
||||
if (ConfigManager.Aggressive_Force_Unlock.Value)
|
||||
SetupAggressiveUnlock();
|
||||
}
|
||||
|
||||
public static void SetupAggressiveUnlock()
|
||||
{
|
||||
try
|
||||
{
|
||||
RuntimeProvider.Instance.StartCoroutine(AggressiveUnlockCoroutine());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExplorerCore.LogWarning($"Exception setting up Aggressive Mouse Unlock: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame();
|
||||
|
||||
private static IEnumerator AggressiveUnlockCoroutine()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return _waitForEndOfFrame;
|
||||
|
||||
if (UIManager.ShowMenu)
|
||||
UpdateCursorControl();
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateCursorControl()
|
||||
|
@ -14,7 +14,7 @@ namespace UnityExplorer
|
||||
public class ExplorerCore
|
||||
{
|
||||
public const string NAME = "UnityExplorer";
|
||||
public const string VERSION = "3.3.12";
|
||||
public const string VERSION = "3.3.15";
|
||||
public const string AUTHOR = "Sinai";
|
||||
public const string GUID = "com.sinai.unityexplorer";
|
||||
|
||||
|
@ -199,23 +199,10 @@ The following helper methods are available:
|
||||
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 UpdateConsole()
|
||||
{
|
||||
if (s_copyPasteBuffer != null)
|
||||
{
|
||||
if (!IsUserCopyPasting())
|
||||
{
|
||||
OnInputChanged(s_copyPasteBuffer);
|
||||
|
||||
s_copyPasteBuffer = null;
|
||||
}
|
||||
}
|
||||
if (Time.time > s_timeOfLastInternalSet)
|
||||
Writing = false;
|
||||
|
||||
if (EnableCtrlRShortcut)
|
||||
{
|
||||
@ -274,6 +261,8 @@ The following helper methods are available:
|
||||
|
||||
public void UseAutocomplete(string suggestion)
|
||||
{
|
||||
Writing = true;
|
||||
|
||||
string input = InputField.text;
|
||||
input = input.Insert(m_lastCaretPos, suggestion);
|
||||
InputField.text = input;
|
||||
@ -288,20 +277,32 @@ The following helper methods are available:
|
||||
AutoCompleter.ClearAutocompletes();
|
||||
}
|
||||
|
||||
internal static string s_copyPasteBuffer;
|
||||
private static float s_timeOfLastUpdate;
|
||||
private static bool Writing
|
||||
{
|
||||
get => s_writing;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
s_timeOfLastInternalSet = Time.time;
|
||||
s_writing = value;
|
||||
}
|
||||
}
|
||||
private static bool s_writing;
|
||||
private static float s_timeOfLastInternalSet;
|
||||
|
||||
public void OnInputChanged(string newText, bool forceUpdate = false)
|
||||
{
|
||||
if (IsUserCopyPasting())
|
||||
{
|
||||
//Console.WriteLine("Copy+Paste detected!");
|
||||
s_copyPasteBuffer = newText;
|
||||
if (!Writing && Time.time <= s_timeOfLastUpdate)
|
||||
return;
|
||||
}
|
||||
|
||||
s_timeOfLastUpdate = Time.time;
|
||||
|
||||
if (EnableAutoIndent)
|
||||
UpdateIndent(newText);
|
||||
|
||||
Writing = true;
|
||||
|
||||
if (!forceUpdate && string.IsNullOrEmpty(newText))
|
||||
inputHighlightText.text = string.Empty;
|
||||
else
|
||||
@ -378,6 +379,8 @@ The following helper methods are available:
|
||||
|
||||
private void AutoIndentCaret()
|
||||
{
|
||||
Writing = true;
|
||||
|
||||
if (CurrentIndent > 0)
|
||||
{
|
||||
string indent = GetAutoIndentTab(CurrentIndent);
|
||||
|
Reference in New Issue
Block a user