From e8b17d3583d0ffa8975a2de5d80f1d62f75e7121 Mon Sep 17 00:00:00 2001 From: sinaioutlander <49360850+sinaioutlander@users.noreply.github.com> Date: Wed, 12 Aug 2020 05:34:34 +1000 Subject: [PATCH] 1.3 added buttons to change which of the active scenes you are inspecting --- src/CppExplorer.cs | 2 +- src/MainMenu/Pages/ScenePage.cs | 45 +++++++++++++++++++++++----- src_2018/CppExplorer.cs | 2 +- src_2018/MainMenu/Pages/ScenePage.cs | 44 ++++++++++++++++++++++----- 4 files changed, 77 insertions(+), 16 deletions(-) diff --git a/src/CppExplorer.cs b/src/CppExplorer.cs index 31fd52c..1f9b293 100644 --- a/src/CppExplorer.cs +++ b/src/CppExplorer.cs @@ -16,7 +16,7 @@ namespace Explorer public const string ID = "com.sinai.cppexplorer"; 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"; // fields diff --git a/src/MainMenu/Pages/ScenePage.cs b/src/MainMenu/Pages/ScenePage.cs index 59fc7c7..aac139f 100644 --- a/src/MainMenu/Pages/ScenePage.cs +++ b/src/MainMenu/Pages/ScenePage.cs @@ -40,7 +40,7 @@ namespace Explorer m_currentTransform = null; CancelSearch(); - + } public override void Update() @@ -68,7 +68,7 @@ namespace Explorer } else { - var scene = SceneManager.GetActiveScene(); + var scene = SceneManager.GetSceneByName(m_currentScene); var rootObjects = scene.GetRootGameObjects(); // add objects with children first @@ -87,11 +87,42 @@ namespace Explorer // --------- GUI Draw Functions --------- // public override void DrawWindow() - { + { try { + GUILayout.BeginHorizontal(null); // Current Scene label - GUILayout.Label("Current Scene: " + m_currentScene + "", 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("" + m_currentScene + "", null); //new GUILayoutOption[] { GUILayout.Width(250) }); + + GUILayout.EndHorizontal(); // ----- GameObject Search ----- GUILayout.BeginHorizontal(GUI.skin.box, null); @@ -168,7 +199,7 @@ namespace Explorer } } - + // -------- Actual Methods (not drawing GUI) ---------- // @@ -207,9 +238,9 @@ namespace Explorer foreach (var obj in Resources.FindObjectsOfTypeAll()) { - 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); } } diff --git a/src_2018/CppExplorer.cs b/src_2018/CppExplorer.cs index 31fd52c..1f9b293 100644 --- a/src_2018/CppExplorer.cs +++ b/src_2018/CppExplorer.cs @@ -16,7 +16,7 @@ namespace Explorer public const string ID = "com.sinai.cppexplorer"; 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"; // fields diff --git a/src_2018/MainMenu/Pages/ScenePage.cs b/src_2018/MainMenu/Pages/ScenePage.cs index 59fc7c7..60b4ed7 100644 --- a/src_2018/MainMenu/Pages/ScenePage.cs +++ b/src_2018/MainMenu/Pages/ScenePage.cs @@ -40,7 +40,7 @@ namespace Explorer m_currentTransform = null; CancelSearch(); - + } public override void Update() @@ -68,7 +68,7 @@ namespace Explorer } else { - var scene = SceneManager.GetActiveScene(); + var scene = SceneManager.GetSceneByName(m_currentScene); var rootObjects = scene.GetRootGameObjects(); // add objects with children first @@ -87,11 +87,41 @@ namespace Explorer // --------- GUI Draw Functions --------- // public override void DrawWindow() - { + { try { + GUILayout.BeginHorizontal(null); // Current Scene label - GUILayout.Label("Current Scene: " + m_currentScene + "", 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("" + m_currentScene + "", null); + GUILayout.EndHorizontal(); // ----- GameObject Search ----- GUILayout.BeginHorizontal(GUI.skin.box, null); @@ -168,7 +198,7 @@ namespace Explorer } } - + // -------- Actual Methods (not drawing GUI) ---------- // @@ -207,9 +237,9 @@ namespace Explorer foreach (var obj in Resources.FindObjectsOfTypeAll()) { - 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); } }