added buttons to change which of the active scenes you are inspecting
This commit is contained in:
sinaioutlander 2020-08-12 05:34:34 +10:00
parent 10ee2a837f
commit e8b17d3583
4 changed files with 77 additions and 16 deletions

View File

@ -16,7 +16,7 @@ namespace Explorer
public const string ID = "com.sinai.cppexplorer"; public const string ID = "com.sinai.cppexplorer";
public const string NAME = "IL2CPP Runtime Explorer"; public const string NAME = "IL2CPP Runtime Explorer";
public const string VERSION = "1.2.0"; public const string VERSION = "1.3.0";
public const string AUTHOR = "Sinai"; public const string AUTHOR = "Sinai";
// fields // fields

View File

@ -40,7 +40,7 @@ namespace Explorer
m_currentTransform = null; m_currentTransform = null;
CancelSearch(); CancelSearch();
} }
public override void Update() public override void Update()
@ -68,7 +68,7 @@ namespace Explorer
} }
else else
{ {
var scene = SceneManager.GetActiveScene(); var scene = SceneManager.GetSceneByName(m_currentScene);
var rootObjects = scene.GetRootGameObjects(); var rootObjects = scene.GetRootGameObjects();
// add objects with children first // add objects with children first
@ -87,11 +87,42 @@ namespace Explorer
// --------- GUI Draw Functions --------- // // --------- GUI Draw Functions --------- //
public override void DrawWindow() public override void DrawWindow()
{ {
try try
{ {
GUILayout.BeginHorizontal(null);
// Current Scene label // Current Scene label
GUILayout.Label("Current Scene: <color=cyan>" + m_currentScene + "</color>", null); GUILayout.Label("Current Scene:", new GUILayoutOption[] { GUILayout.Width(120) });
if (SceneManager.sceneCount > 1)
{
int changeWanted = 0;
if (GUILayout.Button("<", new GUILayoutOption[] { GUILayout.Width(30) }))
{
changeWanted = -1;
}
if (GUILayout.Button(">", new GUILayoutOption[] { GUILayout.Width(30) }))
{
changeWanted = 1;
}
if (changeWanted != 0)
{
var scenes = SceneManager.GetAllScenes();
int index = scenes.IndexOf(SceneManager.GetSceneByName(m_currentScene));
index += changeWanted;
if (index >= scenes.Count - 1)
{
index = 0;
}
else if (index > 0)
{
index = scenes.Count - 1;
}
m_currentScene = scenes[index].name;
}
}
GUILayout.Label("<color=cyan>" + m_currentScene + "</color>", null); //new GUILayoutOption[] { GUILayout.Width(250) });
GUILayout.EndHorizontal();
// ----- GameObject Search ----- // ----- GameObject Search -----
GUILayout.BeginHorizontal(GUI.skin.box, null); GUILayout.BeginHorizontal(GUI.skin.box, null);
@ -168,7 +199,7 @@ namespace Explorer
} }
} }
// -------- Actual Methods (not drawing GUI) ---------- // // -------- Actual Methods (not drawing GUI) ---------- //
@ -207,9 +238,9 @@ namespace Explorer
foreach (var obj in Resources.FindObjectsOfTypeAll<GameObject>()) foreach (var obj in Resources.FindObjectsOfTypeAll<GameObject>())
{ {
if (obj.name.ToLower().Contains(_search.ToLower()) && obj.scene.name == CppExplorer.ActiveSceneName) if (obj.name.ToLower().Contains(_search.ToLower()) && obj.scene.name == m_currentScene)
{ {
matches.Add(obj); matches.Add(obj);
} }
} }

View File

@ -16,7 +16,7 @@ namespace Explorer
public const string ID = "com.sinai.cppexplorer"; public const string ID = "com.sinai.cppexplorer";
public const string NAME = "IL2CPP Runtime Explorer"; public const string NAME = "IL2CPP Runtime Explorer";
public const string VERSION = "1.2.0"; public const string VERSION = "1.3.0";
public const string AUTHOR = "Sinai"; public const string AUTHOR = "Sinai";
// fields // fields

View File

@ -40,7 +40,7 @@ namespace Explorer
m_currentTransform = null; m_currentTransform = null;
CancelSearch(); CancelSearch();
} }
public override void Update() public override void Update()
@ -68,7 +68,7 @@ namespace Explorer
} }
else else
{ {
var scene = SceneManager.GetActiveScene(); var scene = SceneManager.GetSceneByName(m_currentScene);
var rootObjects = scene.GetRootGameObjects(); var rootObjects = scene.GetRootGameObjects();
// add objects with children first // add objects with children first
@ -87,11 +87,41 @@ namespace Explorer
// --------- GUI Draw Functions --------- // // --------- GUI Draw Functions --------- //
public override void DrawWindow() public override void DrawWindow()
{ {
try try
{ {
GUILayout.BeginHorizontal(null);
// Current Scene label // Current Scene label
GUILayout.Label("Current Scene: <color=cyan>" + m_currentScene + "</color>", null); GUILayout.Label("Current Scene:", new GUILayoutOption[] { GUILayout.Width(120) });
if (SceneManager.sceneCount > 1)
{
int changeWanted = 0;
if (GUILayout.Button("<", new GUILayoutOption[] { GUILayout.Width(30) }))
{
changeWanted = -1;
}
if (GUILayout.Button(">", new GUILayoutOption[] { GUILayout.Width(30) }))
{
changeWanted = 1;
}
if (changeWanted != 0)
{
var scenes = SceneManager.GetAllScenes();
int index = scenes.IndexOf(SceneManager.GetSceneByName(m_currentScene));
index += changeWanted;
if (index >= scenes.Count - 1)
{
index = 0;
}
else if (index > 0)
{
index = scenes.Count - 1;
}
m_currentScene = scenes[index].name;
}
}
GUILayout.Label("<color=cyan>" + m_currentScene + "</color>", null);
GUILayout.EndHorizontal();
// ----- GameObject Search ----- // ----- GameObject Search -----
GUILayout.BeginHorizontal(GUI.skin.box, null); GUILayout.BeginHorizontal(GUI.skin.box, null);
@ -168,7 +198,7 @@ namespace Explorer
} }
} }
// -------- Actual Methods (not drawing GUI) ---------- // // -------- Actual Methods (not drawing GUI) ---------- //
@ -207,9 +237,9 @@ namespace Explorer
foreach (var obj in Resources.FindObjectsOfTypeAll<GameObject>()) foreach (var obj in Resources.FindObjectsOfTypeAll<GameObject>())
{ {
if (obj.name.ToLower().Contains(_search.ToLower()) && obj.scene.name == CppExplorer.ActiveSceneName) if (obj.name.ToLower().Contains(_search.ToLower()) && obj.scene.name == m_currentScene)
{ {
matches.Add(obj); matches.Add(obj);
} }
} }