Revert "1.31"

This reverts commit 7144b6a44c.
This commit is contained in:
sinaioutlander
2020-08-12 18:25:52 +10:00
parent 7144b6a44c
commit e58cf45e07
19 changed files with 453 additions and 598 deletions

View File

@ -36,17 +36,17 @@ namespace Explorer
return MB.FindAll<T>();
}
//[Documentation("runCoroutine(enumerator) - runs an IEnumerator as a Unity coroutine.")]
//public static object runCoroutine(IEnumerator i)
//{
// return MB.RunCoroutine(i);
//}
[Documentation("runCoroutine(enumerator) - runs an IEnumerator as a Unity coroutine.")]
public static object runCoroutine(IEnumerator i)
{
return MB.RunCoroutine(i);
}
//[Documentation("endCoroutine(co) - ends a Unity coroutine.")]
//public static void endCoroutine(Coroutine c)
//{
// MB.EndCoroutine(c);
//}
[Documentation("endCoroutine(co) - ends a Unity coroutine.")]
public static void endCoroutine(Coroutine c)
{
MB.EndCoroutine(c);
}
////[Documentation("type<T>() - obtain type info about a type T. Provides some Reflection helpers.")]
////public static TypeHelper type<T>()

View File

@ -21,14 +21,14 @@ namespace Explorer
return FindObjectsOfType<T>();
}
//public object RunCoroutine(IEnumerator enumerator)
//{
// return MelonCoroutines.Start(enumerator);
//}
public object RunCoroutine(IEnumerator enumerator)
{
return MelonCoroutines.Start(enumerator);
}
//public void EndCoroutine(Coroutine c)
//{
// StopCoroutine(c);
//}
public void EndCoroutine(Coroutine c)
{
StopCoroutine(c);
}
}
}

View File

@ -20,13 +20,12 @@ namespace Explorer
// gameobject list
private Transform m_currentTransform;
private List<GameObjectCache> m_objectList = new List<GameObjectCache>();
private float m_timeOfLastUpdate = -1f;
private List<GameObject> m_objectList = new List<GameObject>();
// search bar
private bool m_searching = false;
private string m_searchInput = "";
private List<GameObjectCache> m_searchResults = new List<GameObjectCache>();
private List<GameObject> m_searchResults = new List<GameObject>();
// ------------ Init and Update ------------ //
@ -41,24 +40,17 @@ namespace Explorer
m_currentTransform = null;
CancelSearch();
}
public override void Update()
{
if (Time.time - m_timeOfLastUpdate < 1f)
{
return;
}
m_timeOfLastUpdate = Time.time;
var start = Time.realtimeSinceStartup;
if (!m_searching)
{
m_objectList = new List<GameObjectCache>();
m_objectList = new List<GameObject>();
if (m_currentTransform)
{
var endAppend = new List<GameObjectCache>();
var noChildren = new List<GameObject>();
for (int i = 0; i < m_currentTransform.childCount; i++)
{
var child = m_currentTransform.GetChild(i);
@ -66,13 +58,13 @@ namespace Explorer
if (child)
{
if (child.childCount > 0)
m_objectList.Add(new GameObjectCache(child.gameObject));
m_objectList.Add(child.gameObject);
else
endAppend.Add(new GameObjectCache(child.gameObject));
noChildren.Add(child.gameObject);
}
}
m_objectList.AddRange(endAppend);
endAppend = null;
m_objectList.AddRange(noChildren);
noChildren = null;
}
else
{
@ -82,11 +74,11 @@ namespace Explorer
// add objects with children first
foreach (var obj in rootObjects.Where(x => x.transform.childCount > 0))
{
m_objectList.Add(new GameObjectCache(obj));
m_objectList.Add(obj);
}
foreach (var obj in rootObjects.Where(x => x.transform.childCount == 0))
{
m_objectList.Add(new GameObjectCache(obj));
m_objectList.Add(obj);
}
}
}
@ -128,8 +120,7 @@ namespace Explorer
m_currentScene = scenes[index].name;
}
}
GUILayout.Label("<color=cyan>" + m_currentScene + "</color>", null); //new GUILayoutOption[] { GUILayout.Width(250) });
GUILayout.Label("<color=cyan>" + m_currentScene + "</color>", null);
GUILayout.EndHorizontal();
// ----- GameObject Search -----
@ -169,13 +160,10 @@ namespace Explorer
if (m_objectList.Count > 0)
{
var start = Time.realtimeSinceStartup;
foreach (var obj in m_objectList)
{
//UIStyles.GameobjButton(obj, SetTransformTarget, true, MainMenu.MainRect.width - 170);
UIStyles.FastGameobjButton(obj.RefGameObject, obj.EnabledColor, obj.Label, obj.RefGameObject.activeSelf, SetTransformTarget, true, MainMenu.MainRect.width - 170);
UIStyles.GameobjButton(obj, SetTransformTarget, true, MainMenu.MainRect.width - 170);
}
var diff = Time.realtimeSinceStartup - start;
}
else
{
@ -195,8 +183,7 @@ namespace Explorer
{
foreach (var obj in m_searchResults)
{
//UIStyles.GameobjButton(obj, SetTransformTarget, true, MainMenu.MainRect.width - 170);
UIStyles.FastGameobjButton(obj.RefGameObject, obj.EnabledColor, obj.Label, obj.RefGameObject.activeSelf, SetTransformTarget, true, MainMenu.MainRect.width - 170);
UIStyles.GameobjButton(obj, SetTransformTarget, true, MainMenu.MainRect.width - 170);
}
}
else
@ -244,54 +231,19 @@ namespace Explorer
m_searching = false;
}
public List<GameObjectCache> SearchSceneObjects(string _search)
public List<GameObject> SearchSceneObjects(string _search)
{
var matches = new List<GameObjectCache>();
var matches = new List<GameObject>();
foreach (var obj in Resources.FindObjectsOfTypeAll<GameObject>())
{
if (obj.name.ToLower().Contains(_search.ToLower()) && obj.scene.name == m_currentScene)
{
matches.Add(new GameObjectCache(obj));
matches.Add(obj);
}
}
return matches;
}
public class GameObjectCache
{
public GameObject RefGameObject;
public string Label;
public Color EnabledColor;
public int ChildCount;
public GameObjectCache(GameObject obj)
{
RefGameObject = obj;
ChildCount = obj.transform.childCount;
Label = (ChildCount > 0) ? "[" + obj.transform.childCount + " children] " : "";
Label += obj.name;
bool enabled = obj.activeSelf;
int childCount = obj.transform.childCount;
if (enabled)
{
if (childCount > 0)
{
EnabledColor = Color.green;
}
else
{
EnabledColor = UIStyles.LightGreen;
}
}
else
{
EnabledColor = Color.red;
}
}
}
}
}

