mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-06 01:23:31 +08:00
3.0.4
see release notes
This commit is contained in:
parent
c7ccdf387c
commit
cfa4b12039
@ -1,21 +1,22 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityExplorer.Config;
|
||||
using UnityExplorer.Input;
|
||||
using UnityExplorer.Inspectors;
|
||||
using UnityExplorer.UI;
|
||||
using UnityExplorer.UI.Modules;
|
||||
using UnityEngine;
|
||||
using UnityExplorer.Inspectors;
|
||||
using System.IO;
|
||||
using UnityExplorer.Unstrip;
|
||||
using UnityEngine.SceneManagement;
|
||||
#if CPP
|
||||
using UnityExplorer.Helpers;
|
||||
#endif
|
||||
|
||||
namespace UnityExplorer
|
||||
{
|
||||
public class ExplorerCore
|
||||
{
|
||||
public const string NAME = "UnityExplorer";
|
||||
public const string VERSION = "3.0.3";
|
||||
public const string VERSION = "3.0.4";
|
||||
public const string AUTHOR = "Sinai";
|
||||
public const string GUID = "com.sinai.unityexplorer";
|
||||
public const string EXPLORER_FOLDER = @"Mods\UnityExplorer";
|
||||
|
@ -35,7 +35,6 @@ namespace UnityExplorer.Helpers
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
public static bool IsReadable(this Texture2D tex)
|
||||
{
|
||||
try
|
||||
@ -68,6 +67,10 @@ namespace UnityExplorer.Helpers
|
||||
return _newTex;
|
||||
}
|
||||
|
||||
#if CPP
|
||||
internal delegate void d_Blit2(IntPtr source, IntPtr dest);
|
||||
#endif
|
||||
|
||||
public static Texture2D ForceReadTexture(Texture2D tex)
|
||||
{
|
||||
try
|
||||
@ -78,7 +81,13 @@ namespace UnityExplorer.Helpers
|
||||
var rt = RenderTexture.GetTemporary(tex.width, tex.height, 0, RenderTextureFormat.ARGB32);
|
||||
rt.filterMode = FilterMode.Point;
|
||||
RenderTexture.active = rt;
|
||||
|
||||
#if MONO
|
||||
Graphics.Blit(tex, rt);
|
||||
#else
|
||||
var iCall = ICallHelper.GetICall<d_Blit2>("UnityEngine.Graphics::Blit2");
|
||||
iCall.Invoke(tex.Pointer, rt.Pointer);
|
||||
#endif
|
||||
|
||||
var _newTex = new Texture2D(tex.width, tex.height, TextureFormat.ARGB32, false);
|
||||
|
||||
|
@ -231,23 +231,34 @@ namespace UnityExplorer.Inspectors
|
||||
invisGroup.spacing = 10;
|
||||
|
||||
// inspect under mouse button
|
||||
AddMouseInspectButton(topRowObj, MouseInspector.MouseInspectMode.UI);
|
||||
AddMouseInspectButton(topRowObj, MouseInspector.MouseInspectMode.World);
|
||||
}
|
||||
|
||||
private static void AddMouseInspectButton(GameObject topRowObj, MouseInspector.MouseInspectMode mode)
|
||||
{
|
||||
var inspectObj = UIFactory.CreateButton(topRowObj);
|
||||
var inspectLayout = inspectObj.AddComponent<LayoutElement>();
|
||||
inspectLayout.minWidth = 120;
|
||||
inspectLayout.flexibleWidth = 0;
|
||||
|
||||
var inspectText = inspectObj.GetComponentInChildren<Text>();
|
||||
inspectText.text = "Mouse Inspect";
|
||||
inspectText.fontSize = 13;
|
||||
|
||||
if (mode == MouseInspector.MouseInspectMode.UI)
|
||||
inspectText.text += " (UI)";
|
||||
|
||||
var inspectBtn = inspectObj.GetComponent<Button>();
|
||||
var inspectColors = inspectBtn.colors;
|
||||
inspectColors.normalColor = new Color(0.2f, 0.2f, 0.2f);
|
||||
inspectBtn.colors = inspectColors;
|
||||
var inspectText = inspectObj.GetComponentInChildren<Text>();
|
||||
inspectText.text = "Mouse Inspect";
|
||||
inspectText.fontSize = 13;
|
||||
|
||||
inspectBtn.onClick.AddListener(OnInspectMouseClicked);
|
||||
|
||||
void OnInspectMouseClicked()
|
||||
{
|
||||
MouseInspector.Mode = mode;
|
||||
MouseInspector.StartInspect();
|
||||
}
|
||||
}
|
||||
|
@ -3,18 +3,27 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Helpers;
|
||||
using UnityExplorer.Input;
|
||||
using UnityExplorer.UI;
|
||||
using UnityExplorer.Unstrip;
|
||||
|
||||
namespace UnityExplorer.Inspectors
|
||||
{
|
||||
public class MouseInspector
|
||||
{
|
||||
public enum MouseInspectMode
|
||||
{
|
||||
World,
|
||||
UI
|
||||
}
|
||||
|
||||
public static bool Enabled { get; set; }
|
||||
|
||||
//internal static Text s_objUnderMouseName;
|
||||
public static MouseInspectMode Mode { get; set; }
|
||||
|
||||
internal static Text s_objNameLabel;
|
||||
internal static Text s_objPathLabel;
|
||||
internal static Text s_mousePosLabel;
|
||||
@ -29,6 +38,18 @@ namespace UnityExplorer.Inspectors
|
||||
Enabled = true;
|
||||
MainMenu.Instance.MainPanel.SetActive(false);
|
||||
s_UIContent.SetActive(true);
|
||||
|
||||
// recache Graphic Raycasters each time we start
|
||||
var casters = ResourcesUnstrip.FindObjectsOfTypeAll(typeof(GraphicRaycaster));
|
||||
m_gCasters = new GraphicRaycaster[casters.Length];
|
||||
for (int i = 0; i < casters.Length; i++)
|
||||
{
|
||||
#if CPP
|
||||
m_gCasters[i] = casters[i].TryCast<GraphicRaycaster>();
|
||||
#else
|
||||
m_gCasters[i] = casters[i] as GraphicRaycaster;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static void StopInspect()
|
||||
@ -40,49 +61,68 @@ namespace UnityExplorer.Inspectors
|
||||
ClearHitData();
|
||||
}
|
||||
|
||||
internal static GraphicRaycaster[] m_gCasters;
|
||||
|
||||
public static void UpdateInspect()
|
||||
{
|
||||
if (InputManager.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
StopInspect();
|
||||
return;
|
||||
}
|
||||
|
||||
var mousePos = InputManager.MousePosition;
|
||||
|
||||
if (mousePos != s_lastMousePos)
|
||||
{
|
||||
s_lastMousePos = mousePos;
|
||||
|
||||
var inversePos = UIManager.CanvasRoot.transform.InverseTransformPoint(mousePos);
|
||||
|
||||
s_mousePosLabel.text = $"<color=grey>Mouse Position:</color> {((Vector2)InputManager.MousePosition).ToString()}";
|
||||
|
||||
float yFix = mousePos.y < 120 ? 80 : -80;
|
||||
|
||||
s_UIContent.transform.localPosition = new Vector3(inversePos.x, inversePos.y + yFix, 0);
|
||||
}
|
||||
UpdatePosition(mousePos);
|
||||
|
||||
if (!UnityHelpers.MainCamera)
|
||||
return;
|
||||
|
||||
// actual inspect raycast
|
||||
var ray = UnityHelpers.MainCamera.ScreenPointToRay(mousePos);
|
||||
|
||||
if (Physics.Raycast(ray, out RaycastHit hit, 1000f))
|
||||
switch (Mode)
|
||||
{
|
||||
var obj = hit.transform.gameObject;
|
||||
case MouseInspectMode.UI:
|
||||
RaycastUI(mousePos); break;
|
||||
case MouseInspectMode.World:
|
||||
RaycastWorld(mousePos); break;
|
||||
}
|
||||
}
|
||||
|
||||
if (obj != s_lastHit)
|
||||
{
|
||||
s_lastHit = obj;
|
||||
s_objNameLabel.text = $"<b>Click to Inspect:</b> <color=cyan>{obj.name}</color>";
|
||||
s_objPathLabel.text = $"Path: {obj.transform.GetTransformPath(true)}";
|
||||
}
|
||||
internal static void OnHitGameObject(GameObject obj)
|
||||
{
|
||||
if (obj != s_lastHit)
|
||||
{
|
||||
s_lastHit = obj;
|
||||
s_objNameLabel.text = $"<b>Click to Inspect:</b> <color=cyan>{obj.name}</color>";
|
||||
s_objPathLabel.text = $"Path: {obj.transform.GetTransformPath(true)}";
|
||||
}
|
||||
|
||||
if (InputManager.GetMouseButtonDown(0))
|
||||
if (InputManager.GetMouseButtonDown(0))
|
||||
{
|
||||
StopInspect();
|
||||
InspectorManager.Instance.Inspect(obj);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RaycastWorld(Vector2 mousePos)
|
||||
{
|
||||
var ray = UnityHelpers.MainCamera.ScreenPointToRay(mousePos);
|
||||
var casts = Physics.RaycastAll(ray, 1000f);
|
||||
|
||||
if (casts.Length > 0)
|
||||
{
|
||||
foreach (var cast in casts)
|
||||
{
|
||||
StopInspect();
|
||||
InspectorManager.Instance.Inspect(obj);
|
||||
if (cast.transform)
|
||||
{
|
||||
var obj = cast.transform.gameObject;
|
||||
|
||||
OnHitGameObject(obj);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -92,6 +132,56 @@ namespace UnityExplorer.Inspectors
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RaycastUI(Vector2 mousePos)
|
||||
{
|
||||
var ped = new PointerEventData(null)
|
||||
{
|
||||
position = mousePos
|
||||
};
|
||||
|
||||
#if MONO
|
||||
var list = new List<RaycastResult>();
|
||||
#else
|
||||
var list = new Il2CppSystem.Collections.Generic.List<RaycastResult>();
|
||||
#endif
|
||||
foreach (var gr in m_gCasters)
|
||||
{
|
||||
gr.Raycast(ped, list);
|
||||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
foreach (var hit in list)
|
||||
{
|
||||
if (hit.gameObject)
|
||||
{
|
||||
var obj = hit.gameObject;
|
||||
|
||||
OnHitGameObject(obj);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s_lastHit)
|
||||
ClearHitData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static void UpdatePosition(Vector2 mousePos)
|
||||
{
|
||||
s_lastMousePos = mousePos;
|
||||
|
||||
var inversePos = UIManager.CanvasRoot.transform.InverseTransformPoint(mousePos);
|
||||
|
||||
s_mousePosLabel.text = $"<color=grey>Mouse Position:</color> {mousePos.ToString()}";
|
||||
|
||||
float yFix = mousePos.y < 120 ? 80 : -80;
|
||||
s_UIContent.transform.localPosition = new Vector3(inversePos.x, inversePos.y + yFix, 0);
|
||||
}
|
||||
|
||||
internal static void ClearHitData()
|
||||
{
|
||||
s_lastHit = null;
|
||||
@ -99,7 +189,7 @@ namespace UnityExplorer.Inspectors
|
||||
s_objPathLabel.text = "";
|
||||
}
|
||||
|
||||
#region UI Construction
|
||||
#region UI Construction
|
||||
|
||||
internal static void ConstructUI()
|
||||
{
|
||||
@ -112,7 +202,10 @@ namespace UnityExplorer.Inspectors
|
||||
baseRect.anchorMin = half;
|
||||
baseRect.anchorMax = half;
|
||||
baseRect.pivot = half;
|
||||
baseRect.sizeDelta = new Vector2(700, 100);
|
||||
baseRect.sizeDelta = new Vector2(700, 150);
|
||||
|
||||
var group = content.GetComponent<VerticalLayoutGroup>();
|
||||
group.childForceExpandHeight = true;
|
||||
|
||||
// Title text
|
||||
|
||||
@ -131,13 +224,16 @@ namespace UnityExplorer.Inspectors
|
||||
|
||||
var pathLabelObj = UIFactory.CreateLabel(content, TextAnchor.MiddleLeft);
|
||||
s_objPathLabel = pathLabelObj.GetComponent<Text>();
|
||||
s_objPathLabel.color = Color.grey;
|
||||
s_objPathLabel.fontStyle = FontStyle.Italic;
|
||||
s_objPathLabel.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
s_objPathLabel.horizontalOverflow = HorizontalWrapMode.Wrap;
|
||||
|
||||
var pathLayout = pathLabelObj.AddComponent<LayoutElement>();
|
||||
pathLayout.minHeight = 75;
|
||||
pathLayout.flexibleHeight = 0;
|
||||
|
||||
s_UIContent.SetActive(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -37,14 +37,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
|
||||
if (m_subContentConstructed)
|
||||
{
|
||||
// changing types, destroy subcontent
|
||||
for (int i = 0; i < m_subContentParent.transform.childCount; i++)
|
||||
{
|
||||
var child = m_subContentParent.transform.GetChild(i);
|
||||
GameObject.Destroy(child.gameObject);
|
||||
}
|
||||
|
||||
m_subContentConstructed = false;
|
||||
DestroySubContent();
|
||||
}
|
||||
|
||||
if (!s_enumNamesCache.ContainsKey(type))
|
||||
|
@ -14,8 +14,9 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
{
|
||||
public InteractiveString(object value, Type valueType) : base(value, valueType) { }
|
||||
|
||||
public override bool HasSubContent => false;
|
||||
public override bool SubContentWanted => false;
|
||||
public override bool HasSubContent => true;
|
||||
public override bool SubContentWanted => true;
|
||||
|
||||
public override bool WantInspectBtn => false;
|
||||
|
||||
public override void OnValueUpdated()
|
||||
@ -27,10 +28,9 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
{
|
||||
base.OnException(member);
|
||||
|
||||
if (m_hiddenObj.gameObject.activeSelf)
|
||||
if (m_subContentConstructed && m_hiddenObj.gameObject.activeSelf)
|
||||
m_hiddenObj.gameObject.SetActive(false);
|
||||
|
||||
// m_baseLabel.text = DefaultLabel;
|
||||
m_labelLayout.minWidth = 200;
|
||||
m_labelLayout.flexibleWidth = 5000;
|
||||
}
|
||||
@ -45,39 +45,62 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_hiddenObj.gameObject.activeSelf)
|
||||
m_hiddenObj.gameObject.SetActive(true);
|
||||
|
||||
m_baseLabel.text = m_richValueType;
|
||||
|
||||
if (Value != null)
|
||||
if (m_subContentConstructed)
|
||||
{
|
||||
var toString = Value.ToString();
|
||||
if (!m_hiddenObj.gameObject.activeSelf)
|
||||
m_hiddenObj.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty((string)Value))
|
||||
{
|
||||
var toString = (string)Value;
|
||||
if (toString.Length > 15000)
|
||||
toString = toString.Substring(0, 15000);
|
||||
|
||||
m_valueInput.text = toString;
|
||||
m_placeholderText.text = toString;
|
||||
m_readonlyInput.text = toString;
|
||||
|
||||
if (m_subContentConstructed)
|
||||
{
|
||||
m_valueInput.text = toString;
|
||||
m_placeholderText.text = toString;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_valueInput.text = "";
|
||||
m_placeholderText.text = "null";
|
||||
string s = Value == null
|
||||
? "null"
|
||||
: "empty";
|
||||
|
||||
m_readonlyInput.text = $"<i><color=grey>{s}</color></i>";
|
||||
|
||||
if (m_subContentConstructed)
|
||||
{
|
||||
m_valueInput.text = "";
|
||||
m_placeholderText.text = s;
|
||||
}
|
||||
}
|
||||
|
||||
m_labelLayout.minWidth = 50;
|
||||
m_labelLayout.flexibleWidth = 0;
|
||||
}
|
||||
|
||||
|
||||
internal void OnApplyClicked()
|
||||
{
|
||||
Value = m_valueInput.text;
|
||||
Owner.SetValue();
|
||||
RefreshUIForValue();
|
||||
}
|
||||
|
||||
internal InputField m_valueInput;
|
||||
// for the default label
|
||||
internal LayoutElement m_labelLayout;
|
||||
|
||||
//internal InputField m_readonlyInput;
|
||||
internal Text m_readonlyInput;
|
||||
|
||||
// for input
|
||||
internal InputField m_valueInput;
|
||||
internal GameObject m_hiddenObj;
|
||||
internal Text m_placeholderText;
|
||||
|
||||
@ -90,12 +113,38 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
|
||||
m_labelLayout = m_baseLabel.gameObject.GetComponent<LayoutElement>();
|
||||
|
||||
m_hiddenObj = UIFactory.CreateLabel(m_valueContent, TextAnchor.MiddleLeft);
|
||||
var readonlyInputObj = UIFactory.CreateLabel(m_valueContent, TextAnchor.MiddleLeft);
|
||||
m_readonlyInput = readonlyInputObj.GetComponent<Text>();
|
||||
m_readonlyInput.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
|
||||
var testFitter = readonlyInputObj.AddComponent<ContentSizeFitter>();
|
||||
testFitter.verticalFit = ContentSizeFitter.FitMode.MinSize;
|
||||
|
||||
var labelLayout = readonlyInputObj.AddComponent<LayoutElement>();
|
||||
labelLayout.minHeight = 25;
|
||||
labelLayout.preferredHeight = 25;
|
||||
labelLayout.flexibleHeight = 0;
|
||||
}
|
||||
|
||||
public override void ConstructSubcontent()
|
||||
{
|
||||
base.ConstructSubcontent();
|
||||
|
||||
var groupObj = UIFactory.CreateVerticalGroup(m_subContentParent, new Color(1, 1, 1, 0));
|
||||
var group = groupObj.GetComponent<VerticalLayoutGroup>();
|
||||
group.spacing = 4;
|
||||
group.padding.top = 3;
|
||||
group.padding.left = 3;
|
||||
group.padding.right = 3;
|
||||
group.padding.bottom = 3;
|
||||
|
||||
m_hiddenObj = UIFactory.CreateLabel(groupObj, TextAnchor.MiddleLeft);
|
||||
m_hiddenObj.SetActive(false);
|
||||
var hiddenText = m_hiddenObj.GetComponent<Text>();
|
||||
hiddenText.color = Color.clear;
|
||||
hiddenText.fontSize = 14;
|
||||
hiddenText.raycastTarget = false;
|
||||
hiddenText.supportRichText = false;
|
||||
var hiddenFitter = m_hiddenObj.AddComponent<ContentSizeFitter>();
|
||||
hiddenFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
var hiddenLayout = m_hiddenObj.AddComponent<LayoutElement>();
|
||||
@ -121,19 +170,23 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
|
||||
m_placeholderText = m_valueInput.placeholder.GetComponent<Text>();
|
||||
|
||||
m_valueInput.onValueChanged.AddListener((string val) =>
|
||||
m_placeholderText.supportRichText = false;
|
||||
m_valueInput.textComponent.supportRichText = false;
|
||||
|
||||
m_valueInput.onValueChanged.AddListener((string val) =>
|
||||
{
|
||||
hiddenText.text = val;
|
||||
hiddenText.text = val ?? "";
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(Owner.m_mainRect);
|
||||
});
|
||||
|
||||
if (Owner.CanWrite)
|
||||
{
|
||||
var applyBtnObj = UIFactory.CreateButton(m_valueContent, new Color(0.2f, 0.2f, 0.2f));
|
||||
var applyBtnObj = UIFactory.CreateButton(groupObj, new Color(0.2f, 0.2f, 0.2f));
|
||||
var applyLayout = applyBtnObj.AddComponent<LayoutElement>();
|
||||
applyLayout.minWidth = 50;
|
||||
applyLayout.minHeight = 25;
|
||||
applyLayout.flexibleWidth = 0;
|
||||
|
||||
var applyBtn = applyBtnObj.GetComponent<Button>();
|
||||
applyBtn.onClick.AddListener(OnApplyClicked);
|
||||
|
||||
@ -144,6 +197,8 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
{
|
||||
m_valueInput.readOnly = true;
|
||||
}
|
||||
|
||||
RefreshUIForValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,14 +226,15 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
|
||||
if (StructInfo != null)
|
||||
{
|
||||
// changing types, destroy subcontent
|
||||
for (int i = 0; i < m_subContentParent.transform.childCount; i++)
|
||||
{
|
||||
var child = m_subContentParent.transform.GetChild(i);
|
||||
GameObject.Destroy(child.gameObject);
|
||||
}
|
||||
DestroySubContent();
|
||||
//// changing types, destroy subcontent
|
||||
//for (int i = 0; i < m_subContentParent.transform.childCount; i++)
|
||||
//{
|
||||
// var child = m_subContentParent.transform.GetChild(i);
|
||||
// GameObject.Destroy(child.gameObject);
|
||||
//}
|
||||
|
||||
m_UIConstructed = false;
|
||||
//m_UIConstructed = false;
|
||||
}
|
||||
|
||||
m_lastStructType = type;
|
||||
|
@ -78,7 +78,13 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
m_valueContent.SetActive(false);
|
||||
GameObject.Destroy(this.m_valueContent.gameObject);
|
||||
}
|
||||
if (this.m_subContentParent && SubContentWanted)
|
||||
|
||||
DestroySubContent();
|
||||
}
|
||||
|
||||
public virtual void DestroySubContent()
|
||||
{
|
||||
if (this.m_subContentParent && HasSubContent)
|
||||
{
|
||||
for (int i = 0; i < this.m_subContentParent.transform.childCount; i++)
|
||||
{
|
||||
@ -87,6 +93,8 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
GameObject.Destroy(child.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
m_subContentConstructed = false;
|
||||
}
|
||||
|
||||
public virtual void OnValueUpdated()
|
||||
@ -95,18 +103,16 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
ConstructUI(m_mainContentParent, m_subContentParent);
|
||||
|
||||
if (Owner is CacheMember ownerMember && !string.IsNullOrEmpty(ownerMember.ReflectionException))
|
||||
{
|
||||
OnException(ownerMember);
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshUIForValue();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnException(CacheMember member)
|
||||
{
|
||||
m_baseLabel.text = "<color=red>" + member.ReflectionException + "</color>";
|
||||
if (m_UIConstructed)
|
||||
m_baseLabel.text = "<color=red>" + member.ReflectionException + "</color>";
|
||||
|
||||
Value = null;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,12 @@ namespace UnityExplorer.Tests
|
||||
|
||||
public class TestClass
|
||||
{
|
||||
public string AAALongString = @"1
|
||||
2
|
||||
3
|
||||
4
|
||||
5";
|
||||
|
||||
public Vector2 AATestVector2 = new Vector2(1, 2);
|
||||
public Vector3 AATestVector3 = new Vector3(1, 2, 3);
|
||||
public Vector4 AATestVector4 = new Vector4(1, 2, 3, 4);
|
||||
|
@ -260,11 +260,8 @@ namespace UnityExplorer.UI.Modules
|
||||
|
||||
if (searchType == null)
|
||||
return;
|
||||
#if MONO
|
||||
|
||||
var allObjects = ResourcesUnstrip.FindObjectsOfTypeAll(searchType);
|
||||
#else
|
||||
var allObjects = ResourcesUnstrip.FindObjectsOfTypeAll(Il2CppType.From(searchType));
|
||||
#endif
|
||||
var results = new List<object>();
|
||||
|
||||
// perform filter comparers
|
||||
|
@ -25,13 +25,13 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<RootNamespace>UnityExplorer</RootNamespace>
|
||||
<!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. -->
|
||||
<BIECppGameFolder>D:\Steam\steamapps\common\Outward</BIECppGameFolder>
|
||||
<BIECppGameFolder>D:\source\Unity Projects\Test\_BUILD</BIECppGameFolder>
|
||||
<!-- Set this to the BepInEx Mono Game folder, without the ending '\' character. -->
|
||||
<BIEMonoGameFolder>D:\source\Unity Projects\Test\_BUILD_MONO</BIEMonoGameFolder>
|
||||
<!-- Set this to the BepInEx Mono Managed folder, without the ending '\' character. -->
|
||||
<BIEMonoManagedFolder>D:\source\Unity Projects\Test\_BUILD_MONO\Test_Data\Managed</BIEMonoManagedFolder>
|
||||
<!-- Set this to the MelonLoader Il2Cpp Game folder, without the ending '\' character. -->
|
||||
<MLCppGameFolder>D:\Steam\steamapps\common\VRChat</MLCppGameFolder>
|
||||
<MLCppGameFolder>D:\source\Unity Projects\Test\_BUILD</MLCppGameFolder>
|
||||
<!-- Set this to the MelonLoader Mono Game folder, without the ending '\' character. -->
|
||||
<MLMonoGameFolder>D:\source\Unity Projects\Test\_BUILD_MONO</MLMonoGameFolder>
|
||||
<!-- Set this to the MelonLoader Mono Managed folder, without the ending '\' character. -->
|
||||
|
@ -3,24 +3,27 @@ using Mono.CSharp;
|
||||
using UnityExplorer.Helpers;
|
||||
#if CPP
|
||||
using UnhollowerBaseLib;
|
||||
using UnhollowerRuntimeLib;
|
||||
#endif
|
||||
|
||||
namespace UnityExplorer.Unstrip
|
||||
{
|
||||
public class ResourcesUnstrip
|
||||
{
|
||||
public static UnityEngine.Object[] FindObjectsOfTypeAll(Type type)
|
||||
{
|
||||
#if MONO
|
||||
return UnityEngine.Resources.FindObjectsOfTypeAll(type);
|
||||
#else
|
||||
var iCall = ICallHelper.GetICall<d_FindObjectsOfTypeAll>("UnityEngine.Resources::FindObjectsOfTypeAll");
|
||||
var cppType = Il2CppType.From(type);
|
||||
|
||||
return new Il2CppReferenceArray<UnityEngine.Object>(iCall.Invoke(cppType.Pointer));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CPP
|
||||
internal delegate IntPtr d_FindObjectsOfTypeAll(IntPtr type);
|
||||
|
||||
public static UnityEngine.Object[] FindObjectsOfTypeAll(Il2CppSystem.Type type)
|
||||
{
|
||||
var iCall = ICallHelper.GetICall<d_FindObjectsOfTypeAll>("UnityEngine.Resources::FindObjectsOfTypeAll");
|
||||
|
||||
return new Il2CppReferenceArray<UnityEngine.Object>(iCall.Invoke(type.Pointer));
|
||||
}
|
||||
#else
|
||||
public static UnityEngine.Object[] FindObjectsOfTypeAll(Type type) => UnityEngine.Resources.FindObjectsOfTypeAll(type);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user