mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 14:17:51 +08:00
A little bit of work on Inspectors, fixed a few issues in Mono/BepInEx builds
This commit is contained in:
parent
b61ac481b9
commit
b5b3e90b09
@ -28,15 +28,15 @@
|
|||||||
<!-- Set this to the MelonLoader Il2Cpp Game folder, without the ending '\' character. -->
|
<!-- Set this to the MelonLoader Il2Cpp Game folder, without the ending '\' character. -->
|
||||||
<MLCppGameFolder>D:\Steam\steamapps\common\VRChat</MLCppGameFolder>
|
<MLCppGameFolder>D:\Steam\steamapps\common\VRChat</MLCppGameFolder>
|
||||||
<!-- Set this to the MelonLoader Mono Game folder, without the ending '\' character. -->
|
<!-- Set this to the MelonLoader Mono Game folder, without the ending '\' character. -->
|
||||||
<MLMonoGameFolder>D:\Steam\steamapps\common\Outward</MLMonoGameFolder>
|
<MLMonoGameFolder>D:\source\Unity Projects\Test\_BUILD_MONO</MLMonoGameFolder>
|
||||||
<!-- Set this to the Mono Managed folder, without the ending '\' character. -->
|
<!-- Set this to the Mono Managed folder, without the ending '\' character. -->
|
||||||
<MLMonoManagedFolder>D:\Steam\steamapps\common\Outward\Outward_Data\Managed</MLMonoManagedFolder>
|
<MLMonoManagedFolder>D:\source\Unity Projects\Test\_BUILD_MONO\Test_Data\Managed</MLMonoManagedFolder>
|
||||||
<!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. -->
|
<!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. -->
|
||||||
<BIECppGameFolder>D:\Steam\steamapps\common\Outward_Il2Cpp</BIECppGameFolder>
|
<BIECppGameFolder>D:\Steam\steamapps\common\Outward_Il2Cpp</BIECppGameFolder>
|
||||||
<!-- Set this to the BepInEx Mono Game folder, without the ending '\' character. -->
|
<!-- Set this to the BepInEx Mono Game folder, without the ending '\' character. -->
|
||||||
<BIEMonoGameFolder>D:\Steam\steamapps\common\Outward</BIEMonoGameFolder>
|
<BIEMonoGameFolder>D:\source\Unity Projects\Test\_BUILD_MONO</BIEMonoGameFolder>
|
||||||
<!-- Set this to the BepInEx Managed folder, without the ending '\' character. -->
|
<!-- Set this to the BepInEx Managed folder, without the ending '\' character. -->
|
||||||
<BIEMonoManagedFolder>D:\Steam\steamapps\common\Outward\Outward_Data\Managed</BIEMonoManagedFolder>
|
<BIEMonoManagedFolder>D:\source\Unity Projects\Test\_BUILD_MONO\Test_Data\Managed</BIEMonoManagedFolder>
|
||||||
<NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>
|
||||||
</NuGetPackageImportStamp>
|
</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -49,7 +49,7 @@
|
|||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_ML_Mono|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_ML_Mono|AnyCPU' ">
|
||||||
<!-- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> -->
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<OutputPath>..\Release\Explorer.MelonLoader.Mono\</OutputPath>
|
<OutputPath>..\Release\Explorer.MelonLoader.Mono\</OutputPath>
|
||||||
<DefineConstants>MONO,ML</DefineConstants>
|
<DefineConstants>MONO,ML</DefineConstants>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
@ -66,7 +66,7 @@
|
|||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_BIE_Mono|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_BIE_Mono|AnyCPU' ">
|
||||||
<!-- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> -->
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<OutputPath>..\Release\Explorer.BepInEx.Mono\</OutputPath>
|
<OutputPath>..\Release\Explorer.BepInEx.Mono\</OutputPath>
|
||||||
<DefineConstants>MONO,BIE</DefineConstants>
|
<DefineConstants>MONO,BIE</DefineConstants>
|
||||||
<IsCpp>false</IsCpp>
|
<IsCpp>false</IsCpp>
|
||||||
@ -108,6 +108,10 @@
|
|||||||
<HintPath>$(MLMonoGameFolder)\MelonLoader\MelonLoader.ModHandler.dll</HintPath>
|
<HintPath>$(MLMonoGameFolder)\MelonLoader\MelonLoader.ModHandler.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<!--<Reference Include="netstandard">
|
||||||
|
<HintPath>$(MLMonoManagedFolder)\netstandard.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>-->
|
||||||
<Reference Include="Unity.TextMeshPro">
|
<Reference Include="Unity.TextMeshPro">
|
||||||
<HintPath>$(MLMonoManagedFolder)\Unity.TextMeshPro.dll</HintPath>
|
<HintPath>$(MLMonoManagedFolder)\Unity.TextMeshPro.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@ -159,6 +163,10 @@
|
|||||||
<HintPath>$(BIEMonoGameFolder)\BepInEx\core\0Harmony.dll</HintPath>
|
<HintPath>$(BIEMonoGameFolder)\BepInEx\core\0Harmony.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<!--<Reference Include="netstandard">
|
||||||
|
<HintPath>$(BIEMonoManagedFolder)\netstandard.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>-->
|
||||||
<Reference Include="Unity.TextMeshPro">
|
<Reference Include="Unity.TextMeshPro">
|
||||||
<HintPath>$(BIEMonoManagedFolder)\Unity.TextMeshPro.dll</HintPath>
|
<HintPath>$(BIEMonoManagedFolder)\Unity.TextMeshPro.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
|
@ -12,9 +12,9 @@ using UnhollowerRuntimeLib;
|
|||||||
using BepInEx.IL2CPP;
|
using BepInEx.IL2CPP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Explorer
|
namespace ExplorerBeta
|
||||||
{
|
{
|
||||||
[BepInPlugin(ExplorerCore.GUID, "Explorer", ExplorerCore.VERSION)]
|
[BepInPlugin(ExplorerCore.GUID, "ExplorerBeta", ExplorerCore.VERSION)]
|
||||||
#if CPP
|
#if CPP
|
||||||
public class ExplorerBepInPlugin : BasePlugin
|
public class ExplorerBepInPlugin : BasePlugin
|
||||||
#else
|
#else
|
||||||
@ -64,7 +64,7 @@ namespace Explorer
|
|||||||
|
|
||||||
new ExplorerCore();
|
new ExplorerCore();
|
||||||
|
|
||||||
//HarmonyInstance.PatchAll();
|
// HarmonyInstance.PatchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void DoSceneChange(Scene arg0, Scene arg1)
|
internal static void DoSceneChange(Scene arg0, Scene arg1)
|
||||||
@ -96,11 +96,6 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnGUI()
|
|
||||||
{
|
|
||||||
ExplorerCore.OnGUI();
|
|
||||||
}
|
|
||||||
#if CPP
|
#if CPP
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,9 +10,9 @@ namespace ExplorerBeta
|
|||||||
public class ExplorerCore
|
public class ExplorerCore
|
||||||
{
|
{
|
||||||
public const string NAME = "Explorer " + VERSION + " (" + PLATFORM + ", " + MODLOADER + ")";
|
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 AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.explorer";
|
public const string GUID = "com.sinai.explorerBETA";
|
||||||
|
|
||||||
public const string PLATFORM =
|
public const string PLATFORM =
|
||||||
#if CPP
|
#if CPP
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
#if CPP
|
#if CPP
|
||||||
using ExplorerBeta.Unstrip.ImageConversion;
|
using ExplorerBeta.Unstrip.ImageConversion;
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,47 +38,5 @@ namespace ExplorerBeta.Input
|
|||||||
|
|
||||||
public static bool GetMouseButtonDown(int btn) => m_inputModule.GetMouseButtonDown(btn);
|
public static bool GetMouseButtonDown(int btn) => m_inputModule.GetMouseButtonDown(btn);
|
||||||
public static bool GetMouseButton(int btn) => m_inputModule.GetMouseButton(btn);
|
public static bool GetMouseButton(int btn) => m_inputModule.GetMouseButton(btn);
|
||||||
|
|
||||||
#if CPP
|
|
||||||
internal delegate void d_ResetInputAxes();
|
|
||||||
public static void ResetInputAxes() => ICallHelper.GetICall<d_ResetInputAxes>("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<d_get_compositionString>("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<d_get_compositionCursorPos>("UnityEngine.Input::get_compositionCursorPos_Injected");
|
|
||||||
iCall.Invoke(out Vector2 ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
var iCall = ICallHelper.GetICall<d_set_compositionCursorPos>("UnityEngine.Input::set_compositionCursorPos_Injected");
|
|
||||||
iCall.Invoke(ref value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -82,7 +82,7 @@ namespace ExplorerBeta.UI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HarmonyInstance harmony =
|
var harmony =
|
||||||
#if ML
|
#if ML
|
||||||
ExplorerMelonMod.Instance.harmonyInstance;
|
ExplorerMelonMod.Instance.harmonyInstance;
|
||||||
#else
|
#else
|
||||||
@ -103,10 +103,10 @@ namespace ExplorerBeta.UI
|
|||||||
harmony.Patch(prop.GetGetMethod(), postfix: patch);
|
harmony.Patch(prop.GetGetMethod(), postfix: patch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch // (Exception e)
|
||||||
{
|
{
|
||||||
string suf = setter ? "set_" : "get_";
|
//string suf = setter ? "set_" : "get_";
|
||||||
ExplorerCore.Log($"Unable to patch {type.Name}.{suf}{property}: {e.Message}");
|
//ExplorerCore.Log($"Unable to patch {type.Name}.{suf}{property}: {e.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,8 @@ namespace ExplorerBeta.UI.Main.Console
|
|||||||
throw new Exception("References are missing!");
|
throw new Exception("References are missing!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InputField.restoreOriginalTextOnEscape = false;
|
||||||
|
|
||||||
inputTextTransform = inputText.GetComponent<RectTransform>();
|
inputTextTransform = inputText.GetComponent<RectTransform>();
|
||||||
lineHighlightTransform = lineHighlight.GetComponent<RectTransform>();
|
lineHighlightTransform = lineHighlight.GetComponent<RectTransform>();
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using ExplorerBeta.UI.Main.Console;
|
using ExplorerBeta.UI.Main.Console;
|
||||||
using ExplorerBeta.Unstrip.Resources;
|
using ExplorerBeta.Unstrip.Resources;
|
||||||
|
@ -237,7 +237,7 @@ namespace ExplorerBeta.UI.Main
|
|||||||
#if CPP
|
#if CPP
|
||||||
unityToggle.onValueChanged.AddListener(new Action<bool>((bool val) => { LogUnity = val; }));
|
unityToggle.onValueChanged.AddListener(new Action<bool>((bool val) => { LogUnity = val; }));
|
||||||
#else
|
#else
|
||||||
unityToggle.onValueChanged.AddListener((bool val) => { LogUnity = val; }));
|
unityToggle.onValueChanged.AddListener((bool val) => { LogUnity = val; });
|
||||||
#endif
|
#endif
|
||||||
unityToggleText.text = "Print Unity Debug?";
|
unityToggleText.text = "Print Unity Debug?";
|
||||||
unityToggleText.alignment = TextAnchor.MiddleLeft;
|
unityToggleText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
@ -18,6 +18,10 @@ namespace ExplorerBeta.UI.Main
|
|||||||
|
|
||||||
ConstructMenu();
|
ConstructMenu();
|
||||||
|
|
||||||
|
new SceneExplorer();
|
||||||
|
|
||||||
|
new InspectorManager();
|
||||||
|
|
||||||
SceneExplorer.Instance.Init();
|
SceneExplorer.Instance.Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,12 +46,6 @@ namespace ExplorerBeta.UI.Main
|
|||||||
mainGroup.childForceExpandWidth = true;
|
mainGroup.childForceExpandWidth = true;
|
||||||
mainGroup.childControlHeight = true;
|
mainGroup.childControlHeight = true;
|
||||||
mainGroup.childControlWidth = true;
|
mainGroup.childControlWidth = true;
|
||||||
|
|
||||||
new SceneExplorer();
|
|
||||||
SceneExplorer.Instance.ConstructScenePane();
|
|
||||||
|
|
||||||
new InspectorManager();
|
|
||||||
InspectorManager.Instance.ConstructInspectorPane();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,11 @@ namespace ExplorerBeta.UI.Main
|
|||||||
{
|
{
|
||||||
public static InspectorManager Instance { get; private set; }
|
public static InspectorManager Instance { get; private set; }
|
||||||
|
|
||||||
public InspectorManager() { Instance = this; }
|
public InspectorManager()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
ConstructInspectorPane();
|
||||||
|
}
|
||||||
|
|
||||||
public InspectorBase m_activeInspector;
|
public InspectorBase m_activeInspector;
|
||||||
public readonly List<InspectorBase> m_currentInspectors = new List<InspectorBase>();
|
public readonly List<InspectorBase> m_currentInspectors = new List<InspectorBase>();
|
||||||
@ -76,7 +80,7 @@ namespace ExplorerBeta.UI.Main
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_currentInspectors.Add(inspector);
|
m_currentInspectors.Add(inspector);
|
||||||
inspector.inspectorContent?.SetActive(false);
|
inspector.Content?.SetActive(false);
|
||||||
|
|
||||||
SetInspectorTab(inspector);
|
SetInspectorTab(inspector);
|
||||||
}
|
}
|
||||||
@ -92,7 +96,7 @@ namespace ExplorerBeta.UI.Main
|
|||||||
|
|
||||||
m_activeInspector = inspector;
|
m_activeInspector = inspector;
|
||||||
|
|
||||||
m_activeInspector.inspectorContent?.SetActive(true);
|
m_activeInspector.Content?.SetActive(true);
|
||||||
|
|
||||||
Color activeColor = new Color(0, 0.25f, 0, 1);
|
Color activeColor = new Color(0, 0.25f, 0, 1);
|
||||||
ColorBlock colors = inspector.tabButton.colors;
|
ColorBlock colors = inspector.tabButton.colors;
|
||||||
@ -108,7 +112,7 @@ namespace ExplorerBeta.UI.Main
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_activeInspector.inspectorContent?.SetActive(false);
|
m_activeInspector.Content?.SetActive(false);
|
||||||
|
|
||||||
ColorBlock colors = m_activeInspector.tabButton.colors;
|
ColorBlock colors = m_activeInspector.tabButton.colors;
|
||||||
colors.normalColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
colors.normalColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace ExplorerBeta.UI.Main.Inspectors
|
namespace ExplorerBeta.UI.Main.Inspectors
|
||||||
{
|
{
|
||||||
@ -15,6 +16,12 @@ namespace ExplorerBeta.UI.Main.Inspectors
|
|||||||
{
|
{
|
||||||
TargetGO = target;
|
TargetGO = target;
|
||||||
|
|
||||||
|
if (!TargetGO)
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning("GameObjectInspector cctor: Target GameObject is null!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ConstructUI();
|
ConstructUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +41,36 @@ namespace ExplorerBeta.UI.Main.Inspectors
|
|||||||
|
|
||||||
private void ConstructUI()
|
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<Text>();
|
||||||
|
nameText.text = TargetGO.name;
|
||||||
|
nameText.fontSize = 18;
|
||||||
|
|
||||||
|
var childListObj = UIFactory.CreateLabel(scrollContent, TextAnchor.MiddleLeft);
|
||||||
|
var childListText = childListObj.GetComponent<Text>();
|
||||||
|
childListText.text = "Children:";
|
||||||
|
|
||||||
|
foreach (Transform child in TargetGO.transform)
|
||||||
|
{
|
||||||
|
var childLabelObj = UIFactory.CreateLabel(scrollContent, TextAnchor.MiddleLeft);
|
||||||
|
var childLabelText = childLabelObj.GetComponent<Text>();
|
||||||
|
childLabelText.text = " - " + child.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
var compListObj = UIFactory.CreateLabel(scrollContent, TextAnchor.MiddleLeft);
|
||||||
|
var compListText = compListObj.GetComponent<Text>();
|
||||||
|
compListText.text = "Components:";
|
||||||
|
|
||||||
|
foreach (var comp in TargetGO.GetComponents<Component>())
|
||||||
|
{
|
||||||
|
var compLabelObj = UIFactory.CreateLabel(scrollContent, TextAnchor.MiddleLeft);
|
||||||
|
var compText = compLabelObj.GetComponent<Text>();
|
||||||
|
compText.text = " - " + comp.GetType().Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ namespace ExplorerBeta.UI.Main.Inspectors
|
|||||||
|
|
||||||
public abstract string TabLabel { get; }
|
public abstract string TabLabel { get; }
|
||||||
|
|
||||||
public GameObject inspectorContent;
|
public GameObject Content;
|
||||||
public Button tabButton;
|
public Button tabButton;
|
||||||
public Text tabText;
|
public Text tabText;
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ namespace ExplorerBeta.UI.Main.Inspectors
|
|||||||
GameObject.Destroy(tabGroup);
|
GameObject.Destroy(tabGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inspectorContent)
|
if (Content)
|
||||||
{
|
{
|
||||||
GameObject.Destroy(inspectorContent);
|
GameObject.Destroy(Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ReferenceEquals(InspectorManager.Instance.m_activeInspector, this))
|
if (ReferenceEquals(InspectorManager.Instance.m_activeInspector, this))
|
||||||
@ -121,8 +121,11 @@ namespace ExplorerBeta.UI.Main.Inspectors
|
|||||||
tabText.alignment = TextAnchor.MiddleLeft;
|
tabText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
tabButton = targetButtonObj.GetComponent<Button>();
|
tabButton = targetButtonObj.GetComponent<Button>();
|
||||||
|
#if CPP
|
||||||
tabButton.onClick.AddListener(new Action(() => { InspectorManager.Instance.SetInspectorTab(this); }));
|
tabButton.onClick.AddListener(new Action(() => { InspectorManager.Instance.SetInspectorTab(this); }));
|
||||||
|
#else
|
||||||
|
tabButton.onClick.AddListener(() => { InspectorManager.Instance.SetInspectorTab(this); });
|
||||||
|
#endif
|
||||||
var closeBtnObj = UIFactory.CreateButton(tabGroupObj);
|
var closeBtnObj = UIFactory.CreateButton(tabGroupObj);
|
||||||
var closeBtnLayout = closeBtnObj.AddComponent<LayoutElement>();
|
var closeBtnLayout = closeBtnObj.AddComponent<LayoutElement>();
|
||||||
closeBtnLayout.minWidth = 20;
|
closeBtnLayout.minWidth = 20;
|
||||||
@ -132,12 +135,17 @@ namespace ExplorerBeta.UI.Main.Inspectors
|
|||||||
closeBtnText.color = new Color(1, 0, 0, 1);
|
closeBtnText.color = new Color(1, 0, 0, 1);
|
||||||
|
|
||||||
var closeBtn = closeBtnObj.GetComponent<Button>();
|
var closeBtn = closeBtnObj.GetComponent<Button>();
|
||||||
|
#if CPP
|
||||||
closeBtn.onClick.AddListener(new Action(() => { Destroy(); }));
|
closeBtn.onClick.AddListener(new Action(() => { Destroy(); }));
|
||||||
|
#else
|
||||||
|
closeBtn.onClick.AddListener(() => { Destroy(); });
|
||||||
|
#endif
|
||||||
|
|
||||||
var closeColors = closeBtn.colors;
|
var closeColors = closeBtn.colors;
|
||||||
closeColors.normalColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
closeColors.normalColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
||||||
closeBtn.colors = closeColors;
|
closeBtn.colors = closeColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,9 @@ namespace ExplorerBeta.UI.Main
|
|||||||
|
|
||||||
// Navbar buttons
|
// Navbar buttons
|
||||||
private Button m_lastNavButtonPressed;
|
private Button m_lastNavButtonPressed;
|
||||||
private readonly Color m_navButtonNormal = new Color(65f / 255f, 66f / 255f, 66f / 255f);
|
private readonly Color m_navButtonNormal = new Color(0.3f, 0.3f, 0.3f, 1);
|
||||||
private readonly Color m_navButtonHighlight = new Color(50f / 255f, 195f / 255f, 50f / 255f);
|
private readonly Color m_navButtonHighlight = new Color(0.3f, 0.6f, 0.3f);
|
||||||
private readonly Color m_navButtonSelected = new Color(60f / 255f, 120f / 255f, 60f / 255f);
|
private readonly Color m_navButtonSelected = new Color(0.2f, 0.5f, 0.2f, 1);
|
||||||
|
|
||||||
public MainMenu()
|
public MainMenu()
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ namespace ExplorerBeta.UI.Main
|
|||||||
m_activePage?.Content?.SetActive(false);
|
m_activePage?.Content?.SetActive(false);
|
||||||
if (m_activePage is ConsolePage)
|
if (m_activePage is ConsolePage)
|
||||||
{
|
{
|
||||||
AutoCompleter.m_mainObj.SetActive(false);
|
AutoCompleter.m_mainObj?.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_activePage = page;
|
m_activePage = page;
|
||||||
@ -109,12 +109,6 @@ namespace ExplorerBeta.UI.Main
|
|||||||
m_lastNavButtonPressed = button;
|
m_lastNavButtonPressed = button;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region UI Interaction Callbacks
|
|
||||||
|
|
||||||
// ... none needed yet
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region UI Construction
|
#region UI Construction
|
||||||
|
|
||||||
private void ConstructMenu()
|
private void ConstructMenu()
|
||||||
|
@ -18,6 +18,8 @@ namespace ExplorerBeta.UI.Main
|
|||||||
|
|
||||||
public RectTransform Panel { get; set; }
|
public RectTransform Panel { get; set; }
|
||||||
|
|
||||||
|
private static bool s_loadedCursorImage;
|
||||||
|
|
||||||
public PanelDragger(RectTransform dragArea, RectTransform panelToDrag)
|
public PanelDragger(RectTransform dragArea, RectTransform panelToDrag)
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
@ -25,15 +27,6 @@ namespace ExplorerBeta.UI.Main
|
|||||||
Panel = panelToDrag;
|
Panel = panelToDrag;
|
||||||
|
|
||||||
UpdateResizeCache();
|
UpdateResizeCache();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoadCursorImage();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
ExplorerCore.Log("Exception loading resize cursor: " + e.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
@ -44,7 +37,7 @@ namespace ExplorerBeta.UI.Main
|
|||||||
Vector3 resizePos = Panel.InverseTransformPoint(rawMousePos);
|
Vector3 resizePos = Panel.InverseTransformPoint(rawMousePos);
|
||||||
Vector3 dragPos = DragableArea.InverseTransformPoint(rawMousePos);
|
Vector3 dragPos = DragableArea.InverseTransformPoint(rawMousePos);
|
||||||
|
|
||||||
if (WasHoveringResize)
|
if (WasHoveringResize && m_resizeCursorImage)
|
||||||
{
|
{
|
||||||
UpdateHoverImagePos();
|
UpdateHoverImagePos();
|
||||||
}
|
}
|
||||||
@ -144,7 +137,7 @@ namespace ExplorerBeta.UI.Main
|
|||||||
|
|
||||||
private bool WasHoveringResize { get; set; }
|
private bool WasHoveringResize { get; set; }
|
||||||
private ResizeTypes m_lastResizeHoverType;
|
private ResizeTypes m_lastResizeHoverType;
|
||||||
private GameObject m_resizeCursorImage;
|
public GameObject m_resizeCursorImage;
|
||||||
|
|
||||||
private Rect m_resizeRect;
|
private Rect m_resizeRect;
|
||||||
|
|
||||||
@ -238,12 +231,16 @@ namespace ExplorerBeta.UI.Main
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!s_loadedCursorImage)
|
||||||
|
LoadCursorImage();
|
||||||
|
|
||||||
// we are entering resize, or the resize type has changed.
|
// we are entering resize, or the resize type has changed.
|
||||||
|
|
||||||
WasHoveringResize = true;
|
WasHoveringResize = true;
|
||||||
m_lastResizeHoverType = resizeType;
|
m_lastResizeHoverType = resizeType;
|
||||||
|
|
||||||
m_resizeCursorImage.SetActive(true);
|
m_resizeCursorImage.SetActive(true);
|
||||||
|
ExplorerCore.Log("Set image active.");
|
||||||
|
|
||||||
// set the rotation for the resize icon
|
// set the rotation for the resize icon
|
||||||
float iconRotation = 0f;
|
float iconRotation = 0f;
|
||||||
@ -270,11 +267,6 @@ namespace ExplorerBeta.UI.Main
|
|||||||
// update the resize icon position to be above the mouse
|
// update the resize icon position to be above the mouse
|
||||||
private void UpdateHoverImagePos()
|
private void UpdateHoverImagePos()
|
||||||
{
|
{
|
||||||
if (!m_resizeCursorImage)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RectTransform t = UIManager.CanvasRoot.GetComponent<RectTransform>();
|
RectTransform t = UIManager.CanvasRoot.GetComponent<RectTransform>();
|
||||||
m_resizeCursorImage.transform.localPosition = t.InverseTransformPoint(InputManager.MousePosition);
|
m_resizeCursorImage.transform.localPosition = t.InverseTransformPoint(InputManager.MousePosition);
|
||||||
}
|
}
|
||||||
@ -336,26 +328,35 @@ namespace ExplorerBeta.UI.Main
|
|||||||
|
|
||||||
private void LoadCursorImage()
|
private void LoadCursorImage()
|
||||||
{
|
{
|
||||||
string path = @"Mods\Explorer\cursor.png";
|
try
|
||||||
byte[] data = File.ReadAllBytes(path);
|
{
|
||||||
|
string path = @"Mods\Explorer\cursor.png";
|
||||||
|
byte[] data = File.ReadAllBytes(path);
|
||||||
|
|
||||||
Texture2D tex = new Texture2D(32, 32);
|
Texture2D tex = new Texture2D(32, 32);
|
||||||
tex.LoadImage(data, false);
|
tex.LoadImage(data, false);
|
||||||
UnityEngine.Object.DontDestroyOnLoad(tex);
|
UnityEngine.Object.DontDestroyOnLoad(tex);
|
||||||
|
|
||||||
Sprite sprite = UIManager.CreateSprite(tex);
|
Sprite sprite = UIManager.CreateSprite(tex, new Rect(0, 0, 32, 32));
|
||||||
UnityEngine.Object.DontDestroyOnLoad(sprite);
|
UnityEngine.Object.DontDestroyOnLoad(sprite);
|
||||||
|
|
||||||
m_resizeCursorImage = new GameObject("ResizeCursorImage");
|
m_resizeCursorImage = new GameObject("ResizeCursorImage");
|
||||||
m_resizeCursorImage.transform.SetParent(UIManager.CanvasRoot.transform);
|
m_resizeCursorImage.transform.SetParent(UIManager.CanvasRoot.transform);
|
||||||
|
|
||||||
Image image = m_resizeCursorImage.AddComponent<Image>();
|
Image image = m_resizeCursorImage.AddComponent<Image>();
|
||||||
image.sprite = sprite;
|
image.sprite = sprite;
|
||||||
RectTransform rect = image.transform.GetComponent<RectTransform>();
|
RectTransform rect = image.transform.GetComponent<RectTransform>();
|
||||||
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 32);
|
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 32);
|
||||||
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 32);
|
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 32);
|
||||||
|
|
||||||
m_resizeCursorImage.SetActive(false);
|
//m_resizeCursorImage.SetActive(false);
|
||||||
|
|
||||||
|
s_loadedCursorImage = true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning("Exception loading cursor image!\r\n" + e.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -4,10 +4,10 @@ using System.Linq;
|
|||||||
using ExplorerBeta.Helpers;
|
using ExplorerBeta.Helpers;
|
||||||
using ExplorerBeta.UI.Main.Inspectors;
|
using ExplorerBeta.UI.Main.Inspectors;
|
||||||
using ExplorerBeta.UI.Shared;
|
using ExplorerBeta.UI.Shared;
|
||||||
using ExplorerBeta.Unstrip.Scenes;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using ExplorerBeta.Unstrip.Scenes;
|
||||||
|
|
||||||
namespace ExplorerBeta.UI.Main
|
namespace ExplorerBeta.UI.Main
|
||||||
{
|
{
|
||||||
@ -15,14 +15,17 @@ namespace ExplorerBeta.UI.Main
|
|||||||
{
|
{
|
||||||
public static SceneExplorer Instance;
|
public static SceneExplorer Instance;
|
||||||
|
|
||||||
public SceneExplorer() { Instance = this; }
|
public SceneExplorer()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
ConstructScenePane();
|
||||||
|
}
|
||||||
|
|
||||||
private const float UPDATE_INTERVAL = 1f;
|
private const float UPDATE_INTERVAL = 1f;
|
||||||
private float m_timeOfLastSceneUpdate;
|
private float m_timeOfLastSceneUpdate;
|
||||||
|
|
||||||
private bool m_doneFirstSceneRefresh;
|
|
||||||
private GameObject m_selectedSceneObject;
|
private GameObject m_selectedSceneObject;
|
||||||
private int m_currentSceneHandle;
|
private int m_currentSceneHandle = -1;
|
||||||
private int m_lastCount;
|
private int m_lastCount;
|
||||||
|
|
||||||
public PageHandler m_sceneListPageHandler;
|
public PageHandler m_sceneListPageHandler;
|
||||||
@ -30,22 +33,23 @@ namespace ExplorerBeta.UI.Main
|
|||||||
private GameObject[] m_allSceneListObjects = new GameObject[0];
|
private GameObject[] m_allSceneListObjects = new GameObject[0];
|
||||||
private readonly List<GameObject> m_sceneShortList = new List<GameObject>();
|
private readonly List<GameObject> m_sceneShortList = new List<GameObject>();
|
||||||
private readonly List<Text> m_sceneListTexts = new List<Text>();
|
private readonly List<Text> m_sceneListTexts = new List<Text>();
|
||||||
private readonly List<bool> m_sceneListActiveStates = new List<bool>();
|
|
||||||
|
|
||||||
|
public static int DontDestroyHandle;
|
||||||
|
|
||||||
private GameObject m_sceneListCanvas;
|
private GameObject m_sceneListCanvas;
|
||||||
private Dropdown m_sceneDropdown;
|
private Dropdown m_sceneDropdown;
|
||||||
private Text m_scenePathText;
|
private Text m_scenePathText;
|
||||||
private GameObject m_mainInspectBtn;
|
private GameObject m_mainInspectBtn;
|
||||||
private GameObject m_backButtonObj;
|
private GameObject m_backButtonObj;
|
||||||
|
|
||||||
private readonly Dictionary<string, int> m_sceneHandles = new Dictionary<string, int>();
|
//private readonly Dictionary<string, int> m_sceneHandles = new Dictionary<string, int>();
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
// Get DontDestroyOnLoad scene handle. I think it's always -12, but best to be safe.
|
// Get DontDestroyOnLoad scene handle. I think it's always -12, but best to be safe.
|
||||||
GameObject test = new GameObject();
|
GameObject test = new GameObject();
|
||||||
GameObject.DontDestroyOnLoad(test);
|
GameObject.DontDestroyOnLoad(test);
|
||||||
StoreScenehandle(test.scene);
|
DontDestroyHandle = test.scene.handle;
|
||||||
GameObject.Destroy(test);
|
GameObject.Destroy(test);
|
||||||
|
|
||||||
RefreshActiveScenes();
|
RefreshActiveScenes();
|
||||||
@ -73,70 +77,62 @@ namespace ExplorerBeta.UI.Main
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int StoreScenehandle(Scene scene)
|
//private int StoreScenehandle(Scene scene)
|
||||||
{
|
//{
|
||||||
if (!m_sceneHandles.ContainsKey(scene.name))
|
// if (scene == null || scene.handle == -1)
|
||||||
{
|
// return -1;
|
||||||
m_sceneHandles.Add(scene.name, scene.handle);
|
|
||||||
}
|
|
||||||
return scene.handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int GetSceneHandle(string sceneName)
|
// if (!m_sceneHandles.ContainsKey(scene.name))
|
||||||
|
// {
|
||||||
|
// m_sceneHandles.Add(scene.name, scene.handle);
|
||||||
|
// }
|
||||||
|
// return scene.handle;
|
||||||
|
//}
|
||||||
|
|
||||||
|
public int GetSceneHandle(string sceneName)
|
||||||
{
|
{
|
||||||
if (!m_sceneHandles.ContainsKey(sceneName))
|
if (sceneName == "DontDestroyOnLoad")
|
||||||
|
return DontDestroyHandle;
|
||||||
|
|
||||||
|
for (int i = 0; i < SceneManager.sceneCount; i++)
|
||||||
{
|
{
|
||||||
return -1;
|
var scene = SceneManager.GetSceneAt(i);
|
||||||
}
|
if (scene.name == sceneName)
|
||||||
else
|
return scene.handle;
|
||||||
{
|
|
||||||
return m_sceneHandles[sceneName];
|
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnSceneChange()
|
internal void OnSceneChange()
|
||||||
{
|
{
|
||||||
m_doneFirstSceneRefresh = false;
|
m_sceneDropdown.OnCancel(null);
|
||||||
RefreshActiveScenes();
|
RefreshActiveScenes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshActiveScenes()
|
private void RefreshActiveScenes()
|
||||||
{
|
{
|
||||||
string mainActiveScene = SceneManager.GetActiveScene().name;
|
var names = new List<string>();
|
||||||
List<string> otherScenes = new List<string>();
|
var handles = new List<int>();
|
||||||
List<int> validHandles = new List<int>();
|
|
||||||
|
|
||||||
for (int i = 0; i < SceneManager.sceneCount; i++)
|
for (int i = 0; i < SceneManager.sceneCount; i++)
|
||||||
{
|
{
|
||||||
Scene scene = SceneManager.GetSceneAt(i);
|
Scene scene = SceneManager.GetSceneAt(i);
|
||||||
|
|
||||||
if (scene == null || string.IsNullOrEmpty(scene.name))
|
int handle = scene.handle;
|
||||||
{
|
|
||||||
|
if (scene == null || handle == -1 || string.IsNullOrEmpty(scene.name))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
StoreScenehandle(scene);
|
handles.Add(handle);
|
||||||
validHandles.Add(scene.handle);
|
names.Add(scene.name);
|
||||||
|
|
||||||
if (m_doneFirstSceneRefresh || scene.name != mainActiveScene)
|
|
||||||
{
|
|
||||||
otherScenes.Add(scene.name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
otherScenes.Add("DontDestroyOnLoad");
|
|
||||||
validHandles.Add(GetSceneHandle("DontDestroyOnLoad"));
|
names.Add("DontDestroyOnLoad");
|
||||||
|
handles.Add(DontDestroyHandle);
|
||||||
|
|
||||||
m_sceneDropdown.options.Clear();
|
m_sceneDropdown.options.Clear();
|
||||||
|
|
||||||
if (!m_doneFirstSceneRefresh)
|
foreach (string scene in names)
|
||||||
{
|
|
||||||
m_sceneDropdown.options.Add(new Dropdown.OptionData
|
|
||||||
{
|
|
||||||
text = mainActiveScene
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string scene in otherScenes)
|
|
||||||
{
|
{
|
||||||
m_sceneDropdown.options.Add(new Dropdown.OptionData
|
m_sceneDropdown.options.Add(new Dropdown.OptionData
|
||||||
{
|
{
|
||||||
@ -144,12 +140,12 @@ namespace ExplorerBeta.UI.Main
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_doneFirstSceneRefresh || !validHandles.Contains(m_currentSceneHandle))
|
if (!handles.Contains(m_currentSceneHandle))
|
||||||
{
|
{
|
||||||
SetScene(mainActiveScene);
|
ExplorerCore.Log("Reverting to default scene");
|
||||||
|
m_sceneDropdown.transform.Find("Label").GetComponent<Text>().text = names[0];
|
||||||
|
SetScene(handles[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_doneFirstSceneRefresh = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetScene(string name) => SetScene(GetSceneHandle(name));
|
public void SetScene(string name) => SetScene(GetSceneHandle(name));
|
||||||
@ -157,9 +153,7 @@ namespace ExplorerBeta.UI.Main
|
|||||||
public void SetScene(int handle)
|
public void SetScene(int handle)
|
||||||
{
|
{
|
||||||
if (handle == -1)
|
if (handle == -1)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
m_currentSceneHandle = handle;
|
m_currentSceneHandle = handle;
|
||||||
|
|
||||||
@ -235,24 +229,14 @@ namespace ExplorerBeta.UI.Main
|
|||||||
{
|
{
|
||||||
newCount++;
|
newCount++;
|
||||||
|
|
||||||
// still updating from gameobject list.
|
|
||||||
// check first if the reference has changed for this index.
|
|
||||||
|
|
||||||
if (i + startIndex >= objects.Length)
|
if (i + startIndex >= objects.Length)
|
||||||
{
|
{
|
||||||
// execeeded actual list, but not yet reached previous limit.
|
|
||||||
// disable remaining buttons.
|
|
||||||
|
|
||||||
if (i > m_lastCount || i >= m_sceneListTexts.Count)
|
if (i > m_lastCount || i >= m_sceneListTexts.Count)
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
GameObject obj = m_sceneListTexts[i].transform.parent.parent.gameObject;
|
GameObject label = m_sceneListTexts[i].transform.parent.parent.gameObject;
|
||||||
if (obj.activeSelf)
|
if (label.activeSelf)
|
||||||
{
|
label.SetActive(false);
|
||||||
obj.SetActive(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -261,24 +245,27 @@ namespace ExplorerBeta.UI.Main
|
|||||||
if (i >= m_sceneShortList.Count)
|
if (i >= m_sceneShortList.Count)
|
||||||
{
|
{
|
||||||
m_sceneShortList.Add(obj);
|
m_sceneShortList.Add(obj);
|
||||||
if (i >= m_sceneListTexts.Count)
|
AddSceneButton();
|
||||||
{
|
|
||||||
AddSceneButton();
|
|
||||||
m_sceneListActiveStates.Add(obj.activeSelf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_sceneShortList[i] = obj;
|
m_sceneShortList[i] = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sceneListTexts[i].text = obj.name;
|
var text = m_sceneListTexts[i];
|
||||||
m_sceneListTexts[i].color = obj.activeSelf ? Color.green : Color.red;
|
|
||||||
|
|
||||||
GameObject parent = m_sceneListTexts[i].transform.parent.parent.gameObject;
|
var name = obj.name;
|
||||||
if (!parent.activeSelf)
|
|
||||||
|
if (obj.transform.childCount > 0)
|
||||||
|
name = $"<color=grey>[{obj.transform.childCount}]</color> {name}";
|
||||||
|
|
||||||
|
text.text = name;
|
||||||
|
text.color = obj.activeSelf ? Color.green : Color.red;
|
||||||
|
|
||||||
|
var label = text.transform.parent.parent.gameObject;
|
||||||
|
if (!label.activeSelf)
|
||||||
{
|
{
|
||||||
parent.SetActive(true);
|
label.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -401,8 +388,12 @@ namespace ExplorerBeta.UI.Main
|
|||||||
inspectButtonLayout.minWidth = 65;
|
inspectButtonLayout.minWidth = 65;
|
||||||
inspectButtonLayout.flexibleWidth = 0;
|
inspectButtonLayout.flexibleWidth = 0;
|
||||||
Button inspectButton = m_mainInspectBtn.GetComponent<Button>();
|
Button inspectButton = m_mainInspectBtn.GetComponent<Button>();
|
||||||
|
#if CPP
|
||||||
inspectButton.onClick.AddListener(new Action(() => { InspectorManager.Instance.Inspect(m_selectedSceneObject); }));
|
inspectButton.onClick.AddListener(new Action(() => { InspectorManager.Instance.Inspect(m_selectedSceneObject); }));
|
||||||
|
|
||||||
|
#else
|
||||||
|
inspectButton.onClick.AddListener(() => { InspectorManager.Instance.Inspect(m_selectedSceneObject); });
|
||||||
|
#endif
|
||||||
GameObject scrollObj = UIFactory.CreateScrollView(leftPane, out m_sceneListCanvas, new Color(0.1f, 0.1f, 0.1f));
|
GameObject scrollObj = UIFactory.CreateScrollView(leftPane, out m_sceneListCanvas, new Color(0.1f, 0.1f, 0.1f));
|
||||||
Scrollbar scroll = scrollObj.transform.Find("Scrollbar Vertical").GetComponent<Scrollbar>();
|
Scrollbar scroll = scrollObj.transform.Find("Scrollbar Vertical").GetComponent<Scrollbar>();
|
||||||
ColorBlock colors = scroll.colors;
|
ColorBlock colors = scroll.colors;
|
||||||
@ -448,7 +439,7 @@ namespace ExplorerBeta.UI.Main
|
|||||||
#if CPP
|
#if CPP
|
||||||
mainBtn.onClick.AddListener(new Action(() => { SceneListObjectClicked(thisIndex); }));
|
mainBtn.onClick.AddListener(new Action(() => { SceneListObjectClicked(thisIndex); }));
|
||||||
#else
|
#else
|
||||||
btn.onClick.AddListener(() => { SceneButtonClicked(thisIndex); });
|
mainBtn.onClick.AddListener(() => { SceneListObjectClicked(thisIndex); });
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
||||||
@ -470,9 +461,13 @@ namespace ExplorerBeta.UI.Main
|
|||||||
inspectColors.normalColor = new Color(0.15f, 0.15f, 0.15f);
|
inspectColors.normalColor = new Color(0.15f, 0.15f, 0.15f);
|
||||||
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 0.5f);
|
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 0.5f);
|
||||||
inspectBtn.colors = inspectColors;
|
inspectBtn.colors = inspectColors;
|
||||||
|
#if CPP
|
||||||
inspectBtn.onClick.AddListener(new Action(() => { InspectorManager.Instance.Inspect(m_sceneShortList[thisIndex]); }));
|
inspectBtn.onClick.AddListener(new Action(() => { InspectorManager.Instance.Inspect(m_sceneShortList[thisIndex]); }));
|
||||||
|
#else
|
||||||
|
inspectBtn.onClick.AddListener(() => { InspectorManager.Instance.Inspect(m_sceneShortList[thisIndex]); });
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -547,14 +547,14 @@ namespace ExplorerBeta.UI
|
|||||||
itemLabelText.alignment = TextAnchor.MiddleLeft;
|
itemLabelText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
Image itemBgImage = itemBgObj.AddComponent<Image>();
|
Image itemBgImage = itemBgObj.AddComponent<Image>();
|
||||||
itemBgImage.color = new Color(0.35f, 0.35f, 0.35f, 1.0f);
|
itemBgImage.color = new Color(0.25f, 0.45f, 0.25f, 1.0f);
|
||||||
|
|
||||||
Toggle itemToggle = itemObj.AddComponent<Toggle>();
|
Toggle itemToggle = itemObj.AddComponent<Toggle>();
|
||||||
itemToggle.targetGraphic = itemBgImage;
|
itemToggle.targetGraphic = itemBgImage;
|
||||||
itemToggle.isOn = true;
|
itemToggle.isOn = true;
|
||||||
ColorBlock colors = itemToggle.colors;
|
ColorBlock colors = itemToggle.colors;
|
||||||
colors.normalColor = new Color(0.35f, 0.35f, 0.35f, 1.0f);
|
colors.normalColor = new Color(0.35f, 0.35f, 0.35f, 1.0f);
|
||||||
colors.highlightedColor = new Color(0.35f, 0.65f, 0.35f, 1.0f);
|
colors.highlightedColor = new Color(0.25f, 0.45f, 0.25f, 1.0f);
|
||||||
itemToggle.colors = colors;
|
itemToggle.colors = colors;
|
||||||
|
|
||||||
#if CPP
|
#if CPP
|
||||||
@ -609,7 +609,7 @@ namespace ExplorerBeta.UI
|
|||||||
labelRect.anchorMin = Vector2.zero;
|
labelRect.anchorMin = Vector2.zero;
|
||||||
labelRect.anchorMax = Vector2.one;
|
labelRect.anchorMax = Vector2.one;
|
||||||
labelRect.offsetMin = new Vector2(10f, 6f);
|
labelRect.offsetMin = new Vector2(10f, 6f);
|
||||||
labelRect.offsetMax = new Vector2(-25f, -7f);
|
labelRect.offsetMax = new Vector2(-28f, -7f);
|
||||||
|
|
||||||
RectTransform templateRect = templateObj.GetComponent<RectTransform>();
|
RectTransform templateRect = templateObj.GetComponent<RectTransform>();
|
||||||
templateRect.anchorMin = new Vector2(0f, 0f);
|
templateRect.anchorMin = new Vector2(0f, 0f);
|
||||||
@ -634,7 +634,7 @@ namespace ExplorerBeta.UI
|
|||||||
RectTransform itemRect = itemObj.GetComponent<RectTransform>();
|
RectTransform itemRect = itemObj.GetComponent<RectTransform>();
|
||||||
itemRect.anchorMin = new Vector2(0f, 0.5f);
|
itemRect.anchorMin = new Vector2(0f, 0.5f);
|
||||||
itemRect.anchorMax = new Vector2(1f, 0.5f);
|
itemRect.anchorMax = new Vector2(1f, 0.5f);
|
||||||
itemRect.sizeDelta = new Vector2(0f, 20f);
|
itemRect.sizeDelta = new Vector2(0f, 25f);
|
||||||
|
|
||||||
RectTransform itemBgRect = itemBgObj.GetComponent<RectTransform>();
|
RectTransform itemBgRect = itemBgObj.GetComponent<RectTransform>();
|
||||||
itemBgRect.anchorMin = Vector2.zero;
|
itemBgRect.anchorMin = Vector2.zero;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using ExplorerBeta.Helpers;
|
using ExplorerBeta.Helpers;
|
||||||
|
using UnityEngine;
|
||||||
#if CPP
|
#if CPP
|
||||||
using UnhollowerBaseLib;
|
using UnhollowerBaseLib;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#if CPP
|
using System;
|
||||||
using System;
|
|
||||||
using ExplorerBeta.Helpers;
|
using ExplorerBeta.Helpers;
|
||||||
|
using ExplorerBeta.UI.Main;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
@ -8,8 +8,22 @@ namespace ExplorerBeta.Unstrip.Scenes
|
|||||||
{
|
{
|
||||||
public class SceneUnstrip
|
public class SceneUnstrip
|
||||||
{
|
{
|
||||||
|
public static GameObject[] GetRootGameObjects(Scene scene) => scene.GetRootGameObjects();
|
||||||
|
|
||||||
|
public static GameObject[] GetRootGameObjects(int handle)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < SceneManager.sceneCount; i++)
|
||||||
|
{
|
||||||
|
var scene = SceneManager.GetSceneAt(i);
|
||||||
|
if (scene.handle == handle)
|
||||||
|
return scene.GetRootGameObjects();
|
||||||
|
}
|
||||||
|
return new GameObject[0];
|
||||||
|
}
|
||||||
|
|
||||||
//Scene.GetRootGameObjects();
|
//Scene.GetRootGameObjects();
|
||||||
|
|
||||||
|
#if CPP
|
||||||
internal delegate void d_GetRootGameObjects(int handle, IntPtr list);
|
internal delegate void d_GetRootGameObjects(int handle, IntPtr list);
|
||||||
|
|
||||||
public static GameObject[] GetRootGameObjects(Scene scene) => GetRootGameObjects(scene.handle);
|
public static GameObject[] GetRootGameObjects(Scene scene) => GetRootGameObjects(scene.handle);
|
||||||
@ -41,6 +55,6 @@ namespace ExplorerBeta.Unstrip.Scenes
|
|||||||
GetRootCountInternal_delegate iCall = ICallHelper.GetICall<GetRootCountInternal_delegate>("UnityEngine.SceneManagement.Scene::GetRootCountInternal");
|
GetRootCountInternal_delegate iCall = ICallHelper.GetICall<GetRootCountInternal_delegate>("UnityEngine.SceneManagement.Scene::GetRootCountInternal");
|
||||||
return iCall.Invoke(handle);
|
return iCall.Invoke(handle);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
Loading…
x
Reference in New Issue
Block a user