View File

@ -44,7 +44,7 @@ namespace Explorer
private List<object> m_searchResults = new List<object>();
private Vector2 resultsScroll = Vector2.zero;
public override void Init()
public override void Init()
{
Instance = this;
}
@ -54,7 +54,7 @@ namespace Explorer
m_searchResults.Clear();
}
public override void Update()
public override void Update()
{
}
@ -91,8 +91,7 @@ namespace Explorer
{
var obj = m_searchResults[i];
bool _ = false;
UIStyles.DrawValue(ref obj, _temprect, ref _);
UIStyles.DrawValue(ref obj, _temprect);
}
}
else
@ -148,14 +147,14 @@ namespace Explorer
{
GUILayout.BeginHorizontal(null);
GUI.skin.label.alignment = TextAnchor.MiddleRight;
GUILayout.Label("Custom Class:", new GUILayoutOption[] { GUILayout.Width(250) });
GUILayout.Label("Custom Class:", new GUILayoutOption[] { GUILayout.Width(250) });
GUI.skin.label.alignment = TextAnchor.UpperLeft;
m_typeInput = GUILayout.TextField(m_typeInput, new GUILayoutOption[] { GUILayout.Width(250) });
m_typeInput = GUILayout.TextField(m_typeInput, new GUILayoutOption[] { GUILayout.Width(250) });
GUILayout.EndHorizontal();
}
GUILayout.BeginHorizontal(null);
GUILayout.Label("Scene Filter:", new GUILayoutOption[] { GUILayout.Width(100) });
GUILayout.Label("Scene Filter:", new GUILayoutOption[] { GUILayout.Width(100) });
SceneFilterToggle(SceneFilter.Any, "Any", 60);
SceneFilterToggle(SceneFilter.This, "This Scene", 100);
SceneFilterToggle(SceneFilter.DontDestroy, "DontDestroyOnLoad", 140);
@ -263,6 +262,7 @@ namespace Explorer
{
var findType = CppExplorer.GetType(_type);
type = Il2CppSystem.Type.GetType(findType.AssemblyQualifiedName);
MelonLogger.Log("Got type: " + type.AssemblyQualifiedName);
}
catch (Exception e)
{
@ -372,7 +372,7 @@ namespace Explorer
if (type == typeof(GameObject) || typeof(Component).IsAssignableFrom(type))
{
var go = obj as GameObject ?? (obj as Component).gameObject;
if (go != null && go.scene.name == CppExplorer.ActiveSceneName && go.scene.name != "DontDestroyOnLoad")
{
return true;