mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-17 22:48:04 +08:00
Fix the onValueChange throttling affecting internal features
This commit is contained in:
parent
ea1e183c4a
commit
1c5306b7c8
@ -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.14";
|
public const string VERSION = "3.3.15";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.unityexplorer";
|
public const string GUID = "com.sinai.unityexplorer";
|
||||||
|
|
||||||
|
@ -201,6 +201,8 @@ The following helper methods are available:
|
|||||||
|
|
||||||
public void UpdateConsole()
|
public void UpdateConsole()
|
||||||
{
|
{
|
||||||
|
if (Time.time > s_timeOfLastInternalSet)
|
||||||
|
Writing = false;
|
||||||
|
|
||||||
if (EnableCtrlRShortcut)
|
if (EnableCtrlRShortcut)
|
||||||
{
|
{
|
||||||
@ -259,6 +261,8 @@ The following helper methods are available:
|
|||||||
|
|
||||||
public void UseAutocomplete(string suggestion)
|
public void UseAutocomplete(string suggestion)
|
||||||
{
|
{
|
||||||
|
Writing = true;
|
||||||
|
|
||||||
string input = InputField.text;
|
string input = InputField.text;
|
||||||
input = input.Insert(m_lastCaretPos, suggestion);
|
input = input.Insert(m_lastCaretPos, suggestion);
|
||||||
InputField.text = input;
|
InputField.text = input;
|
||||||
@ -274,10 +278,22 @@ The following helper methods are available:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static float s_timeOfLastUpdate;
|
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)
|
public void OnInputChanged(string newText, bool forceUpdate = false)
|
||||||
{
|
{
|
||||||
if (Time.time <= s_timeOfLastUpdate)
|
if (!Writing && Time.time <= s_timeOfLastUpdate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_timeOfLastUpdate = Time.time;
|
s_timeOfLastUpdate = Time.time;
|
||||||
@ -285,6 +301,8 @@ The following helper methods are available:
|
|||||||
if (EnableAutoIndent)
|
if (EnableAutoIndent)
|
||||||
UpdateIndent(newText);
|
UpdateIndent(newText);
|
||||||
|
|
||||||
|
Writing = true;
|
||||||
|
|
||||||
if (!forceUpdate && string.IsNullOrEmpty(newText))
|
if (!forceUpdate && string.IsNullOrEmpty(newText))
|
||||||
inputHighlightText.text = string.Empty;
|
inputHighlightText.text = string.Empty;
|
||||||
else
|
else
|
||||||
@ -361,6 +379,8 @@ The following helper methods are available:
|
|||||||
|
|
||||||
private void AutoIndentCaret()
|
private void AutoIndentCaret()
|
||||||
{
|
{
|
||||||
|
Writing = true;
|
||||||
|
|
||||||
if (CurrentIndent > 0)
|
if (CurrentIndent > 0)
|
||||||
{
|
{
|
||||||
string indent = GetAutoIndentTab(CurrentIndent);
|
string indent = GetAutoIndentTab(CurrentIndent);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user