mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-15 22:07:48 +08:00
Cleanup
This commit is contained in:
parent
ad5fc04a3b
commit
939861b5f0
@ -10,7 +10,6 @@ namespace Explorer
|
||||
public abstract class CacheObjectBase
|
||||
{
|
||||
public object Value;
|
||||
public string ValueTypeName;
|
||||
public Type ValueType;
|
||||
|
||||
public MemberInfo MemInfo { get; set; }
|
||||
@ -175,7 +174,6 @@ namespace Explorer
|
||||
|
||||
holder.Value = obj;
|
||||
holder.ValueType = valueType;
|
||||
holder.ValueTypeName = valueType.FullName;
|
||||
|
||||
if (memberInfo != null)
|
||||
{
|
||||
@ -517,17 +515,19 @@ namespace Explorer
|
||||
GUIUnstrip.Space(labelWidth);
|
||||
}
|
||||
|
||||
string typeName = $"<color={UIStyles.Syntax.Class_Instance}>{ValueType.FullName}</color>";
|
||||
|
||||
if (!string.IsNullOrEmpty(ReflectionException))
|
||||
{
|
||||
GUILayout.Label("<color=red>Reflection failed!</color> (" + ReflectionException + ")", null);
|
||||
}
|
||||
else if ((HasParameters || this is CacheMethod) && !m_evaluated)
|
||||
{
|
||||
GUILayout.Label($"<color=grey><i>Not yet evaluated</i></color> (<color={UIStyles.Syntax.Class_Instance}>{ValueTypeName}</color>)", null);
|
||||
GUILayout.Label($"<color=grey><i>Not yet evaluated</i></color> ({typeName})", null);
|
||||
}
|
||||
else if (Value == null && !(this is CacheMethod))
|
||||
{
|
||||
GUILayout.Label("<i>null (<color=" + UIStyles.Syntax.Class_Instance + ">" + ValueTypeName + "</color>)</i>", null);
|
||||
GUILayout.Label($"<i>null ({typeName})</i>", null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -29,7 +29,6 @@ namespace Explorer
|
||||
GenericArgInput = new string[GenericArgs.Length];
|
||||
|
||||
ValueType = mi.ReturnType;
|
||||
ValueTypeName = ValueType.FullName;
|
||||
}
|
||||
|
||||
public override void UpdateValue()
|
||||
@ -121,7 +120,7 @@ namespace Explorer
|
||||
|
||||
public override void DrawValue(Rect window, float width)
|
||||
{
|
||||
string typeLabel = $"<color={UIStyles.Syntax.Class_Instance}>{ValueTypeName}</color>";
|
||||
string typeLabel = $"<color={UIStyles.Syntax.Class_Instance}>{ValueType.FullName}</color>";
|
||||
|
||||
if (m_evaluated)
|
||||
{
|
||||
|
@ -56,27 +56,21 @@ namespace Explorer
|
||||
? UIStyles.Syntax.Class_Static
|
||||
: UIStyles.Syntax.Class_Instance;
|
||||
|
||||
string typeLabel = $"<color={classColor}>{ValueType.FullName}</color>";
|
||||
|
||||
if (Value is UnityEngine.Object)
|
||||
{
|
||||
int typeStart = label.LastIndexOf("("); // get where the '(Type)' starts
|
||||
var newLabel = label.Substring(0, typeStart + 1); // get just the name and first '('
|
||||
newLabel += $"<color={classColor}>"; // add color tag
|
||||
newLabel += label.Substring(typeStart + 1); // add the TypeName back in
|
||||
newLabel = newLabel.Substring(0, newLabel.Length - 1); // remove the ending ')'
|
||||
newLabel += "</color>)"; // close color tag and put the ')' back.
|
||||
label = newLabel;
|
||||
label = label.Replace($"({ValueType.FullName})", $"({typeLabel})");
|
||||
}
|
||||
else
|
||||
{
|
||||
string classLabel = $"<color={classColor}>{ValueTypeName}</color>";
|
||||
|
||||
if (!label.Contains(ValueTypeName))
|
||||
if (!label.Contains(ValueType.FullName))
|
||||
{
|
||||
label += $" ({classLabel})";
|
||||
label += $" ({typeLabel})";
|
||||
}
|
||||
else
|
||||
{
|
||||
label = label.Replace(ValueTypeName, $"<color={classColor}>{ValueTypeName}</color>");
|
||||
label = label.Replace(ValueType.FullName, typeLabel);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user