2020-08-22 00:16:05 +10:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using MelonLoader;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Explorer
|
|
|
|
|
{
|
|
|
|
|
public class CacheGameObject : CacheObject
|
|
|
|
|
{
|
|
|
|
|
private GameObject m_gameObject;
|
|
|
|
|
|
|
|
|
|
public CacheGameObject(object obj)
|
|
|
|
|
{
|
|
|
|
|
if (obj != null)
|
|
|
|
|
m_gameObject = GetGameObject(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private GameObject GetGameObject(object obj)
|
|
|
|
|
{
|
|
|
|
|
if (obj is Il2CppSystem.Object ilObj)
|
|
|
|
|
{
|
|
|
|
|
var ilType = ilObj.GetIl2CppType();
|
|
|
|
|
|
|
|
|
|
if (ilType == ReflectionHelpers.GameObjectType || ilType == ReflectionHelpers.TransformType)
|
|
|
|
|
{
|
|
|
|
|
return ilObj.TryCast<GameObject>() ?? ilObj.TryCast<Transform>()?.gameObject;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void DrawValue(Rect window, float width)
|
|
|
|
|
{
|
|
|
|
|
UIHelpers.GameobjButton(m_gameObject, null, false, width);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SetValue()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("TODO");
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-22 17:17:11 +10:00
|
|
|
|
public override void UpdateValue()
|
2020-08-22 00:16:05 +10:00
|
|
|
|
{
|
2020-08-22 17:17:11 +10:00
|
|
|
|
base.UpdateValue();
|
2020-08-22 00:16:05 +10:00
|
|
|
|
|
|
|
|
|
m_gameObject = GetGameObject(Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|