diff --git a/src/Explorer.csproj b/src/Explorer.csproj index 632b7ef..eb8ed34 100644 --- a/src/Explorer.csproj +++ b/src/Explorer.csproj @@ -28,15 +28,15 @@ D:\Steam\steamapps\common\VRChat - D:\Steam\steamapps\common\Outward + D:\source\Unity Projects\Test\_BUILD_MONO - D:\Steam\steamapps\common\Outward\Outward_Data\Managed + D:\source\Unity Projects\Test\_BUILD_MONO\Test_Data\Managed D:\Steam\steamapps\common\Outward_Il2Cpp - D:\Steam\steamapps\common\Outward + D:\source\Unity Projects\Test\_BUILD_MONO - D:\Steam\steamapps\common\Outward\Outward_Data\Managed + D:\source\Unity Projects\Test\_BUILD_MONO\Test_Data\Managed @@ -49,7 +49,7 @@ true - + v4.0 ..\Release\Explorer.MelonLoader.Mono\ MONO,ML false @@ -66,7 +66,7 @@ true - + v4.0 ..\Release\Explorer.BepInEx.Mono\ MONO,BIE false @@ -108,6 +108,10 @@ $(MLMonoGameFolder)\MelonLoader\MelonLoader.ModHandler.dll False + $(MLMonoManagedFolder)\Unity.TextMeshPro.dll False @@ -159,6 +163,10 @@ $(BIEMonoGameFolder)\BepInEx\core\0Harmony.dll False + $(BIEMonoManagedFolder)\Unity.TextMeshPro.dll False diff --git a/src/ExplorerBepInPlugin.cs b/src/ExplorerBepInPlugin.cs index 83a4e24..aa8933c 100644 --- a/src/ExplorerBepInPlugin.cs +++ b/src/ExplorerBepInPlugin.cs @@ -12,9 +12,9 @@ using UnhollowerRuntimeLib; using BepInEx.IL2CPP; #endif -namespace Explorer +namespace ExplorerBeta { - [BepInPlugin(ExplorerCore.GUID, "Explorer", ExplorerCore.VERSION)] + [BepInPlugin(ExplorerCore.GUID, "ExplorerBeta", ExplorerCore.VERSION)] #if CPP public class ExplorerBepInPlugin : BasePlugin #else @@ -64,7 +64,7 @@ namespace Explorer new ExplorerCore(); - //HarmonyInstance.PatchAll(); + // HarmonyInstance.PatchAll(); } internal static void DoSceneChange(Scene arg0, Scene arg1) @@ -96,11 +96,6 @@ namespace Explorer } #endif } - - internal void OnGUI() - { - ExplorerCore.OnGUI(); - } #if CPP } #endif diff --git a/src/ExplorerCore.cs b/src/ExplorerCore.cs index 3464507..6c84c1d 100644 --- a/src/ExplorerCore.cs +++ b/src/ExplorerCore.cs @@ -10,9 +10,9 @@ namespace ExplorerBeta public class ExplorerCore { public const string NAME = "Explorer " + VERSION + " (" + PLATFORM + ", " + MODLOADER + ")"; - public const string VERSION = "3.0.0b"; + public const string VERSION = "3.0.0"; public const string AUTHOR = "Sinai"; - public const string GUID = "com.sinai.explorer"; + public const string GUID = "com.sinai.explorerBETA"; public const string PLATFORM = #if CPP diff --git a/src/Helpers/Texture2DHelpers.cs b/src/Helpers/Texture2DHelpers.cs index a326ac9..d39d0da 100644 --- a/src/Helpers/Texture2DHelpers.cs +++ b/src/Helpers/Texture2DHelpers.cs @@ -1,6 +1,7 @@ using System; using UnityEngine; using System.IO; +using System.Reflection; #if CPP using ExplorerBeta.Unstrip.ImageConversion; #endif diff --git a/src/Input/InputManager.cs b/src/Input/InputManager.cs index f28264c..81fab4f 100644 --- a/src/Input/InputManager.cs +++ b/src/Input/InputManager.cs @@ -38,47 +38,5 @@ namespace ExplorerBeta.Input public static bool GetMouseButtonDown(int btn) => m_inputModule.GetMouseButtonDown(btn); public static bool GetMouseButton(int btn) => m_inputModule.GetMouseButton(btn); - -#if CPP - internal delegate void d_ResetInputAxes(); - public static void ResetInputAxes() => ICallHelper.GetICall("UnityEngine.Input::ResetInputAxes").Invoke(); -#else - public static void ResetInputAxes() => UnityEngine.Input.ResetInputAxes(); -#endif - -#if CPP - // public extern static string compositionString { get; } - - internal delegate IntPtr d_get_compositionString(); - - public static string compositionString - { - get - { - var iCall = ICallHelper.GetICall("UnityEngine.Input::get_compositionString"); - return IL2CPP.Il2CppStringToManaged(iCall.Invoke()); - } - } - - // public extern static Vector2 compositionCursorPos { get; set; } - - internal delegate void d_get_compositionCursorPos(out Vector2 ret); - internal delegate void d_set_compositionCursorPos(ref Vector2 value); - - public static Vector2 compositionCursorPos - { - get - { - var iCall = ICallHelper.GetICall("UnityEngine.Input::get_compositionCursorPos_Injected"); - iCall.Invoke(out Vector2 ret); - return ret; - } - set - { - var iCall = ICallHelper.GetICall("UnityEngine.Input::set_compositionCursorPos_Injected"); - iCall.Invoke(ref value); - } - } -#endif } } \ No newline at end of file diff --git a/src/UI/ForceUnlockCursor.cs b/src/UI/ForceUnlockCursor.cs index 6de5ee9..fc8e5fe 100644 --- a/src/UI/ForceUnlockCursor.cs +++ b/src/UI/ForceUnlockCursor.cs @@ -82,7 +82,7 @@ namespace ExplorerBeta.UI { try { - HarmonyInstance harmony = + var harmony = #if ML ExplorerMelonMod.Instance.harmonyInstance; #else @@ -103,10 +103,10 @@ namespace ExplorerBeta.UI harmony.Patch(prop.GetGetMethod(), postfix: patch); } } - catch (Exception e) + catch // (Exception e) { - string suf = setter ? "set_" : "get_"; - ExplorerCore.Log($"Unable to patch {type.Name}.{suf}{property}: {e.Message}"); + //string suf = setter ? "set_" : "get_"; + //ExplorerCore.Log($"Unable to patch {type.Name}.{suf}{property}: {e.Message}"); } } diff --git a/src/UI/Main/Console/CodeEditor.cs b/src/UI/Main/Console/CodeEditor.cs index 83b49fd..21aa5d6 100644 --- a/src/UI/Main/Console/CodeEditor.cs +++ b/src/UI/Main/Console/CodeEditor.cs @@ -81,6 +81,8 @@ namespace ExplorerBeta.UI.Main.Console throw new Exception("References are missing!"); } + InputField.restoreOriginalTextOnEscape = false; + inputTextTransform = inputText.GetComponent(); lineHighlightTransform = lineHighlight.GetComponent(); diff --git a/src/UI/Main/ConsolePage.cs b/src/UI/Main/ConsolePage.cs index dba3d53..de56aab 100644 --- a/src/UI/Main/ConsolePage.cs +++ b/src/UI/Main/ConsolePage.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using System.Text; using ExplorerBeta.UI.Main.Console; using ExplorerBeta.Unstrip.Resources; diff --git a/src/UI/Main/DebugConsole.cs b/src/UI/Main/DebugConsole.cs index 2ae786f..e0ba92e 100644 --- a/src/UI/Main/DebugConsole.cs +++ b/src/UI/Main/DebugConsole.cs @@ -237,7 +237,7 @@ namespace ExplorerBeta.UI.Main #if CPP unityToggle.onValueChanged.AddListener(new Action((bool val) => { LogUnity = val; })); #else - unityToggle.onValueChanged.AddListener((bool val) => { LogUnity = val; })); + unityToggle.onValueChanged.AddListener((bool val) => { LogUnity = val; }); #endif unityToggleText.text = "Print Unity Debug?"; unityToggleText.alignment = TextAnchor.MiddleLeft; diff --git a/src/UI/Main/HomePage.cs b/src/UI/Main/HomePage.cs index 456c9e7..2c46ef9 100644 --- a/src/UI/Main/HomePage.cs +++ b/src/UI/Main/HomePage.cs @@ -18,6 +18,10 @@ namespace ExplorerBeta.UI.Main ConstructMenu(); + new SceneExplorer(); + + new InspectorManager(); + SceneExplorer.Instance.Init(); } @@ -42,12 +46,6 @@ namespace ExplorerBeta.UI.Main mainGroup.childForceExpandWidth = true; mainGroup.childControlHeight = true; mainGroup.childControlWidth = true; - - new SceneExplorer(); - SceneExplorer.Instance.ConstructScenePane(); - - new InspectorManager(); - InspectorManager.Instance.ConstructInspectorPane(); } } } diff --git a/src/UI/Main/InspectorManager.cs b/src/UI/Main/InspectorManager.cs index 73da696..4e0a1ea 100644 --- a/src/UI/Main/InspectorManager.cs +++ b/src/UI/Main/InspectorManager.cs @@ -15,7 +15,11 @@ namespace ExplorerBeta.UI.Main { public static InspectorManager Instance { get; private set; } - public InspectorManager() { Instance = this; } + public InspectorManager() + { + Instance = this; + ConstructInspectorPane(); + } public InspectorBase m_activeInspector; public readonly List m_currentInspectors = new List(); @@ -76,7 +80,7 @@ namespace ExplorerBeta.UI.Main } m_currentInspectors.Add(inspector); - inspector.inspectorContent?.SetActive(false); + inspector.Content?.SetActive(false); SetInspectorTab(inspector); } @@ -92,7 +96,7 @@ namespace ExplorerBeta.UI.Main m_activeInspector = inspector; - m_activeInspector.inspectorContent?.SetActive(true); + m_activeInspector.Content?.SetActive(true); Color activeColor = new Color(0, 0.25f, 0, 1); ColorBlock colors = inspector.tabButton.colors; @@ -108,7 +112,7 @@ namespace ExplorerBeta.UI.Main return; } - m_activeInspector.inspectorContent?.SetActive(false); + m_activeInspector.Content?.SetActive(false); ColorBlock colors = m_activeInspector.tabButton.colors; colors.normalColor = new Color(0.2f, 0.2f, 0.2f, 1); diff --git a/src/UI/Main/Inspectors/GameObjectInspector.cs b/src/UI/Main/Inspectors/GameObjectInspector.cs index 4162616..4ab6a10 100644 --- a/src/UI/Main/Inspectors/GameObjectInspector.cs +++ b/src/UI/Main/Inspectors/GameObjectInspector.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using UnityEngine; +using UnityEngine.UI; namespace ExplorerBeta.UI.Main.Inspectors { @@ -15,6 +16,12 @@ namespace ExplorerBeta.UI.Main.Inspectors { TargetGO = target; + if (!TargetGO) + { + ExplorerCore.LogWarning("GameObjectInspector cctor: Target GameObject is null!"); + return; + } + ConstructUI(); } @@ -34,7 +41,36 @@ namespace ExplorerBeta.UI.Main.Inspectors private void ConstructUI() { - // todo create gameobject inspector pane + var parent = InspectorManager.Instance.m_inspectorContent; + + this.Content = UIFactory.CreateScrollView(parent, out GameObject scrollContent, new Color(0.1f, 0.1f, 0.1f, 1)); + + var nameObj = UIFactory.CreateLabel(scrollContent, TextAnchor.MiddleLeft); + var nameText = nameObj.GetComponent(); + nameText.text = TargetGO.name; + nameText.fontSize = 18; + + var childListObj = UIFactory.CreateLabel(scrollContent, TextAnchor.MiddleLeft); + var childListText = childListObj.GetComponent(); + childListText.text = "Children:"; + + foreach (Transform child in TargetGO.transform) + { + var childLabelObj = UIFactory.CreateLabel(scrollContent, TextAnchor.MiddleLeft); + var childLabelText = childLabelObj.GetComponent(); + childLabelText.text = " - " + child.name; + } + + var compListObj = UIFactory.CreateLabel(scrollContent, TextAnchor.MiddleLeft); + var compListText = compListObj.GetComponent(); + compListText.text = "Components:"; + + foreach (var comp in TargetGO.GetComponents()) + { + var compLabelObj = UIFactory.CreateLabel(scrollContent, TextAnchor.MiddleLeft); + var compText = compLabelObj.GetComponent(); + compText.text = " - " + comp.GetType().Name; + } } diff --git a/src/UI/Main/Inspectors/InspectorBase.cs b/src/UI/Main/Inspectors/InspectorBase.cs index 7495dbb..c4ae93c 100644 --- a/src/UI/Main/Inspectors/InspectorBase.cs +++ b/src/UI/Main/Inspectors/InspectorBase.cs @@ -12,7 +12,7 @@ namespace ExplorerBeta.UI.Main.Inspectors public abstract string TabLabel { get; } - public GameObject inspectorContent; + public GameObject Content; public Button tabButton; public Text tabText; @@ -54,9 +54,9 @@ namespace ExplorerBeta.UI.Main.Inspectors GameObject.Destroy(tabGroup); } - if (inspectorContent) + if (Content) { - GameObject.Destroy(inspectorContent); + GameObject.Destroy(Content); } if (ReferenceEquals(InspectorManager.Instance.m_activeInspector, this)) @@ -121,8 +121,11 @@ namespace ExplorerBeta.UI.Main.Inspectors tabText.alignment = TextAnchor.MiddleLeft; tabButton = targetButtonObj.GetComponent