mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 14:17:51 +08:00
Use separate TypeCompleters for different contexts
This commit is contained in:
parent
14f46ade6a
commit
b5e3cc2ea5
@ -34,12 +34,15 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
private ScrollPool<ButtonCell> resultsScrollPool;
|
private ScrollPool<ButtonCell> resultsScrollPool;
|
||||||
private List<object> currentResults = new();
|
private List<object> currentResults = new();
|
||||||
|
|
||||||
|
//public TypeCompleter typeAutocompleter;
|
||||||
|
public TypeCompleter unityObjectTypeCompleter;
|
||||||
|
public TypeCompleter allTypesCompleter;
|
||||||
|
|
||||||
public override GameObject UIRoot => uiRoot;
|
public override GameObject UIRoot => uiRoot;
|
||||||
private GameObject uiRoot;
|
private GameObject uiRoot;
|
||||||
private GameObject sceneFilterRow;
|
private GameObject sceneFilterRow;
|
||||||
private GameObject childFilterRow;
|
private GameObject childFilterRow;
|
||||||
private GameObject classInputRow;
|
private GameObject classInputRow;
|
||||||
public TypeCompleter typeAutocompleter;
|
|
||||||
private GameObject nameInputRow;
|
private GameObject nameInputRow;
|
||||||
private InputFieldRef nameInputField;
|
private InputFieldRef nameInputField;
|
||||||
private Text resultsLabel;
|
private Text resultsLabel;
|
||||||
@ -98,14 +101,18 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
nameInputRow.SetActive(context == SearchContext.UnityObject);
|
nameInputRow.SetActive(context == SearchContext.UnityObject);
|
||||||
|
|
||||||
if (context == SearchContext.Class)
|
switch (context)
|
||||||
typeAutocompleter.AllTypes = true;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
typeAutocompleter.BaseType = context == SearchContext.UnityObject ? typeof(UnityEngine.Object) : typeof(object);
|
case SearchContext.UnityObject:
|
||||||
typeAutocompleter.AllTypes = false;
|
unityObjectTypeCompleter.Enabled = true;
|
||||||
|
allTypesCompleter.Enabled = false;
|
||||||
|
break;
|
||||||
|
case SearchContext.Singleton:
|
||||||
|
case SearchContext.Class:
|
||||||
|
allTypesCompleter.Enabled = true;
|
||||||
|
unityObjectTypeCompleter.Enabled = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
typeAutocompleter.CacheTypes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSceneFilterDropChanged(int value) => sceneFilter = (SceneFilter)value;
|
private void OnSceneFilterDropChanged(int value) => sceneFilter = (SceneFilter)value;
|
||||||
@ -185,7 +192,9 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
InputFieldRef classInputField = UIFactory.CreateInputField(classInputRow, "ClassInput", "...");
|
InputFieldRef classInputField = UIFactory.CreateInputField(classInputRow, "ClassInput", "...");
|
||||||
UIFactory.SetLayoutElement(classInputField.UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(classInputField.UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
typeAutocompleter = new TypeCompleter(typeof(UnityEngine.Object), classInputField);
|
unityObjectTypeCompleter = new(typeof(UnityEngine.Object), classInputField, true, false, true);
|
||||||
|
allTypesCompleter = new(null, classInputField, true, false, true);
|
||||||
|
allTypesCompleter.Enabled = false;
|
||||||
classInputField.OnValueChanged += OnTypeInputChanged;
|
classInputField.OnValueChanged += OnTypeInputChanged;
|
||||||
|
|
||||||
//unityObjectClassRow.SetActive(false);
|
//unityObjectClassRow.SetActive(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user