mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-16 00:07:52 +08:00
more progress
This commit is contained in:
@ -55,7 +55,7 @@ namespace UnityExplorer.UI.Inspectors.CacheObject
|
||||
this.FallbackType = returnType;
|
||||
this.MemberLabelText = SignatureHighlighter.ParseFullSyntax(declaringType, false, member);
|
||||
this.NameForFiltering = $"{declaringType.Name}.{member.Name}";
|
||||
this.TypeLabelText = SignatureHighlighter.HighlightTypeName(FallbackType, false);
|
||||
this.TypeLabelText = SignatureHighlighter.ParseFullType(FallbackType, false);
|
||||
this.ValueLabelText = GetValueLabel();
|
||||
}
|
||||
|
||||
@ -73,6 +73,9 @@ namespace UnityExplorer.UI.Inspectors.CacheObject
|
||||
{
|
||||
TryEvaluate();
|
||||
|
||||
if (!Value.IsNullOrDestroyed())
|
||||
Value = Value.TryCast();
|
||||
|
||||
ProcessOnEvaluate();
|
||||
}
|
||||
|
||||
@ -120,7 +123,7 @@ namespace UnityExplorer.UI.Inspectors.CacheObject
|
||||
switch (State)
|
||||
{
|
||||
case ValueState.NotEvaluated:
|
||||
return $"<i>{NOT_YET_EVAL} ({SignatureHighlighter.HighlightTypeName(FallbackType, true)})</i>";
|
||||
return $"<i>{NOT_YET_EVAL} ({SignatureHighlighter.ParseFullType(FallbackType, true)})</i>";
|
||||
case ValueState.Exception:
|
||||
return $"<i><color=red>{ReflectionUtility.ReflectionExToString(LastException)}</color></i>";
|
||||
case ValueState.Boolean:
|
||||
|
@ -124,7 +124,7 @@ namespace UnityExplorer.UI.Inspectors
|
||||
if (!compToStringCache.ContainsKey(type.AssemblyQualifiedName))
|
||||
{
|
||||
compToStringCache.Add(type.AssemblyQualifiedName,
|
||||
$"<color={SignatureHighlighter.NAMESPACE}>{type.Namespace}</color>.{SignatureHighlighter.HighlightTypeName(type)}");
|
||||
$"<color={SignatureHighlighter.NAMESPACE}>{type.Namespace}</color>.{SignatureHighlighter.ParseFullType(type)}");
|
||||
}
|
||||
|
||||
cell.Button.ButtonText.text = compToStringCache[type.AssemblyQualifiedName];
|
||||
|
@ -11,14 +11,12 @@ namespace UnityExplorer.UI.Inspectors
|
||||
public abstract class InspectorBase : IPooledObject
|
||||
{
|
||||
public bool IsActive { get; internal set; }
|
||||
public object InspectorTarget { get; internal set; }
|
||||
|
||||
public InspectorTab Tab { get; internal set; }
|
||||
|
||||
public abstract GameObject UIRoot { get; }
|
||||
|
||||
private static readonly Color _enabledTabColor = new Color(0.2f, 0.4f, 0.2f);
|
||||
private static readonly Color _disabledTabColor = new Color(0.25f, 0.25f, 0.25f);
|
||||
|
||||
public float DefaultHeight => -1f;
|
||||
public abstract GameObject CreateContent(GameObject parent);
|
||||
|
||||
@ -43,14 +41,14 @@ namespace UnityExplorer.UI.Inspectors
|
||||
|
||||
public virtual void OnSetActive()
|
||||
{
|
||||
RuntimeProvider.Instance.SetColorBlock(Tab.TabButton.Button, _enabledTabColor, _enabledTabColor * 1.2f);
|
||||
Tab.SetTabColor(true);
|
||||
UIRoot.SetActive(true);
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
public virtual void OnSetInactive()
|
||||
{
|
||||
RuntimeProvider.Instance.SetColorBlock(Tab.TabButton.Button, _disabledTabColor, _disabledTabColor * 1.2f);
|
||||
Tab.SetTabColor(false);
|
||||
UIRoot.SetActive(false);
|
||||
IsActive = false;
|
||||
}
|
||||
|
@ -23,12 +23,30 @@ namespace UnityExplorer.UI.Inspectors
|
||||
return;
|
||||
|
||||
obj = obj.TryCast();
|
||||
|
||||
if (TryFocusActiveInspector(obj))
|
||||
return;
|
||||
|
||||
if (obj is GameObject)
|
||||
CreateInspector<GameObjectInspector>(obj);
|
||||
else
|
||||
CreateInspector<ReflectionInspector>(obj);
|
||||
}
|
||||
|
||||
private static bool TryFocusActiveInspector(object target)
|
||||
{
|
||||
foreach (var inspector in Inspectors)
|
||||
{
|
||||
if (inspector.InspectorTarget.ReferenceEqual(target))
|
||||
{
|
||||
UIManager.SetPanelActive(UIManager.Panels.Inspector, true);
|
||||
SetInspectorActive(inspector);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void Inspect(Type type)
|
||||
{
|
||||
CreateInspector<ReflectionInspector>(type, true);
|
||||
@ -52,6 +70,7 @@ namespace UnityExplorer.UI.Inspectors
|
||||
{
|
||||
var inspector = Pool<T>.Borrow();
|
||||
Inspectors.Add(inspector);
|
||||
inspector.InspectorTarget = target;
|
||||
|
||||
UIManager.SetPanelActive(UIManager.Panels.Inspector, true);
|
||||
inspector.UIRoot.transform.SetParent(InspectorPanel.Instance.ContentHolder.transform, false);
|
||||
|
@ -21,9 +21,21 @@ namespace UnityExplorer.UI.Inspectors
|
||||
|
||||
public ButtonRef CloseButton;
|
||||
|
||||
private static readonly Color _enabledTabColor = new Color(0.15f, 0.22f, 0.15f);
|
||||
private static readonly Color _disabledTabColor = new Color(0.13f, 0.13f, 0.13f);
|
||||
|
||||
public void SetTabColor(bool active)
|
||||
{
|
||||
if (active)
|
||||
RuntimeProvider.Instance.SetColorBlock(TabButton.Button, _enabledTabColor, _enabledTabColor * 1.2f);
|
||||
else
|
||||
RuntimeProvider.Instance.SetColorBlock(TabButton.Button, _disabledTabColor, _disabledTabColor * 1.2f);
|
||||
}
|
||||
|
||||
public GameObject CreateContent(GameObject parent)
|
||||
{
|
||||
uiRoot = UIFactory.CreateHorizontalGroup(parent, "TabObject", true, true, true, true, 0, new Vector4(0, 0, 3, 0));
|
||||
uiRoot = UIFactory.CreateHorizontalGroup(parent, "TabObject", true, true, true, true, 0,
|
||||
new Vector4(0, 0, 3, 0), new Color(0.13f, 0.13f, 0.13f));
|
||||
UIFactory.SetLayoutElement(uiRoot, minWidth: 185, flexibleWidth: 0);
|
||||
uiRoot.AddComponent<Mask>();
|
||||
|
||||
|
@ -82,7 +82,7 @@ namespace UnityExplorer.UI.Inspectors
|
||||
asmText = $"{TargetType.Assembly.GetName().Name} <color=grey><i>(in memory)</i></color>";
|
||||
AssemblyText.text = $"<color=grey>Assembly:</color> {asmText}";
|
||||
|
||||
Tab.TabText.text = $"{prefix} {SignatureHighlighter.HighlightTypeName(TargetType)}";
|
||||
Tab.TabText.text = $"{prefix} {SignatureHighlighter.ParseFullType(TargetType)}";
|
||||
|
||||
this.members = CacheMember.GetCacheMembers(Target, TargetType, this);
|
||||
FilterMembers();
|
||||
|
Reference in New Issue
Block a user