mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-13 23:36:35 +08:00
Some progress on inspector rewrites, most of the framework figured out now.
This commit is contained in:
33
src/UI/Inspectors/CacheObject/CacheField.cs
Normal file
33
src/UI/Inspectors/CacheObject/CacheField.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace UnityExplorer.UI.Inspectors.CacheObject
|
||||
{
|
||||
public class CacheField : CacheMember
|
||||
{
|
||||
public FieldInfo FieldInfo { get; internal set; }
|
||||
|
||||
public override void Initialize(ReflectionInspector inspector, Type declaringType, MemberInfo member, Type returnType)
|
||||
{
|
||||
base.Initialize(inspector, declaringType, member, returnType);
|
||||
|
||||
CanWrite = true;
|
||||
}
|
||||
|
||||
protected override void TryEvaluate()
|
||||
{
|
||||
try
|
||||
{
|
||||
Value = FieldInfo.GetValue(this.ParentInspector.Target.TryCast(this.DeclaringType));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HadException = true;
|
||||
LastException = ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user