mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-23 00:52:31 +08:00

* Huge restructure/rewrite. No real changes to any functionality, just a cleaner and more manageable project.
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Reflection;
|
|
using UnityExplorer.UI;
|
|
using UnityEngine;
|
|
|
|
namespace UnityExplorer.UI.CacheObject
|
|
{
|
|
public class CacheField : CacheMember
|
|
{
|
|
public override bool IsStatic => (MemInfo as FieldInfo).IsStatic;
|
|
|
|
public override Type FallbackType => (MemInfo as FieldInfo).FieldType;
|
|
|
|
public CacheField(FieldInfo fieldInfo, object declaringInstance, GameObject parent) : base(fieldInfo, declaringInstance, parent)
|
|
{
|
|
CreateIValue(null, fieldInfo.FieldType);
|
|
}
|
|
|
|
public override void UpdateReflection()
|
|
{
|
|
var fi = MemInfo as FieldInfo;
|
|
IValue.Value = fi.GetValue(fi.IsStatic ? null : DeclaringInstance);
|
|
|
|
m_evaluated = true;
|
|
ReflectionException = null;
|
|
}
|
|
|
|
public override void SetValue()
|
|
{
|
|
var fi = MemInfo as FieldInfo;
|
|
fi.SetValue(fi.IsStatic ? null : DeclaringInstance, IValue.Value);
|
|
|
|
if (this.ParentInspector?.ParentMember != null)
|
|
this.ParentInspector.ParentMember.SetValue();
|
|
}
|
|
}
|
|
}
|