This commit is contained in:
sinaioutlander 2020-11-05 17:33:04 +11:00
parent a46bc11e42
commit e175e9c438
47 changed files with 890 additions and 336 deletions

View File

@ -4,10 +4,10 @@ using System.Linq;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
#if CPP
#endif
using UnityExplorer.UI;
using UnityExplorer.UI.PageModel;
namespace UnityExplorer.UI.Main.Console
namespace UnityExplorer.Console
{
public class AutoCompleter
{
@ -17,7 +17,7 @@ namespace UnityExplorer.UI.Main.Console
private const int UPDATES_PER_BATCH = 100;
public static GameObject m_mainObj;
private static RectTransform m_thisRect;
//private static RectTransform m_thisRect;
private static readonly List<GameObject> m_suggestionButtons = new List<GameObject>();
private static readonly List<Text> m_suggestionTexts = new List<Text>();
@ -259,7 +259,7 @@ namespace UnityExplorer.UI.Main.Console
m_mainObj = obj;
var mainRect = obj.GetComponent<RectTransform>();
m_thisRect = mainRect;
//m_thisRect = mainRect;
mainRect.pivot = new Vector2(0f, 1f);
mainRect.anchorMin = new Vector2(0.45f, 0.45f);
mainRect.anchorMax = new Vector2(0.65f, 0.6f);

View File

@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Text;
using UnityExplorer.UI.Main.Console.Lexer;
using UnityExplorer.Console.Lexer;
using UnityEngine;
namespace UnityExplorer.UI.Main.Console
namespace UnityExplorer.Console
{
public static class CSharpLexer
{

View File

@ -2,13 +2,15 @@
using System.Linq;
using System.Text;
using UnityExplorer.Input;
using UnityExplorer.UI.Main.Console.Lexer;
using UnityExplorer.Console.Lexer;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityExplorer.UI;
using UnityExplorer.UI.PageModel;
namespace UnityExplorer.UI.Main.Console
namespace UnityExplorer.Console
{
public class CodeEditor
{

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace UnityExplorer.UI.Main.Console.Lexer
namespace UnityExplorer.Console.Lexer
{
public sealed class CommentMatch : Matcher
{

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace UnityExplorer.UI.Main.Console.Lexer
namespace UnityExplorer.Console.Lexer
{
public struct LexerMatchInfo
{

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace UnityExplorer.UI.Main.Console.Lexer
namespace UnityExplorer.Console.Lexer
{
public sealed class KeywordMatch : Matcher
{

View File

@ -2,7 +2,7 @@
using UnityExplorer.Unstrip.ColorUtility;
using UnityEngine;
namespace UnityExplorer.UI.Main.Console.Lexer
namespace UnityExplorer.Console.Lexer
{
public abstract class Matcher
{

View File

@ -1,6 +1,6 @@
using UnityEngine;
namespace UnityExplorer.UI.Main.Console.Lexer
namespace UnityExplorer.Console.Lexer
{
public sealed class NumberMatch : Matcher
{

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace UnityExplorer.UI.Main.Console.Lexer
namespace UnityExplorer.Console.Lexer
{
public sealed class StringMatch : Matcher
{

View File

@ -2,7 +2,7 @@
using System.Linq;
using UnityEngine;
namespace UnityExplorer.UI.Main.Console.Lexer
namespace UnityExplorer.Console.Lexer
{
public sealed class SymbolMatch : Matcher
{

View File

@ -6,7 +6,7 @@ using Mono.CSharp;
// Thanks to ManlyMarco for this
namespace UnityExplorer.UI.Main.Console
namespace UnityExplorer.Console
{
public class ScriptEvaluator : Evaluator, IDisposable
{

View File

@ -1,7 +1,10 @@
using System;
using Mono.CSharp;
using UnityExplorer.UI;
using UnityExplorer.UI.PageModel;
using UnityExplorer.Inspectors;
namespace UnityExplorer.UI.Main.Console
namespace UnityExplorer.Console
{
public class ScriptInteraction : InteractiveBase
{

View File

@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityExplorer.Helpers;
namespace UnityExplorer.UI.Main.Console
namespace UnityExplorer.Console
{
public struct Suggestion
{

View File

@ -7,6 +7,7 @@ using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
#if CPP
using UnhollowerRuntimeLib;
using BepInEx.IL2CPP;
@ -14,40 +15,58 @@ using BepInEx.IL2CPP;
namespace UnityExplorer
{
#if MONO
[BepInPlugin(ExplorerCore.GUID, "UnityExplorer", ExplorerCore.VERSION)]
#if CPP
public class ExplorerBepInPlugin : BasePlugin
#else
public class ExplorerBepInPlugin : BaseUnityPlugin
#endif
{
public static ExplorerBepInPlugin Instance;
public static ManualLogSource Logging =>
#if CPP
Instance?.Log;
#else
Instance?.Logger;
#endif
public static ManualLogSource Logging => Instance?.Logger;
public static readonly Harmony HarmonyInstance = new Harmony(ExplorerCore.GUID);
#if CPP
// temporary for Il2Cpp until scene change delegate works
private static string lastSceneName;
#endif
// Init
#if CPP
public override void Load()
{
#else
internal void Awake()
{
#endif
Instance = this;
SceneManager.activeSceneChanged += DoSceneChange;
new ExplorerCore();
HarmonyInstance.PatchAll();
}
internal static void DoSceneChange(Scene arg0, Scene arg1)
{
ExplorerCore.OnSceneChange();
}
internal void Update()
{
ExplorerCore.Update();
}
}
#endif
#if CPP
[BepInPlugin(ExplorerCore.GUID, "UnityExplorer", ExplorerCore.VERSION)]
public class ExplorerBepInPlugin : BasePlugin
{
public static ExplorerBepInPlugin Instance;
public static ManualLogSource Logging => Instance?.Log;
public static readonly Harmony HarmonyInstance = new Harmony(ExplorerCore.GUID);
// temporary for Il2Cpp until scene change delegate works
private static string lastSceneName;
// Init
public override void Load()
{
Instance = this;
ClassInjector.RegisterTypeInIl2Cpp<ExplorerBehaviour>();
var obj = new GameObject(
@ -58,13 +77,10 @@ namespace UnityExplorer
}
);
GameObject.DontDestroyOnLoad(obj);
#else
SceneManager.activeSceneChanged += DoSceneChange;
#endif
new ExplorerCore();
// HarmonyInstance.PatchAll();
HarmonyInstance.PatchAll();
}
internal static void DoSceneChange(Scene arg0, Scene arg1)
@ -72,7 +88,7 @@ namespace UnityExplorer
ExplorerCore.OnSceneChange();
}
#if CPP // BepInEx Il2Cpp mod class doesn't have monobehaviour methods yet, so wrap them in a dummy.
// BepInEx Il2Cpp mod class doesn't have monobehaviour methods yet, so wrap them in a dummy.
public class ExplorerBehaviour : MonoBehaviour
{
public ExplorerBehaviour(IntPtr ptr) : base(ptr) { }
@ -82,23 +98,20 @@ namespace UnityExplorer
Logging.LogMessage("ExplorerBehaviour.Awake");
}
#endif
internal void Update()
{
ExplorerCore.Update();
#if CPP
var scene = SceneManager.GetActiveScene();
if (scene.name != lastSceneName)
{
lastSceneName = scene.name;
DoSceneChange(scene, scene);
}
#endif
}
}
#if CPP
}
#endif
}
}
#endif

View File

@ -2,7 +2,7 @@
using UnityExplorer.Config;
using UnityExplorer.Input;
using UnityExplorer.UI;
using UnityExplorer.UI.Main;
using UnityExplorer.UI.PageModel;
using UnityEngine;
namespace UnityExplorer

View File

@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityExplorer.Helpers;
namespace UnityExplorer
{
public static class ReflectionExtensions
{
#if CPP
public static object Il2CppCast(this object obj, Type castTo)
{
return ReflectionHelpers.Il2CppCast(obj, castTo);
}
#endif
public static IEnumerable<Type> TryGetTypes(this Assembly asm)
{
try
{
return asm.GetTypes();
}
catch (ReflectionTypeLoadException e)
{
try
{
return asm.GetExportedTypes();
}
catch
{
return e.Types.Where(t => t != null);
}
}
catch
{
return Enumerable.Empty<Type>();
}
}
}
}

View File

@ -1,20 +0,0 @@
using UnityEngine;
namespace UnityExplorer
{
public static class UnityExtensions
{
public static string GetTransformPath(this Transform t, bool includeThisName = false)
{
string path = includeThisName ? t.transform.name : "";
while (t.parent != null)
{
t = t.parent;
path = $"{t.name}/{path}";
}
return path;
}
}
}

View File

@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
using BF = System.Reflection.BindingFlags;
@ -16,7 +17,7 @@ using System.Runtime.InteropServices;
namespace UnityExplorer.Helpers
{
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "External methods")]
public class ReflectionHelpers
public static class ReflectionHelpers
{
public static BF CommonFlags = BF.Public | BF.Instance | BF.NonPublic | BF.Static;
@ -37,7 +38,13 @@ namespace UnityExplorer.Helpers
#if CPP
private static readonly Dictionary<Type, IntPtr> ClassPointers = new Dictionary<Type, IntPtr>();
public static object Il2CppCast(object obj, Type castTo)
[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern bool il2cpp_class_is_assignable_from(IntPtr klass, IntPtr oklass);
[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr il2cpp_object_get_class(IntPtr obj);
public static object Il2CppCast(this object obj, Type castTo)
{
if (!(obj is Il2CppSystem.Object ilObj))
{
@ -79,15 +86,31 @@ namespace UnityExplorer.Helpers
return Activator.CreateInstance(castTo, ilObj.Pointer);
}
[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern bool il2cpp_class_is_assignable_from(IntPtr klass, IntPtr oklass);
[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr il2cpp_object_get_class(IntPtr obj);
#endif
public static IEnumerable<Type> TryGetTypes(this Assembly asm)
{
try
{
return asm.GetTypes();
}
catch (ReflectionTypeLoadException e)
{
try
{
return asm.GetExportedTypes();
}
catch
{
return e.Types.Where(t => t != null);
}
}
catch
{
return Enumerable.Empty<Type>();
}
}
public static Type GetTypeByName(string fullName)
{
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())

View File

@ -53,7 +53,7 @@ namespace UnityExplorer.Helpers
}
}
public static Texture2D Copy(Texture2D orig, Rect rect, bool isDTXnmNormal = false)
public static Texture2D Copy(Texture2D orig, Rect rect) //, bool isDTXnmNormal = false)
{
Color[] pixels;

View File

@ -2,7 +2,7 @@
namespace UnityExplorer.Helpers
{
public class UnityHelpers
public static class UnityHelpers
{
private static Camera m_mainCamera;
@ -25,5 +25,23 @@ namespace UnityExplorer.Helpers
return UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
}
}
public static string ToStringLong(this Vector3 vec)
{
return $"X: {vec.x:F3}, Y: {vec.y:F3}, Z: {vec.z:F3}";
}
public static string GetTransformPath(this Transform t, bool includeThisName = false)
{
string path = includeThisName ? t.transform.name : "";
while (t.parent != null)
{
t = t.parent;
path = $"{t.name}/{path}";
}
return path;
}
}
}

View File

@ -2,24 +2,23 @@
using System.Collections.Generic;
using System.Linq;
using UnityExplorer.Helpers;
using UnityExplorer.UI;
using UnityExplorer.UI.Shared;
using UnityExplorer.Unstrip.ColorUtility;
using UnityExplorer.Unstrip.LayerMasks;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.Unstrip.LayerMasks;
using UnityExplorer.Input;
namespace UnityExplorer.UI.Main.Inspectors
namespace UnityExplorer.Inspectors
{
// TODO:
// fix path and name input for very long input (use content size fitter + preffered size + vert layout group)
// make back button (inspect parent button)
// make controls panel (transform controls, set parent, etc)
public class GameObjectInspector : InspectorBase
{
public override string TabLabel => $" [G] {TargetGO?.name}";
public static GameObjectInspector ActiveInstance { get; private set; }
// just to help with casting in il2cpp
public GameObject TargetGO;
@ -27,14 +26,17 @@ namespace UnityExplorer.UI.Main.Inspectors
private static bool m_UIConstructed;
private static GameObject m_content;
private static GameObject s_content;
public override GameObject Content
{
get => m_content;
set => m_content = value;
get => s_content;
set => s_content = value;
}
// cached ui elements
private static ScrollRect s_contentScroll;
private static float s_lastScrollPos;
public static TMP_InputField m_nameInput;
private static string m_lastName;
public static TMP_InputField m_pathInput;
@ -69,8 +71,26 @@ namespace UnityExplorer.UI.Main.Inspectors
private static int s_lastCompCount;
public static readonly List<Toggle> s_compToggles = new List<Toggle>();
// gameobject controls inputs
private static TMP_InputField s_setParentInput;
private static ControlEditor s_positionControl;
private static ControlEditor s_localPosControl;
private static ControlEditor s_rotationControl;
private static ControlEditor s_scaleControl;
internal struct ControlEditor
{
public TMP_InputField fullValue;
public Slider[] sliders;
public TMP_InputField[] inputs;
public Text[] values;
}
public GameObjectInspector(GameObject target) : base(target)
{
ActiveInstance = this;
TargetGO = target;
if (!TargetGO)
@ -87,21 +107,51 @@ namespace UnityExplorer.UI.Main.Inspectors
}
}
public override void SetContentActive()
{
base.SetContentActive();
ActiveInstance = this;
}
public override void SetContentInactive()
{
base.SetContentInactive();
ActiveInstance = null;
}
public override void Update()
{
base.Update();
if (m_pendingDestroy || InspectorManager.Instance.m_activeInspector != this)
{
if (m_pendingDestroy || ActiveInstance != this)
return;
}
if (!s_sliderChangedWanted)
s_lastScrollPos = s_contentScroll.verticalScrollbar.value;
RefreshTopInfo();
RefreshChildObjectList();
RefreshComponentList();
RefreshControls();
if (s_sliderChangedWanted)
{
UpdateSliderControl();
}
}
private void ChangeInspectorTarget(GameObject newTarget)
{
if (!newTarget)
return;
this.Target = this.TargetGO = newTarget;
}
#region TOP INFO
private void RefreshTopInfo()
{
@ -153,6 +203,38 @@ namespace UnityExplorer.UI.Main.Inspectors
}
}
private static void OnApplyNameClicked()
{
if (ActiveInstance == null) return;
ActiveInstance.TargetGO.name = m_nameInput.text;
}
private static void OnEnableToggled(bool enabled)
{
if (ActiveInstance == null) return;
ActiveInstance.TargetGO.SetActive(enabled);
}
private static void OnLayerSelected(int layer)
{
if (ActiveInstance == null) return;
ActiveInstance.TargetGO.layer = layer;
}
private static void OnCompToggleClicked(int index, bool value)
{
var comp = s_compShortlist[index];
(comp as Behaviour).enabled = value;
}
#endregion
#region CHILD LIST
private void RefreshChildObjectList()
{
s_allChildren = new GameObject[TargetGO.transform.childCount];
@ -223,6 +305,38 @@ namespace UnityExplorer.UI.Main.Inspectors
s_lastChildCount = newCount;
}
private static void OnChildListObjectClicked(int index)
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
if (index >= s_childrenShortlist.Count || !s_childrenShortlist[index])
{
return;
}
instance.ChangeInspectorTarget(s_childrenShortlist[index]);
instance.Update();
}
private static void OnBackButtonClicked()
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
instance.ChangeInspectorTarget(instance.TargetGO.transform.parent.gameObject);
}
private static void OnChildListPageTurn()
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
instance.RefreshChildObjectList();
}
#endregion
#region COMPONENT LIST
private void RefreshComponentList()
{
s_allComps = TargetGO.GetComponents<Component>().ToArray();
@ -296,76 +410,6 @@ namespace UnityExplorer.UI.Main.Inspectors
s_lastCompCount = newCount;
}
private void ChangeInspectorTarget(GameObject newTarget)
{
if (!newTarget)
return;
this.Target = this.TargetGO = newTarget;
}
private static void ApplyNameClicked()
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
instance.TargetGO.name = m_nameInput.text;
}
private static void OnEnableToggled(bool enabled)
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
instance.TargetGO.SetActive(enabled);
}
private static void OnLayerSelected(int layer)
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
instance.TargetGO.layer = layer;
}
private static void OnCompToggleClicked(int index, bool value)
{
var comp = s_compShortlist[index];
(comp as Behaviour).enabled = value;
}
#region CHILD LIST
private static void OnChildListObjectClicked(int index)
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
if (index >= s_childrenShortlist.Count || !s_childrenShortlist[index])
{
return;
}
instance.ChangeInspectorTarget(s_childrenShortlist[index]);
instance.Update();
}
private static void OnBackButtonClicked()
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
instance.ChangeInspectorTarget(instance.TargetGO.transform.parent.gameObject);
}
private static void OnChildListPageTurn()
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
instance.RefreshChildObjectList();
}
#endregion
#region COMPONENT LIST
private static void OnCompListObjectClicked(int index)
{
if (index >= s_compShortlist.Count || !s_compShortlist[index])
@ -385,13 +429,213 @@ namespace UnityExplorer.UI.Main.Inspectors
#endregion
#region TRANSFORM CONTROLS
private void RefreshControls()
{
s_positionControl.fullValue.text = TargetGO.transform.position.ToStringLong();
s_positionControl.values[0].text = TargetGO.transform.position.x.ToString("F3");
s_positionControl.values[1].text = TargetGO.transform.position.y.ToString("F3");
s_positionControl.values[2].text = TargetGO.transform.position.z.ToString("F3");
s_localPosControl.fullValue.text = TargetGO.transform.localPosition.ToStringLong();
s_localPosControl.values[0].text = TargetGO.transform.position.x.ToString("F3");
s_localPosControl.values[1].text = TargetGO.transform.position.y.ToString("F3");
s_localPosControl.values[2].text = TargetGO.transform.position.z.ToString("F3");
s_rotationControl.fullValue.text = TargetGO.transform.eulerAngles.ToStringLong();
s_rotationControl.values[0].text = TargetGO.transform.position.x.ToString("F3");
s_rotationControl.values[1].text = TargetGO.transform.position.y.ToString("F3");
s_rotationControl.values[2].text = TargetGO.transform.position.z.ToString("F3");
s_scaleControl.fullValue.text = TargetGO.transform.localScale.ToStringLong();
s_scaleControl.values[0].text = TargetGO.transform.position.x.ToString("F3");
s_scaleControl.values[1].text = TargetGO.transform.position.y.ToString("F3");
s_scaleControl.values[2].text = TargetGO.transform.position.z.ToString("F3");
}
private static void OnSetParentClicked()
{
var input = s_setParentInput.text;
ExplorerCore.Log("Todo set parent to '" + input + "'");
}
internal enum ControlType
{
position,
localPosition,
eulerAngles,
localScale
}
internal enum VectorValue
{
x, y, z
};
private static bool s_sliderChangedWanted;
private static Slider s_currentSlider;
private static ControlType s_currentSliderType;
private static VectorValue s_currentSliderValueType;
private static float s_currentSliderValue;
private static void OnSliderControlChanged(float value, Slider slider, ControlType controlType, VectorValue vectorValue)
{
if (value == 0)
s_sliderChangedWanted = false;
else
{
if (!s_sliderChangedWanted)
{
s_sliderChangedWanted = true;
s_currentSlider = slider;
s_currentSliderType = controlType;
s_currentSliderValueType = vectorValue;
//ExplorerCore.LogWarning("Starting slide with scroll value of " + s_lastScrollPos);
}
s_currentSliderValue = value;
}
}
private static void UpdateSliderControl()
{
//s_contentScroll.verticalNormalizedPosition = s_lastScrollPos;
////s_contentScroll.verticalScrollbar.value = s_lastScrollPos;
//ExplorerCore.Log("Set scroll pos to " + s_lastScrollPos);
if (!InputManager.GetMouseButton(0))
{
s_sliderChangedWanted = false;
s_currentSlider.value = 0;
return;
}
if (ActiveInstance == null) return;
var transform = ActiveInstance.TargetGO.transform;
// get the current vector for the control type
Vector3 vector = Vector2.zero;
switch (s_currentSliderType)
{
case ControlType.position:
vector = transform.position; break;
case ControlType.localPosition:
vector = transform.localPosition; break;
case ControlType.eulerAngles:
vector = transform.eulerAngles; break;
case ControlType.localScale:
vector = transform.localScale; break;
}
// apply vector value change
switch (s_currentSliderValueType)
{
case VectorValue.x:
vector.x += s_currentSliderValue; break;
case VectorValue.y:
vector.y += s_currentSliderValue; break;
case VectorValue.z:
vector.z += s_currentSliderValue; break;
}
// set vector to transform member
switch (s_currentSliderType)
{
case ControlType.position:
transform.position = vector; break;
case ControlType.localPosition:
transform.localPosition = vector; break;
case ControlType.eulerAngles:
transform.eulerAngles = vector; break;
case ControlType.localScale:
transform.localScale = vector; break;
}
}
private static void OnVectorControlInputApplied(ControlType controlType, VectorValue vectorValue)
{
if (!(InspectorManager.Instance.m_activeInspector is GameObjectInspector instance)) return;
// get relevant input for controltype + value
TMP_InputField[] inputs = null;
switch (controlType)
{
case ControlType.position:
inputs = s_positionControl.inputs; break;
case ControlType.localPosition:
inputs = s_localPosControl.inputs; break;
case ControlType.eulerAngles:
inputs = s_rotationControl.inputs; break;
case ControlType.localScale:
inputs = s_scaleControl.inputs; break;
}
TMP_InputField input = inputs[(int)vectorValue];
float val = float.Parse(input.text);
// apply transform value
Vector3 vector = Vector3.zero;
var transform = instance.TargetGO.transform;
switch (controlType)
{
case ControlType.position:
vector = transform.position; break;
case ControlType.localPosition:
vector = transform.localPosition; break;
case ControlType.eulerAngles:
vector = transform.eulerAngles; break;
case ControlType.localScale:
vector = transform.localScale; break;
}
switch (vectorValue)
{
case VectorValue.x:
vector.x = val; break;
case VectorValue.y:
vector.y = val; break;
case VectorValue.z:
vector.z = val; break;
}
// set back to transform
switch (controlType)
{
case ControlType.position:
transform.position = vector; break;
case ControlType.localPosition:
transform.localPosition = vector; break;
case ControlType.eulerAngles:
transform.eulerAngles = vector; break;
case ControlType.localScale:
transform.localScale = vector; break;
}
}
#endregion
#region UI CONSTRUCTION
private void ConstructUI()
{
var parent = InspectorManager.Instance.m_inspectorContent;
m_content = UIFactory.CreateScrollView(parent, out GameObject scrollContent, new Color(0.1f, 0.1f, 0.1f));
s_content = UIFactory.CreateScrollView(parent, out GameObject scrollContent, new Color(0.1f, 0.1f, 0.1f));
s_contentScroll = s_content.GetComponent<ScrollRect>();
//s_contentScroll.onValueChanged.AddListener((Vector2 val) =>
//{
// if (s_sliderChangedWanted)
// {
// s_contentScroll.verticalNormalizedPosition = s_lastScrollPos;
// }
//});
var scrollGroup = scrollContent.GetComponent<VerticalLayoutGroup>();
scrollGroup.childForceExpandHeight = false;
@ -400,21 +644,26 @@ namespace UnityExplorer.UI.Main.Inspectors
ConstructTopArea(scrollContent);
var midGroupObj = UIFactory.CreateHorizontalGroup(scrollContent, new Color(1,1,1,0));
var midGroup = midGroupObj.GetComponent<HorizontalLayoutGroup>();
midGroup.spacing = 5;
midGroup.childForceExpandWidth = true;
midGroup.childControlWidth = true;
var midlayout = midGroupObj.AddComponent<LayoutElement>();
midlayout.minHeight = 40;
midlayout.flexibleHeight = 10000;
midlayout.flexibleWidth = 25000;
midlayout.minWidth = 200;
ConstructChildList(midGroupObj);
ConstructCompList(midGroupObj);
ConstructControls(scrollContent);
// not sure if i'll use this mid group...
//var midGroupObj = UIFactory.CreateHorizontalGroup(scrollContent, new Color(1,1,1,0));
//var midGroup = midGroupObj.GetComponent<HorizontalLayoutGroup>();
//midGroup.spacing = 5;
//midGroup.childForceExpandWidth = true;
//midGroup.childControlWidth = true;
//midGroup.childForceExpandHeight = true;
//midGroup.childControlHeight = false;
//var midlayout = midGroupObj.AddComponent<LayoutElement>();
//midlayout.minHeight = 40;
//midlayout.flexibleHeight = 10000;
//midlayout.flexibleWidth = 25000;
//midlayout.minWidth = 200;
ConstructChildList(scrollContent);
ConstructCompList(scrollContent);
}
private void ConstructTopArea(GameObject scrollContent)
@ -439,7 +688,7 @@ namespace UnityExplorer.UI.Main.Inspectors
#if CPP
backButton.onClick.AddListener(new Action(OnBackButtonClicked));
#else
backButton.onClick.AddListener(OnBackButtonClicked());
backButton.onClick.AddListener(OnBackButtonClicked);
#endif
var backText = backButtonObj.GetComponentInChildren<Text>();
backText.text = "<";
@ -517,7 +766,7 @@ namespace UnityExplorer.UI.Main.Inspectors
#if CPP
applyNameBtn.onClick.AddListener(new Action(() => { ApplyNameClicked(); }));
#else
applyNameBtn.onClick.AddListener(() => { ApplyNameClicked(); });
applyNameBtn.onClick.AddListener(() => { OnApplyNameClicked(); });
#endif
var applyNameText = applyNameBtnObj.GetComponentInChildren<Text>();
applyNameText.text = "Apply";
@ -615,6 +864,9 @@ namespace UnityExplorer.UI.Main.Inspectors
var vertLayout = vertGroupObj.AddComponent<LayoutElement>();
vertLayout.minWidth = 120;
vertLayout.flexibleWidth = 25000;
vertLayout.minHeight = 150;
vertLayout.flexibleHeight = 5000;
vertLayout.preferredHeight = 250;
var childTitleObj = UIFactory.CreateLabel(vertGroupObj, TextAnchor.MiddleLeft);
var childTitleText = childTitleObj.GetComponent<Text>();
@ -624,6 +876,10 @@ namespace UnityExplorer.UI.Main.Inspectors
var childTitleLayout = childTitleObj.AddComponent<LayoutElement>();
childTitleLayout.minHeight = 30;
s_childListPageHandler = new PageHandler();
s_childListPageHandler.ConstructUI(vertGroupObj);
s_childListPageHandler.OnPageChanged += OnChildListPageTurn;
var childrenScrollObj = UIFactory.CreateScrollView(vertGroupObj, out s_childListContent, new Color(0.07f, 0.07f, 0.07f));
var contentLayout = childrenScrollObj.AddComponent<LayoutElement>();
contentLayout.minHeight = 50;
@ -638,10 +894,6 @@ namespace UnityExplorer.UI.Main.Inspectors
var childGroup = s_childListContent.GetComponent<VerticalLayoutGroup>();
childGroup.childControlHeight = true;
childGroup.spacing = 2;
s_childListPageHandler = new PageHandler();
s_childListPageHandler.ConstructUI(vertGroupObj);
s_childListPageHandler.OnPageChanged += OnChildListPageTurn;
}
private void AddChildListButton()
@ -693,6 +945,9 @@ namespace UnityExplorer.UI.Main.Inspectors
var vertLayout = vertGroupObj.AddComponent<LayoutElement>();
vertLayout.minWidth = 120;
vertLayout.flexibleWidth = 25000;
vertLayout.minHeight = 150;
vertLayout.flexibleHeight = 5000;
vertLayout.preferredHeight = 250;
var compTitleObj = UIFactory.CreateLabel(vertGroupObj, TextAnchor.MiddleLeft);
var compTitleText = compTitleObj.GetComponent<Text>();
@ -702,6 +957,10 @@ namespace UnityExplorer.UI.Main.Inspectors
var childTitleLayout = compTitleObj.AddComponent<LayoutElement>();
childTitleLayout.minHeight = 30;
s_compListPageHandler = new PageHandler();
s_compListPageHandler.ConstructUI(vertGroupObj);
s_compListPageHandler.OnPageChanged += OnCompListPageTurn;
var compScrollObj = UIFactory.CreateScrollView(vertGroupObj, out s_compListContent, new Color(0.07f, 0.07f, 0.07f));
var contentLayout = compScrollObj.AddComponent<LayoutElement>();
contentLayout.minHeight = 50;
@ -716,10 +975,6 @@ namespace UnityExplorer.UI.Main.Inspectors
var scrollRect = compScrollObj.GetComponentInChildren<ScrollRect>();
scrollRect.horizontalScrollbar = null;
s_compListPageHandler = new PageHandler();
s_compListPageHandler.ConstructUI(vertGroupObj);
s_compListPageHandler.OnPageChanged += OnCompListPageTurn;
}
private void AddCompListButton()
@ -739,6 +994,8 @@ namespace UnityExplorer.UI.Main.Inspectors
btnLayout.flexibleHeight = 0;
btnGroupObj.AddComponent<Mask>();
// Behaviour enabled toggle
var toggleObj = UIFactory.CreateToggle(btnGroupObj, out Toggle toggle, out Text toggleText);
var togBg = toggleObj.transform.Find("Background").GetComponent<Image>();
togBg.color = new Color(0.1f, 0.1f, 0.1f, 1);
@ -747,6 +1004,9 @@ namespace UnityExplorer.UI.Main.Inspectors
toggleLayout.flexibleWidth = 0;
toggleLayout.minHeight = 25;
toggleLayout.flexibleHeight = 0;
var checkImg = toggleObj.transform.Find("Background/Checkmark").GetComponent<Image>();
checkImg.color = SyntaxColors.Class_Instance.ToColor();
checkImg.color *= 0.66f;
#if CPP
toggle.onValueChanged.AddListener(new Action<bool>((bool val) => { OnCompToggleClicked(thisIndex, val); }));
#else
@ -755,6 +1015,8 @@ namespace UnityExplorer.UI.Main.Inspectors
toggleText.text = "";
s_compToggles.Add(toggle);
// Main component button
GameObject mainButtonObj = UIFactory.CreateButton(btnGroupObj);
LayoutElement mainBtnLayout = mainButtonObj.AddComponent<LayoutElement>();
mainBtnLayout.minHeight = 25;
@ -772,27 +1034,31 @@ namespace UnityExplorer.UI.Main.Inspectors
mainBtn.onClick.AddListener(() => { OnCompListObjectClicked(thisIndex); });
#endif
// Component button text
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
mainText.alignment = TextAnchor.MiddleLeft;
mainText.horizontalOverflow = HorizontalWrapMode.Overflow;
mainText.color = Syntax.Class_Instance.ToColor();
mainText.color = SyntaxColors.Class_Instance.ToColor();
s_compListTexts.Add(mainText);
// TODO remove component button
}
private const int CONTROLS_MAX_HEIGHT = 220;
//private const int CONTROLS_MIN_HEIGHT = 220;
private void ConstructControls(GameObject scrollContent)
private void ConstructControls(GameObject parent)
{
var controlsObj = UIFactory.CreateVerticalGroup(scrollContent, new Color(0.07f, 0.07f, 0.07f));
var controlsObj = UIFactory.CreateVerticalGroup(parent, new Color(0.07f, 0.07f, 0.07f));
var controlsGroup = controlsObj.GetComponent<VerticalLayoutGroup>();
controlsGroup.childForceExpandWidth = false;
controlsGroup.childControlWidth = true;
controlsGroup.childForceExpandHeight = false;
var controlsLayout = controlsObj.AddComponent<LayoutElement>();
controlsLayout.minHeight = CONTROLS_MAX_HEIGHT;
controlsLayout.flexibleHeight = 0;
controlsLayout.minWidth = 250;
controlsLayout.flexibleWidth = 9000;
controlsGroup.spacing = 5;
controlsGroup.padding.top = 4;
controlsGroup.padding.left = 4;
controlsGroup.padding.right = 4;
controlsGroup.padding.bottom = 4;
// ~~~~~~ Top row ~~~~~~
@ -806,13 +1072,46 @@ namespace UnityExplorer.UI.Main.Inspectors
var hideButtonObj = UIFactory.CreateButton(topRow);
var hideButton = hideButtonObj.GetComponent<Button>();
var hideColors = hideButton.colors;
hideColors.normalColor = new Color(0.16f, 0.16f, 0.16f);
hideButton.colors = hideColors;
var hideText = hideButtonObj.GetComponentInChildren<Text>();
hideText.text = "v";
hideText.text = "Show";
hideText.fontSize = 14;
var hideButtonLayout = hideButtonObj.AddComponent<LayoutElement>();
hideButtonLayout.minWidth = 40;
hideButtonLayout.flexibleWidth = 0;
hideButtonLayout.minHeight = 25;
hideButtonLayout.flexibleHeight = 0;
var topTitle = UIFactory.CreateLabel(topRow, TextAnchor.MiddleLeft);
var topText = topTitle.GetComponent<Text>();
topText.text = "Transform Controls";
var titleLayout = topTitle.AddComponent<LayoutElement>();
titleLayout.minWidth = 100;
titleLayout.flexibleWidth = 9500;
titleLayout.minHeight = 25;
//// ~~~~~~~~ Content ~~~~~~~~ //
//var contentObj = UIFactory.CreateVerticalGroup(controlsObj, new Color(1, 1, 1, 0));
//contentObj.SetActive(false);
//var contentGroup = contentObj.GetComponent<VerticalLayoutGroup>();
//contentGroup.childForceExpandHeight = false;
//contentGroup.childControlHeight = true;
//contentGroup.spacing = 5;
//contentGroup.childForceExpandWidth = true;
//contentGroup.childControlWidth = true;
var contentObj = UIFactory.CreateVerticalGroup(controlsObj, new Color(1, 1, 1, 0));
var contentGroup = contentObj.GetComponent<VerticalLayoutGroup>();
contentGroup.childForceExpandHeight = false;
contentGroup.childControlHeight = true;
contentGroup.spacing = 5;
contentGroup.childForceExpandWidth = true;
contentGroup.childControlWidth = true;
// ~~ add hide button callback now that we have scroll reference ~~
#if CPP
hideButton.onClick.AddListener(new Action(OnHideClicked));
#else
@ -820,26 +1119,261 @@ namespace UnityExplorer.UI.Main.Inspectors
#endif
void OnHideClicked()
{
if (controlsLayout.minHeight > 25)
if (hideText.text == "Show")
{
hideText.text = "^";
controlsLayout.minHeight = 25;
hideText.text = "Hide";
contentObj.SetActive(true);
}
else
{
hideText.text = "v";
controlsLayout.minHeight = CONTROLS_MAX_HEIGHT;
hideText.text = "Show";
contentObj.SetActive(false);
}
}
var topTitle = UIFactory.CreateLabel(topRow, TextAnchor.MiddleLeft);
var topText = topTitle.GetComponent<Text>();
topText.text = "GameObject Controls";
var titleLayout = topTitle.AddComponent<LayoutElement>();
titleLayout.minWidth = 100;
titleLayout.flexibleWidth = 9500;
// ~~~ set parent ~~~
var setParentGroupObj = UIFactory.CreateHorizontalGroup(contentObj, new Color(1, 1, 1, 0));
var setParentGroup = setParentGroupObj.GetComponent<HorizontalLayoutGroup>();
setParentGroup.childForceExpandHeight = false;
setParentGroup.childControlHeight = true;
setParentGroup.childForceExpandWidth = false;
setParentGroup.childControlWidth = true;
setParentGroup.spacing = 5;
var setParentLayout = setParentGroupObj.AddComponent<LayoutElement>();
setParentLayout.minHeight = 25;
setParentLayout.flexibleHeight = 0;
var setParentLabelObj = UIFactory.CreateLabel(setParentGroupObj, TextAnchor.MiddleLeft);
var setParentLabel = setParentLabelObj.GetComponent<Text>();
setParentLabel.text = "Set Parent:";
setParentLabel.color = Color.grey;
setParentLabel.fontSize = 14;
var setParentLabelLayout = setParentLabelObj.AddComponent<LayoutElement>();
setParentLabelLayout.minWidth = 110;
setParentLabelLayout.minHeight = 25;
setParentLabelLayout.flexibleWidth = 0;
var setParentInputObj = UIFactory.CreateTMPInput(setParentGroupObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
s_setParentInput = setParentInputObj.GetComponent<TMP_InputField>();
var placeholderInput = setParentInputObj.transform.Find("TextArea/Placeholder").GetComponent<TextMeshProUGUI>();
placeholderInput.text = "Enter a GameObject name or path...";
var setParentInputLayout = setParentInputObj.AddComponent<LayoutElement>();
setParentInputLayout.minHeight = 25;
setParentInputLayout.preferredWidth = 400;
setParentInputLayout.flexibleWidth = 9999;
var applyButtonObj = UIFactory.CreateButton(setParentGroupObj);
var applyButton = applyButtonObj.GetComponent<Button>();
#if CPP
applyButton.onClick.AddListener(new Action(OnSetParentClicked));
#else
applyButton.onClick.AddListener(OnSetParentClicked);
#endif
var applyText = applyButtonObj.GetComponentInChildren<Text>();
applyText.text = "Apply";
var applyLayout = applyButtonObj.AddComponent<LayoutElement>();
applyLayout.minWidth = 55;
applyLayout.flexibleWidth = 0;
applyLayout.minHeight = 25;
applyLayout.flexibleHeight = 0;
// transform controls
ConstructVector3Editor(contentObj, "Position", ControlType.position, out s_positionControl);
ConstructVector3Editor(contentObj, "Local Position", ControlType.localPosition, out s_localPosControl);
ConstructVector3Editor(contentObj, "Rotation", ControlType.eulerAngles, out s_rotationControl);
ConstructVector3Editor(contentObj, "Scale", ControlType.localScale, out s_scaleControl);
// todo bottom row buttons
// set controls content inactive now that content is made?
contentObj.SetActive(false);
}
private void ConstructVector3Editor(GameObject parent, string title, ControlType type, out ControlEditor editor)
{
editor = new ControlEditor();
var topBarObj = UIFactory.CreateHorizontalGroup(parent, new Color(1, 1, 1, 0));
var topGroup = topBarObj.GetComponent<HorizontalLayoutGroup>();
topGroup.childForceExpandWidth = false;
topGroup.childControlWidth = true;
topGroup.childForceExpandHeight = false;
topGroup.childControlHeight = true;
topGroup.spacing = 5;
var topLayout = topBarObj.AddComponent<LayoutElement>();
topLayout.minHeight = 25;
topLayout.flexibleHeight = 0;
var titleObj = UIFactory.CreateLabel(topBarObj, TextAnchor.MiddleLeft);
var titleText = titleObj.GetComponent<Text>();
titleText.text = title;
titleText.color = Color.grey;
titleText.fontSize = 14;
var titleLayout = titleObj.AddComponent<LayoutElement>();
titleLayout.minWidth = 110;
titleLayout.flexibleWidth = 0;
titleLayout.minHeight = 25;
// expand button
var expandButtonObj = UIFactory.CreateButton(topBarObj);
var expandButton = expandButtonObj.GetComponent<Button>();
var expandText = expandButtonObj.GetComponentInChildren<Text>();
expandText.text = "▼";
expandText.fontSize = 12;
var btnLayout = expandButtonObj.AddComponent<LayoutElement>();
btnLayout.minWidth = 35;
btnLayout.flexibleWidth = 0;
btnLayout.minHeight = 25;
btnLayout.flexibleHeight = 0;
// readonly value input
var valueInputObj = UIFactory.CreateTMPInput(topBarObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
var valueInput = valueInputObj.GetComponent<TMP_InputField>();
valueInput.readOnly = true;
var valueInputLayout = valueInputObj.AddComponent<LayoutElement>();
valueInputLayout.minHeight = 25;
valueInputLayout.flexibleHeight = 0;
valueInputLayout.preferredWidth = 400;
valueInputLayout.flexibleWidth = 9999;
editor.fullValue = valueInput;
editor.sliders = new Slider[3];
editor.inputs = new TMP_InputField[3];
editor.values = new Text[3];
var xRow = ConstructEditorRow(parent, editor, type, VectorValue.x);
xRow.SetActive(false);
var yRow = ConstructEditorRow(parent, editor, type, VectorValue.y);
yRow.SetActive(false);
var zRow = ConstructEditorRow(parent, editor, type, VectorValue.z);
zRow.SetActive(false);
// add expand callback now that we have group reference
#if CPP
expandButton.onClick.AddListener(new Action(ToggleExpand));
#else
expandButton.onClick.AddListener(ToggleExpand);
#endif
void ToggleExpand()
{
if (xRow.activeSelf)
{
xRow.SetActive(false);
yRow.SetActive(false);
zRow.SetActive(false);
expandText.text = "▼";
}
else
{
xRow.SetActive(true);
yRow.SetActive(true);
zRow.SetActive(true);
expandText.text = "▲";
}
}
}
private GameObject ConstructEditorRow(GameObject parent, ControlEditor editor, ControlType type, VectorValue vectorValue)
{
var rowObject = UIFactory.CreateHorizontalGroup(parent, new Color(1, 1, 1, 0));
var rowGroup = rowObject.GetComponent<HorizontalLayoutGroup>();
rowGroup.childForceExpandWidth = false;
rowGroup.childControlWidth = true;
rowGroup.childForceExpandHeight = false;
rowGroup.childControlHeight = true;
rowGroup.spacing = 5;
var rowLayout = rowObject.AddComponent<LayoutElement>();
rowLayout.minHeight = 25;
rowLayout.flexibleHeight = 0;
rowLayout.minWidth = 100;
// Value labels
var labelObj = UIFactory.CreateLabel(rowObject, TextAnchor.MiddleLeft);
var labelText = labelObj.GetComponent<Text>();
labelText.color = Color.cyan;
labelText.text = $"{vectorValue.ToString().ToUpper()}:";
labelText.fontSize = 14;
labelText.resizeTextMaxSize = 14;
labelText.resizeTextForBestFit = true;
var labelLayout = labelObj.AddComponent<LayoutElement>();
labelLayout.minHeight = 25;
labelLayout.flexibleHeight = 0;
labelLayout.minWidth = 25;
labelLayout.flexibleWidth = 0;
// actual value label
var valueLabelObj = UIFactory.CreateLabel(rowObject, TextAnchor.MiddleLeft);
var valueLabel = valueLabelObj.GetComponent<Text>();
editor.values[(int)vectorValue] = valueLabel;
var valueLabelLayout = valueLabelObj.AddComponent<LayoutElement>();
valueLabelLayout.minWidth = 85;
valueLabelLayout.flexibleWidth = 0;
valueLabelLayout.minHeight = 25;
// Slider
var sliderObj = UIFactory.CreateSlider(rowObject);
var sliderLayout = sliderObj.AddComponent<LayoutElement>();
sliderLayout.minHeight = 20;
sliderLayout.flexibleHeight = 0;
sliderLayout.minWidth = 200;
sliderLayout.flexibleWidth = 9000;
var slider = sliderObj.GetComponent<Slider>();
slider.minValue = -2;
slider.maxValue = 2;
slider.value = 0;
#if CPP
xSlider.onValueChanged.AddListener(new Action((float val) => { OnSliderControlChanged(val, xSlider, type, vectorValue); }));
#else
slider.onValueChanged.AddListener((float val) => { OnSliderControlChanged(val, slider, type, vectorValue); });
#endif
editor.sliders[(int)vectorValue] = slider;
// input field
var inputHolder = UIFactory.CreateVerticalGroup(rowObject, new Color(1, 1, 1, 0));
var inputHolderGroup = inputHolder.GetComponent<VerticalLayoutGroup>();
inputHolderGroup.childForceExpandHeight = false;
inputHolderGroup.childControlHeight = true;
inputHolderGroup.childForceExpandWidth = false;
inputHolderGroup.childControlWidth = true;
var inputObj = UIFactory.CreateTMPInput(inputHolder, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
var input = inputObj.GetComponent<TMP_InputField>();
input.characterValidation = TMP_InputField.CharacterValidation.Decimal;
var inputLayout = inputObj.AddComponent<LayoutElement>();
inputLayout.minHeight = 25;
inputLayout.flexibleHeight = 0;
inputLayout.minWidth = 90;
inputLayout.flexibleWidth = 50;
editor.inputs[(int)vectorValue] = input;
// apply button
var applyBtnObj = UIFactory.CreateButton(rowObject);
var applyBtn = applyBtnObj.GetComponent<Button>();
var applyText = applyBtnObj.GetComponentInChildren<Text>();
applyText.text = "Apply";
applyText.fontSize = 14;
var applyLayout = applyBtnObj.AddComponent<LayoutElement>();
applyLayout.minWidth = 60;
applyLayout.minHeight = 25;
applyBtn.onClick.AddListener(() => { OnVectorControlInputApplied(type, vectorValue); });
return rowObject;
}
#endregion

View File

@ -1,8 +1,9 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.UI;
namespace UnityExplorer.UI.Main.Inspectors
namespace UnityExplorer.Inspectors
{
public abstract class InspectorBase
{
@ -32,6 +33,16 @@ namespace UnityExplorer.UI.Main.Inspectors
AddInspectorTab();
}
public virtual void SetContentActive()
{
Content?.SetActive(true);
}
public virtual void SetContentInactive()
{
Content?.SetActive(false);
}
public virtual void Update()
{
if (ObjectNullOrDestroyed(Target, UnityTarget))

View File

@ -2,14 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using UnityExplorer.Helpers;
using UnityExplorer.UI.Main.Inspectors;
using UnityExplorer.UI.Shared;
using UnityExplorer.Unstrip.Scenes;
using UnityExplorer.UI;
using UnityExplorer.UI.PageModel;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
namespace UnityExplorer.UI.Main
namespace UnityExplorer.Inspectors
{
public class InspectorManager
{
@ -83,7 +82,7 @@ namespace UnityExplorer.UI.Main
}
m_currentInspectors.Add(inspector);
inspector.Content?.SetActive(false);
inspector.SetContentInactive();
SetInspectorTab(inspector);
}
@ -99,7 +98,7 @@ namespace UnityExplorer.UI.Main
m_activeInspector = inspector;
m_activeInspector.Content?.SetActive(true);
inspector.SetContentActive();
Color activeColor = new Color(0, 0.25f, 0, 1);
ColorBlock colors = inspector.tabButton.colors;
@ -115,7 +114,7 @@ namespace UnityExplorer.UI.Main
return;
}
m_activeInspector.Content?.SetActive(false);
m_activeInspector.SetContentInactive();
ColorBlock colors = m_activeInspector.tabButton.colors;
colors.normalColor = new Color(0.2f, 0.2f, 0.2f, 1);

View File

@ -1,7 +1,7 @@
using System;
using UnityExplorer.Helpers;
namespace UnityExplorer.UI.Main.Inspectors
namespace UnityExplorer.Inspectors
{
public class InstanceInspector : ReflectionInspector
{

View File

@ -5,7 +5,7 @@ using System.Text;
using UnityExplorer.Helpers;
using UnityEngine;
namespace UnityExplorer.UI.Main.Inspectors
namespace UnityExplorer.Inspectors
{
public class ReflectionInspector : InspectorBase
{

View File

@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityExplorer.Helpers;
using UnityExplorer.UI.Main.Inspectors;
using UnityExplorer.UI;
using UnityExplorer.UI.PageModel;
using UnityExplorer.UI.Shared;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityExplorer.Unstrip.Scenes;
namespace UnityExplorer.UI.Main
namespace UnityExplorer.Inspectors
{
public class SceneExplorer
{

View File

@ -1,6 +1,6 @@
using System;
namespace UnityExplorer.UI.Main.Inspectors
namespace UnityExplorer.Inspectors
{
public class StaticInspector : ReflectionInspector
{

View File

@ -7,7 +7,7 @@
//using UnityExplorer.Helpers;
//using UnityExplorer.UI.Shared;
//namespace UnityExplorer.UI
//namespace UnityExplorer.UI.InteractiveValue
//{
// public class InteractiveValue
// {

View File

@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using UnityExplorer.UI.Main.Console;
using UnityExplorer.Console;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.UI.PageModel;
namespace UnityExplorer.UI.Main
namespace UnityExplorer.UI
{
public class MainMenu
{

View File

@ -3,16 +3,17 @@ using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using UnityExplorer.UI.Main.Console;
using UnityExplorer.Console;
using UnityExplorer.Unstrip.Resources;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.Helpers;
#if CPP
using UnhollowerRuntimeLib;
#endif
namespace UnityExplorer.UI.Main
namespace UnityExplorer.UI.PageModel
{
public class ConsolePage : MainMenu.Page
{

View File

@ -4,10 +4,8 @@ using UnityExplorer.Unstrip.ColorUtility;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
#if CPP
#endif
namespace UnityExplorer.UI.Main
namespace UnityExplorer.UI.PageModel
{
public class DebugConsole
{

View File

@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.Inspectors;
namespace UnityExplorer.UI.Main
namespace UnityExplorer.UI.PageModel
{
public class HomePage : MainMenu.Page
{

View File

@ -1,4 +1,10 @@
namespace UnityExplorer.UI.Main
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
namespace UnityExplorer.UI.PageModel
{
public class OptionsPage : MainMenu.Page
{

View File

@ -1,4 +1,10 @@
namespace UnityExplorer.UI.Main
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
namespace UnityExplorer.UI.PageModel
{
public class SearchPage : MainMenu.Page
{

View File

@ -8,7 +8,7 @@ using System.IO;
using UnityExplorer.Unstrip.ImageConversion;
#endif
namespace UnityExplorer.UI.Main
namespace UnityExplorer.UI
{
// Handles dragging and resizing for the main explorer window.

View File

@ -1,6 +1,6 @@
namespace UnityExplorer.UI.Shared
{
public class Syntax
public class SyntaxColors
{
public const string Field_Static = "#8d8dc6";
public const string Field_Instance = "#c266ff";

View File

@ -437,6 +437,7 @@ namespace UnityExplorer.UI
GameObject placeHolderObj = CreateUIObject("Placeholder", textArea);
TextMeshProUGUI placeholderText = placeHolderObj.AddComponent<TextMeshProUGUI>();
placeholderText.fontSize = fontSize;
placeholderText.fontSizeMax = fontSize;
placeholderText.text = "...";
placeholderText.color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
placeholderText.overflowMode = (TextOverflowModes)overflowMode;
@ -457,6 +458,7 @@ namespace UnityExplorer.UI
GameObject inputTextObj = CreateUIObject("Text", textArea);
TextMeshProUGUI inputText = inputTextObj.AddComponent<TextMeshProUGUI>();
inputText.fontSize = fontSize;
inputText.fontSizeMax = fontSize;
inputText.text = "";
inputText.color = new Color(1f, 1f, 1f, 1f);
inputText.overflowMode = (TextOverflowModes)overflowMode;

View File

@ -1,7 +1,7 @@
using UnityExplorer.UI.Main;
using UnityEngine;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityExplorer.Inspectors;
namespace UnityExplorer.UI
{

View File

@ -327,20 +327,18 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CacheObject\CacheEnumerated.cs" />
<Compile Include="CacheObject\CacheFactory.cs" />
<Compile Include="CacheObject\CacheField.cs" />
<Compile Include="CacheObject\CacheMember.cs" />
<Compile Include="CacheObject\CacheMethod.cs" />
<Compile Include="CacheObject\CacheProperty.cs" />
<Compile Include="CacheObject\CacheObjectBase.cs" />
<Compile Include="Inspectors\CacheObject\CacheEnumerated.cs" />
<Compile Include="Inspectors\CacheObject\CacheFactory.cs" />
<Compile Include="Inspectors\CacheObject\CacheField.cs" />
<Compile Include="Inspectors\CacheObject\CacheMember.cs" />
<Compile Include="Inspectors\CacheObject\CacheMethod.cs" />
<Compile Include="Inspectors\CacheObject\CacheProperty.cs" />
<Compile Include="Inspectors\CacheObject\CacheObjectBase.cs" />
<Compile Include="Helpers\Texture2DHelpers.cs" />
<Compile Include="Config\ModConfig.cs" />
<Compile Include="ExplorerCore.cs" />
<Compile Include="ExplorerBepInPlugin.cs" />
<Compile Include="ExplorerMelonMod.cs" />
<Compile Include="Extensions\ReflectionExtensions.cs" />
<Compile Include="Extensions\UnityExtensions.cs" />
<Compile Include="Helpers\ReflectionHelpers.cs" />
<Compile Include="Helpers\UnityHelpers.cs" />
<Compile Include="UI\ForceUnlockCursor.cs" />
@ -350,36 +348,36 @@
<Compile Include="Input\InputSystem.cs" />
<Compile Include="Input\LegacyInput.cs" />
<Compile Include="Input\NoInput.cs" />
<Compile Include="UI\Main\DebugConsole.cs" />
<Compile Include="UI\Main\InspectorManager.cs" />
<Compile Include="UI\Main\Inspectors\ReflectionInspector.cs" />
<Compile Include="UI\Main\MainMenu.cs" />
<Compile Include="UI\Main\ConsolePage.cs" />
<Compile Include="UI\Main\Console\AutoCompleter.cs" />
<Compile Include="UI\Main\Console\CodeEditor.cs" />
<Compile Include="UI\Main\Console\CSharpLexer.cs" />
<Compile Include="UI\Main\Console\Lexer\CommentMatch.cs" />
<Compile Include="UI\Main\Console\Lexer\InputLexer.cs" />
<Compile Include="UI\Main\Console\Lexer\KeywordMatch.cs" />
<Compile Include="UI\Main\Console\Lexer\StringMatch.cs" />
<Compile Include="UI\Main\Console\Lexer\Matcher.cs" />
<Compile Include="UI\Main\Console\Lexer\NumberMatch.cs" />
<Compile Include="UI\Main\Console\Lexer\SymbolMatch.cs" />
<Compile Include="UI\Main\Console\Suggestion.cs" />
<Compile Include="UI\Main\Console\ScriptEvaluator.cs" />
<Compile Include="UI\Main\Console\ScriptInteraction.cs" />
<Compile Include="UI\Main\HomePage.cs" />
<Compile Include="UI\Main\Inspectors\GameObjectInspector.cs" />
<Compile Include="UI\Main\Inspectors\InspectorBase.cs" />
<Compile Include="UI\Main\Inspectors\InstanceInspector.cs" />
<Compile Include="UI\Main\Inspectors\StaticInspector.cs" />
<Compile Include="UI\Main\OptionsPage.cs" />
<Compile Include="UI\Main\SceneExplorer.cs" />
<Compile Include="UI\Main\SearchPage.cs" />
<Compile Include="UI\Main\PanelDragger.cs" />
<Compile Include="UI\PageModel\DebugConsole.cs" />
<Compile Include="Inspectors\InspectorManager.cs" />
<Compile Include="Inspectors\ReflectionInspector.cs" />
<Compile Include="UI\MainMenu.cs" />
<Compile Include="UI\PageModel\ConsolePage.cs" />
<Compile Include="Console\AutoCompleter.cs" />
<Compile Include="Console\CodeEditor.cs" />
<Compile Include="Console\CSharpLexer.cs" />
<Compile Include="Console\Lexer\CommentMatch.cs" />
<Compile Include="Console\Lexer\InputLexer.cs" />
<Compile Include="Console\Lexer\KeywordMatch.cs" />
<Compile Include="Console\Lexer\StringMatch.cs" />
<Compile Include="Console\Lexer\Matcher.cs" />
<Compile Include="Console\Lexer\NumberMatch.cs" />
<Compile Include="Console\Lexer\SymbolMatch.cs" />
<Compile Include="Console\Suggestion.cs" />
<Compile Include="Console\ScriptEvaluator.cs" />
<Compile Include="Console\ScriptInteraction.cs" />
<Compile Include="UI\PageModel\HomePage.cs" />
<Compile Include="Inspectors\GameObjectInspector.cs" />
<Compile Include="Inspectors\InspectorBase.cs" />
<Compile Include="Inspectors\InstanceInspector.cs" />
<Compile Include="Inspectors\StaticInspector.cs" />
<Compile Include="UI\PageModel\OptionsPage.cs" />
<Compile Include="Inspectors\SceneExplorer.cs" />
<Compile Include="UI\PageModel\SearchPage.cs" />
<Compile Include="UI\PanelDragger.cs" />
<Compile Include="UI\InteractiveValue\InteractiveValue.cs" />
<Compile Include="UI\Shared\PageHandler.cs" />
<Compile Include="UI\Shared\Syntax.cs" />
<Compile Include="UI\Shared\SyntaxColors.cs" />
<Compile Include="UI\UIManager.cs" />
<Compile Include="Unstrip\ColorUtility\ColorUtilityUnstrip.cs" />
<Compile Include="Unstrip\ImageConversion\ImageConversionUnstrip.cs" />
@ -394,9 +392,7 @@
<None Include="ILRepack.targets" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="UI\MouseInspector\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\ILRepack.Lib.MSBuild.Task.2.0.18.1\build\ILRepack.Lib.MSBuild.Task.targets" Condition="Exists('packages\ILRepack.Lib.MSBuild.Task.2.0.18.1\build\ILRepack.Lib.MSBuild.Task.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -1,8 +1,8 @@
using System;
using UnityExplorer.Helpers;
using UnityExplorer.UI.Main;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityExplorer.Inspectors;
namespace UnityExplorer.Unstrip.Scenes
{