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