mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-23 17:02:36 +08:00
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Reflection;
|
|
using UnityExplorer.UI;
|
|
using UnityExplorer.Helpers;
|
|
using UnityEngine;
|
|
|
|
namespace UnityExplorer.Inspectors.Reflection
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|