mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-09-20 13:36:01 +08:00
Fix onValueChanged bursts
This commit is contained in:
@ -14,7 +14,7 @@ namespace UnityExplorer
|
|||||||
public class ExplorerCore
|
public class ExplorerCore
|
||||||
{
|
{
|
||||||
public const string NAME = "UnityExplorer";
|
public const string NAME = "UnityExplorer";
|
||||||
public const string VERSION = "3.3.13";
|
public const string VERSION = "3.3.14";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.unityexplorer";
|
public const string GUID = "com.sinai.unityexplorer";
|
||||||
|
|
||||||
|
@ -199,23 +199,8 @@ 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 UpdateConsole()
|
public void UpdateConsole()
|
||||||
{
|
{
|
||||||
if (s_copyPasteBuffer != null)
|
|
||||||
{
|
|
||||||
if (!IsUserCopyPasting())
|
|
||||||
{
|
|
||||||
OnInputChanged(s_copyPasteBuffer);
|
|
||||||
|
|
||||||
s_copyPasteBuffer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EnableCtrlRShortcut)
|
if (EnableCtrlRShortcut)
|
||||||
{
|
{
|
||||||
@ -288,16 +273,14 @@ The following helper methods are available:
|
|||||||
AutoCompleter.ClearAutocompletes();
|
AutoCompleter.ClearAutocompletes();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string s_copyPasteBuffer;
|
private static float s_timeOfLastUpdate;
|
||||||
|
|
||||||
public void OnInputChanged(string newText, bool forceUpdate = false)
|
public void OnInputChanged(string newText, bool forceUpdate = false)
|
||||||
{
|
{
|
||||||
if (IsUserCopyPasting())
|
if (Time.time <= s_timeOfLastUpdate)
|
||||||
{
|
|
||||||
//Console.WriteLine("Copy+Paste detected!");
|
|
||||||
s_copyPasteBuffer = newText;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
s_timeOfLastUpdate = Time.time;
|
||||||
|
|
||||||
if (EnableAutoIndent)
|
if (EnableAutoIndent)
|
||||||
UpdateIndent(newText);
|
UpdateIndent(newText);
|
||||||
|
Reference in New Issue
Block a user