mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 14:17:51 +08:00
refactor
This commit is contained in:
parent
a46bc11e42
commit
e175e9c438
@ -4,10 +4,10 @@ using System.Linq;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
#if CPP
|
using UnityExplorer.UI;
|
||||||
#endif
|
using UnityExplorer.UI.PageModel;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console
|
namespace UnityExplorer.Console
|
||||||
{
|
{
|
||||||
public class AutoCompleter
|
public class AutoCompleter
|
||||||
{
|
{
|
||||||
@ -17,7 +17,7 @@ namespace UnityExplorer.UI.Main.Console
|
|||||||
private const int UPDATES_PER_BATCH = 100;
|
private const int UPDATES_PER_BATCH = 100;
|
||||||
|
|
||||||
public static GameObject m_mainObj;
|
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<GameObject> m_suggestionButtons = new List<GameObject>();
|
||||||
private static readonly List<Text> m_suggestionTexts = new List<Text>();
|
private static readonly List<Text> m_suggestionTexts = new List<Text>();
|
||||||
@ -259,7 +259,7 @@ namespace UnityExplorer.UI.Main.Console
|
|||||||
m_mainObj = obj;
|
m_mainObj = obj;
|
||||||
|
|
||||||
var mainRect = obj.GetComponent<RectTransform>();
|
var mainRect = obj.GetComponent<RectTransform>();
|
||||||
m_thisRect = mainRect;
|
//m_thisRect = mainRect;
|
||||||
mainRect.pivot = new Vector2(0f, 1f);
|
mainRect.pivot = new Vector2(0f, 1f);
|
||||||
mainRect.anchorMin = new Vector2(0.45f, 0.45f);
|
mainRect.anchorMin = new Vector2(0.45f, 0.45f);
|
||||||
mainRect.anchorMax = new Vector2(0.65f, 0.6f);
|
mainRect.anchorMax = new Vector2(0.65f, 0.6f);
|
@ -1,9 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.UI.Main.Console.Lexer;
|
using UnityExplorer.Console.Lexer;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console
|
namespace UnityExplorer.Console
|
||||||
{
|
{
|
||||||
public static class CSharpLexer
|
public static class CSharpLexer
|
||||||
{
|
{
|
@ -2,13 +2,15 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.Input;
|
using UnityExplorer.Input;
|
||||||
using UnityExplorer.UI.Main.Console.Lexer;
|
using UnityExplorer.Console.Lexer;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
using UnityExplorer.UI.PageModel;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console
|
namespace UnityExplorer.Console
|
||||||
{
|
{
|
||||||
public class CodeEditor
|
public class CodeEditor
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console.Lexer
|
namespace UnityExplorer.Console.Lexer
|
||||||
{
|
{
|
||||||
public sealed class CommentMatch : Matcher
|
public sealed class CommentMatch : Matcher
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console.Lexer
|
namespace UnityExplorer.Console.Lexer
|
||||||
{
|
{
|
||||||
public struct LexerMatchInfo
|
public struct LexerMatchInfo
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console.Lexer
|
namespace UnityExplorer.Console.Lexer
|
||||||
{
|
{
|
||||||
public sealed class KeywordMatch : Matcher
|
public sealed class KeywordMatch : Matcher
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using UnityExplorer.Unstrip.ColorUtility;
|
using UnityExplorer.Unstrip.ColorUtility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console.Lexer
|
namespace UnityExplorer.Console.Lexer
|
||||||
{
|
{
|
||||||
public abstract class Matcher
|
public abstract class Matcher
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console.Lexer
|
namespace UnityExplorer.Console.Lexer
|
||||||
{
|
{
|
||||||
public sealed class NumberMatch : Matcher
|
public sealed class NumberMatch : Matcher
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console.Lexer
|
namespace UnityExplorer.Console.Lexer
|
||||||
{
|
{
|
||||||
public sealed class StringMatch : Matcher
|
public sealed class StringMatch : Matcher
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console.Lexer
|
namespace UnityExplorer.Console.Lexer
|
||||||
{
|
{
|
||||||
public sealed class SymbolMatch : Matcher
|
public sealed class SymbolMatch : Matcher
|
||||||
{
|
{
|
@ -6,7 +6,7 @@ using Mono.CSharp;
|
|||||||
|
|
||||||
// Thanks to ManlyMarco for this
|
// Thanks to ManlyMarco for this
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console
|
namespace UnityExplorer.Console
|
||||||
{
|
{
|
||||||
public class ScriptEvaluator : Evaluator, IDisposable
|
public class ScriptEvaluator : Evaluator, IDisposable
|
||||||
{
|
{
|
@ -1,7 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using Mono.CSharp;
|
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
|
public class ScriptInteraction : InteractiveBase
|
||||||
{
|
{
|
@ -3,8 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Console
|
namespace UnityExplorer.Console
|
||||||
{
|
{
|
||||||
public struct Suggestion
|
public struct Suggestion
|
||||||
{
|
{
|
@ -7,6 +7,7 @@ using BepInEx.Logging;
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using UnityEngine.UI;
|
||||||
#if CPP
|
#if CPP
|
||||||
using UnhollowerRuntimeLib;
|
using UnhollowerRuntimeLib;
|
||||||
using BepInEx.IL2CPP;
|
using BepInEx.IL2CPP;
|
||||||
@ -14,40 +15,58 @@ using BepInEx.IL2CPP;
|
|||||||
|
|
||||||
namespace UnityExplorer
|
namespace UnityExplorer
|
||||||
{
|
{
|
||||||
|
#if MONO
|
||||||
[BepInPlugin(ExplorerCore.GUID, "UnityExplorer", ExplorerCore.VERSION)]
|
[BepInPlugin(ExplorerCore.GUID, "UnityExplorer", ExplorerCore.VERSION)]
|
||||||
#if CPP
|
|
||||||
public class ExplorerBepInPlugin : BasePlugin
|
|
||||||
#else
|
|
||||||
public class ExplorerBepInPlugin : BaseUnityPlugin
|
public class ExplorerBepInPlugin : BaseUnityPlugin
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
public static ExplorerBepInPlugin Instance;
|
public static ExplorerBepInPlugin Instance;
|
||||||
|
|
||||||
public static ManualLogSource Logging =>
|
public static ManualLogSource Logging => Instance?.Logger;
|
||||||
#if CPP
|
|
||||||
Instance?.Log;
|
|
||||||
#else
|
|
||||||
Instance?.Logger;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public static readonly Harmony HarmonyInstance = new Harmony(ExplorerCore.GUID);
|
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()
|
internal void Awake()
|
||||||
{
|
{
|
||||||
#endif
|
|
||||||
Instance = this;
|
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
|
#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>();
|
ClassInjector.RegisterTypeInIl2Cpp<ExplorerBehaviour>();
|
||||||
|
|
||||||
var obj = new GameObject(
|
var obj = new GameObject(
|
||||||
@ -58,13 +77,10 @@ namespace UnityExplorer
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
GameObject.DontDestroyOnLoad(obj);
|
GameObject.DontDestroyOnLoad(obj);
|
||||||
#else
|
|
||||||
SceneManager.activeSceneChanged += DoSceneChange;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
new ExplorerCore();
|
new ExplorerCore();
|
||||||
|
|
||||||
// HarmonyInstance.PatchAll();
|
HarmonyInstance.PatchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void DoSceneChange(Scene arg0, Scene arg1)
|
internal static void DoSceneChange(Scene arg0, Scene arg1)
|
||||||
@ -72,7 +88,7 @@ namespace UnityExplorer
|
|||||||
ExplorerCore.OnSceneChange();
|
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 class ExplorerBehaviour : MonoBehaviour
|
||||||
{
|
{
|
||||||
public ExplorerBehaviour(IntPtr ptr) : base(ptr) { }
|
public ExplorerBehaviour(IntPtr ptr) : base(ptr) { }
|
||||||
@ -82,23 +98,20 @@ namespace UnityExplorer
|
|||||||
Logging.LogMessage("ExplorerBehaviour.Awake");
|
Logging.LogMessage("ExplorerBehaviour.Awake");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
internal void Update()
|
internal void Update()
|
||||||
{
|
{
|
||||||
ExplorerCore.Update();
|
ExplorerCore.Update();
|
||||||
|
|
||||||
#if CPP
|
|
||||||
var scene = SceneManager.GetActiveScene();
|
var scene = SceneManager.GetActiveScene();
|
||||||
if (scene.name != lastSceneName)
|
if (scene.name != lastSceneName)
|
||||||
{
|
{
|
||||||
lastSceneName = scene.name;
|
lastSceneName = scene.name;
|
||||||
DoSceneChange(scene, scene);
|
DoSceneChange(scene, scene);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#if CPP
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UnityExplorer.Input;
|
using UnityExplorer.Input;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Main;
|
using UnityExplorer.UI.PageModel;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer
|
namespace UnityExplorer
|
||||||
|
@ -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>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using BF = System.Reflection.BindingFlags;
|
using BF = System.Reflection.BindingFlags;
|
||||||
@ -16,7 +17,7 @@ using System.Runtime.InteropServices;
|
|||||||
namespace UnityExplorer.Helpers
|
namespace UnityExplorer.Helpers
|
||||||
{
|
{
|
||||||
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "External methods")]
|
[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;
|
public static BF CommonFlags = BF.Public | BF.Instance | BF.NonPublic | BF.Static;
|
||||||
|
|
||||||
@ -37,7 +38,13 @@ namespace UnityExplorer.Helpers
|
|||||||
#if CPP
|
#if CPP
|
||||||
private static readonly Dictionary<Type, IntPtr> ClassPointers = new Dictionary<Type, IntPtr>();
|
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))
|
if (!(obj is Il2CppSystem.Object ilObj))
|
||||||
{
|
{
|
||||||
@ -79,15 +86,31 @@ namespace UnityExplorer.Helpers
|
|||||||
|
|
||||||
return Activator.CreateInstance(castTo, ilObj.Pointer);
|
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
|
#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)
|
public static Type GetTypeByName(string fullName)
|
||||||
{
|
{
|
||||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||||
|
@ -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;
|
Color[] pixels;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace UnityExplorer.Helpers
|
namespace UnityExplorer.Helpers
|
||||||
{
|
{
|
||||||
public class UnityHelpers
|
public static class UnityHelpers
|
||||||
{
|
{
|
||||||
private static Camera m_mainCamera;
|
private static Camera m_mainCamera;
|
||||||
|
|
||||||
@ -25,5 +25,23 @@ namespace UnityExplorer.Helpers
|
|||||||
return UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,24 +2,23 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.Shared;
|
||||||
using UnityExplorer.Unstrip.ColorUtility;
|
using UnityExplorer.Unstrip.ColorUtility;
|
||||||
|
using UnityExplorer.Unstrip.LayerMasks;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
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 class GameObjectInspector : InspectorBase
|
||||||
{
|
{
|
||||||
public override string TabLabel => $" [G] {TargetGO?.name}";
|
public override string TabLabel => $" [G] {TargetGO?.name}";
|
||||||
|
|
||||||
|
public static GameObjectInspector ActiveInstance { get; private set; }
|
||||||
|
|
||||||
// just to help with casting in il2cpp
|
// just to help with casting in il2cpp
|
||||||
public GameObject TargetGO;
|
public GameObject TargetGO;
|
||||||
|
|
||||||
@ -27,14 +26,17 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
|
|
||||||
private static bool m_UIConstructed;
|
private static bool m_UIConstructed;
|
||||||
|
|
||||||
private static GameObject m_content;
|
private static GameObject s_content;
|
||||||
public override GameObject Content
|
public override GameObject Content
|
||||||
{
|
{
|
||||||
get => m_content;
|
get => s_content;
|
||||||
set => m_content = value;
|
set => s_content = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cached ui elements
|
// cached ui elements
|
||||||
|
private static ScrollRect s_contentScroll;
|
||||||
|
private static float s_lastScrollPos;
|
||||||
|
|
||||||
public static TMP_InputField m_nameInput;
|
public static TMP_InputField m_nameInput;
|
||||||
private static string m_lastName;
|
private static string m_lastName;
|
||||||
public static TMP_InputField m_pathInput;
|
public static TMP_InputField m_pathInput;
|
||||||
@ -69,8 +71,26 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
private static int s_lastCompCount;
|
private static int s_lastCompCount;
|
||||||
public static readonly List<Toggle> s_compToggles = new List<Toggle>();
|
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)
|
public GameObjectInspector(GameObject target) : base(target)
|
||||||
{
|
{
|
||||||
|
ActiveInstance = this;
|
||||||
|
|
||||||
TargetGO = target;
|
TargetGO = target;
|
||||||
|
|
||||||
if (!TargetGO)
|
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()
|
public override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (m_pendingDestroy || InspectorManager.Instance.m_activeInspector != this)
|
if (m_pendingDestroy || ActiveInstance != this)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
if (!s_sliderChangedWanted)
|
||||||
|
s_lastScrollPos = s_contentScroll.verticalScrollbar.value;
|
||||||
|
|
||||||
RefreshTopInfo();
|
RefreshTopInfo();
|
||||||
|
|
||||||
RefreshChildObjectList();
|
RefreshChildObjectList();
|
||||||
|
|
||||||
RefreshComponentList();
|
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()
|
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()
|
private void RefreshChildObjectList()
|
||||||
{
|
{
|
||||||
s_allChildren = new GameObject[TargetGO.transform.childCount];
|
s_allChildren = new GameObject[TargetGO.transform.childCount];
|
||||||
@ -223,6 +305,38 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
s_lastChildCount = newCount;
|
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()
|
private void RefreshComponentList()
|
||||||
{
|
{
|
||||||
s_allComps = TargetGO.GetComponents<Component>().ToArray();
|
s_allComps = TargetGO.GetComponents<Component>().ToArray();
|
||||||
@ -296,76 +410,6 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
s_lastCompCount = newCount;
|
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)
|
private static void OnCompListObjectClicked(int index)
|
||||||
{
|
{
|
||||||
if (index >= s_compShortlist.Count || !s_compShortlist[index])
|
if (index >= s_compShortlist.Count || !s_compShortlist[index])
|
||||||
@ -385,13 +429,213 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
|
|
||||||
#endregion
|
#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
|
#region UI CONSTRUCTION
|
||||||
|
|
||||||
private void ConstructUI()
|
private void ConstructUI()
|
||||||
{
|
{
|
||||||
var parent = InspectorManager.Instance.m_inspectorContent;
|
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>();
|
var scrollGroup = scrollContent.GetComponent<VerticalLayoutGroup>();
|
||||||
scrollGroup.childForceExpandHeight = false;
|
scrollGroup.childForceExpandHeight = false;
|
||||||
@ -400,21 +644,26 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
|
|
||||||
ConstructTopArea(scrollContent);
|
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);
|
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)
|
private void ConstructTopArea(GameObject scrollContent)
|
||||||
@ -439,7 +688,7 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
#if CPP
|
#if CPP
|
||||||
backButton.onClick.AddListener(new Action(OnBackButtonClicked));
|
backButton.onClick.AddListener(new Action(OnBackButtonClicked));
|
||||||
#else
|
#else
|
||||||
backButton.onClick.AddListener(OnBackButtonClicked());
|
backButton.onClick.AddListener(OnBackButtonClicked);
|
||||||
#endif
|
#endif
|
||||||
var backText = backButtonObj.GetComponentInChildren<Text>();
|
var backText = backButtonObj.GetComponentInChildren<Text>();
|
||||||
backText.text = "<";
|
backText.text = "<";
|
||||||
@ -517,7 +766,7 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
#if CPP
|
#if CPP
|
||||||
applyNameBtn.onClick.AddListener(new Action(() => { ApplyNameClicked(); }));
|
applyNameBtn.onClick.AddListener(new Action(() => { ApplyNameClicked(); }));
|
||||||
#else
|
#else
|
||||||
applyNameBtn.onClick.AddListener(() => { ApplyNameClicked(); });
|
applyNameBtn.onClick.AddListener(() => { OnApplyNameClicked(); });
|
||||||
#endif
|
#endif
|
||||||
var applyNameText = applyNameBtnObj.GetComponentInChildren<Text>();
|
var applyNameText = applyNameBtnObj.GetComponentInChildren<Text>();
|
||||||
applyNameText.text = "Apply";
|
applyNameText.text = "Apply";
|
||||||
@ -615,6 +864,9 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
var vertLayout = vertGroupObj.AddComponent<LayoutElement>();
|
var vertLayout = vertGroupObj.AddComponent<LayoutElement>();
|
||||||
vertLayout.minWidth = 120;
|
vertLayout.minWidth = 120;
|
||||||
vertLayout.flexibleWidth = 25000;
|
vertLayout.flexibleWidth = 25000;
|
||||||
|
vertLayout.minHeight = 150;
|
||||||
|
vertLayout.flexibleHeight = 5000;
|
||||||
|
vertLayout.preferredHeight = 250;
|
||||||
|
|
||||||
var childTitleObj = UIFactory.CreateLabel(vertGroupObj, TextAnchor.MiddleLeft);
|
var childTitleObj = UIFactory.CreateLabel(vertGroupObj, TextAnchor.MiddleLeft);
|
||||||
var childTitleText = childTitleObj.GetComponent<Text>();
|
var childTitleText = childTitleObj.GetComponent<Text>();
|
||||||
@ -624,6 +876,10 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
var childTitleLayout = childTitleObj.AddComponent<LayoutElement>();
|
var childTitleLayout = childTitleObj.AddComponent<LayoutElement>();
|
||||||
childTitleLayout.minHeight = 30;
|
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 childrenScrollObj = UIFactory.CreateScrollView(vertGroupObj, out s_childListContent, new Color(0.07f, 0.07f, 0.07f));
|
||||||
var contentLayout = childrenScrollObj.AddComponent<LayoutElement>();
|
var contentLayout = childrenScrollObj.AddComponent<LayoutElement>();
|
||||||
contentLayout.minHeight = 50;
|
contentLayout.minHeight = 50;
|
||||||
@ -638,10 +894,6 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
var childGroup = s_childListContent.GetComponent<VerticalLayoutGroup>();
|
var childGroup = s_childListContent.GetComponent<VerticalLayoutGroup>();
|
||||||
childGroup.childControlHeight = true;
|
childGroup.childControlHeight = true;
|
||||||
childGroup.spacing = 2;
|
childGroup.spacing = 2;
|
||||||
|
|
||||||
s_childListPageHandler = new PageHandler();
|
|
||||||
s_childListPageHandler.ConstructUI(vertGroupObj);
|
|
||||||
s_childListPageHandler.OnPageChanged += OnChildListPageTurn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddChildListButton()
|
private void AddChildListButton()
|
||||||
@ -693,6 +945,9 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
var vertLayout = vertGroupObj.AddComponent<LayoutElement>();
|
var vertLayout = vertGroupObj.AddComponent<LayoutElement>();
|
||||||
vertLayout.minWidth = 120;
|
vertLayout.minWidth = 120;
|
||||||
vertLayout.flexibleWidth = 25000;
|
vertLayout.flexibleWidth = 25000;
|
||||||
|
vertLayout.minHeight = 150;
|
||||||
|
vertLayout.flexibleHeight = 5000;
|
||||||
|
vertLayout.preferredHeight = 250;
|
||||||
|
|
||||||
var compTitleObj = UIFactory.CreateLabel(vertGroupObj, TextAnchor.MiddleLeft);
|
var compTitleObj = UIFactory.CreateLabel(vertGroupObj, TextAnchor.MiddleLeft);
|
||||||
var compTitleText = compTitleObj.GetComponent<Text>();
|
var compTitleText = compTitleObj.GetComponent<Text>();
|
||||||
@ -702,6 +957,10 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
var childTitleLayout = compTitleObj.AddComponent<LayoutElement>();
|
var childTitleLayout = compTitleObj.AddComponent<LayoutElement>();
|
||||||
childTitleLayout.minHeight = 30;
|
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 compScrollObj = UIFactory.CreateScrollView(vertGroupObj, out s_compListContent, new Color(0.07f, 0.07f, 0.07f));
|
||||||
var contentLayout = compScrollObj.AddComponent<LayoutElement>();
|
var contentLayout = compScrollObj.AddComponent<LayoutElement>();
|
||||||
contentLayout.minHeight = 50;
|
contentLayout.minHeight = 50;
|
||||||
@ -716,10 +975,6 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
|
|
||||||
var scrollRect = compScrollObj.GetComponentInChildren<ScrollRect>();
|
var scrollRect = compScrollObj.GetComponentInChildren<ScrollRect>();
|
||||||
scrollRect.horizontalScrollbar = null;
|
scrollRect.horizontalScrollbar = null;
|
||||||
|
|
||||||
s_compListPageHandler = new PageHandler();
|
|
||||||
s_compListPageHandler.ConstructUI(vertGroupObj);
|
|
||||||
s_compListPageHandler.OnPageChanged += OnCompListPageTurn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCompListButton()
|
private void AddCompListButton()
|
||||||
@ -739,6 +994,8 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
btnLayout.flexibleHeight = 0;
|
btnLayout.flexibleHeight = 0;
|
||||||
btnGroupObj.AddComponent<Mask>();
|
btnGroupObj.AddComponent<Mask>();
|
||||||
|
|
||||||
|
// Behaviour enabled toggle
|
||||||
|
|
||||||
var toggleObj = UIFactory.CreateToggle(btnGroupObj, out Toggle toggle, out Text toggleText);
|
var toggleObj = UIFactory.CreateToggle(btnGroupObj, out Toggle toggle, out Text toggleText);
|
||||||
var togBg = toggleObj.transform.Find("Background").GetComponent<Image>();
|
var togBg = toggleObj.transform.Find("Background").GetComponent<Image>();
|
||||||
togBg.color = new Color(0.1f, 0.1f, 0.1f, 1);
|
togBg.color = new Color(0.1f, 0.1f, 0.1f, 1);
|
||||||
@ -747,6 +1004,9 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
toggleLayout.flexibleWidth = 0;
|
toggleLayout.flexibleWidth = 0;
|
||||||
toggleLayout.minHeight = 25;
|
toggleLayout.minHeight = 25;
|
||||||
toggleLayout.flexibleHeight = 0;
|
toggleLayout.flexibleHeight = 0;
|
||||||
|
var checkImg = toggleObj.transform.Find("Background/Checkmark").GetComponent<Image>();
|
||||||
|
checkImg.color = SyntaxColors.Class_Instance.ToColor();
|
||||||
|
checkImg.color *= 0.66f;
|
||||||
#if CPP
|
#if CPP
|
||||||
toggle.onValueChanged.AddListener(new Action<bool>((bool val) => { OnCompToggleClicked(thisIndex, val); }));
|
toggle.onValueChanged.AddListener(new Action<bool>((bool val) => { OnCompToggleClicked(thisIndex, val); }));
|
||||||
#else
|
#else
|
||||||
@ -755,6 +1015,8 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
toggleText.text = "";
|
toggleText.text = "";
|
||||||
s_compToggles.Add(toggle);
|
s_compToggles.Add(toggle);
|
||||||
|
|
||||||
|
// Main component button
|
||||||
|
|
||||||
GameObject mainButtonObj = UIFactory.CreateButton(btnGroupObj);
|
GameObject mainButtonObj = UIFactory.CreateButton(btnGroupObj);
|
||||||
LayoutElement mainBtnLayout = mainButtonObj.AddComponent<LayoutElement>();
|
LayoutElement mainBtnLayout = mainButtonObj.AddComponent<LayoutElement>();
|
||||||
mainBtnLayout.minHeight = 25;
|
mainBtnLayout.minHeight = 25;
|
||||||
@ -772,27 +1034,31 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
mainBtn.onClick.AddListener(() => { OnCompListObjectClicked(thisIndex); });
|
mainBtn.onClick.AddListener(() => { OnCompListObjectClicked(thisIndex); });
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Component button text
|
||||||
|
|
||||||
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
||||||
mainText.alignment = TextAnchor.MiddleLeft;
|
mainText.alignment = TextAnchor.MiddleLeft;
|
||||||
mainText.horizontalOverflow = HorizontalWrapMode.Overflow;
|
mainText.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||||
mainText.color = Syntax.Class_Instance.ToColor();
|
mainText.color = SyntaxColors.Class_Instance.ToColor();
|
||||||
s_compListTexts.Add(mainText);
|
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>();
|
var controlsGroup = controlsObj.GetComponent<VerticalLayoutGroup>();
|
||||||
controlsGroup.childForceExpandWidth = false;
|
controlsGroup.childForceExpandWidth = false;
|
||||||
controlsGroup.childControlWidth = true;
|
controlsGroup.childControlWidth = true;
|
||||||
controlsGroup.childForceExpandHeight = false;
|
controlsGroup.childForceExpandHeight = false;
|
||||||
var controlsLayout = controlsObj.AddComponent<LayoutElement>();
|
controlsGroup.spacing = 5;
|
||||||
controlsLayout.minHeight = CONTROLS_MAX_HEIGHT;
|
controlsGroup.padding.top = 4;
|
||||||
controlsLayout.flexibleHeight = 0;
|
controlsGroup.padding.left = 4;
|
||||||
controlsLayout.minWidth = 250;
|
controlsGroup.padding.right = 4;
|
||||||
controlsLayout.flexibleWidth = 9000;
|
controlsGroup.padding.bottom = 4;
|
||||||
|
|
||||||
// ~~~~~~ Top row ~~~~~~
|
// ~~~~~~ Top row ~~~~~~
|
||||||
|
|
||||||
@ -806,13 +1072,46 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
|
|
||||||
var hideButtonObj = UIFactory.CreateButton(topRow);
|
var hideButtonObj = UIFactory.CreateButton(topRow);
|
||||||
var hideButton = hideButtonObj.GetComponent<Button>();
|
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>();
|
var hideText = hideButtonObj.GetComponentInChildren<Text>();
|
||||||
hideText.text = "v";
|
hideText.text = "Show";
|
||||||
|
hideText.fontSize = 14;
|
||||||
var hideButtonLayout = hideButtonObj.AddComponent<LayoutElement>();
|
var hideButtonLayout = hideButtonObj.AddComponent<LayoutElement>();
|
||||||
hideButtonLayout.minWidth = 40;
|
hideButtonLayout.minWidth = 40;
|
||||||
hideButtonLayout.flexibleWidth = 0;
|
hideButtonLayout.flexibleWidth = 0;
|
||||||
hideButtonLayout.minHeight = 25;
|
hideButtonLayout.minHeight = 25;
|
||||||
hideButtonLayout.flexibleHeight = 0;
|
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
|
#if CPP
|
||||||
hideButton.onClick.AddListener(new Action(OnHideClicked));
|
hideButton.onClick.AddListener(new Action(OnHideClicked));
|
||||||
#else
|
#else
|
||||||
@ -820,26 +1119,261 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
#endif
|
#endif
|
||||||
void OnHideClicked()
|
void OnHideClicked()
|
||||||
{
|
{
|
||||||
if (controlsLayout.minHeight > 25)
|
if (hideText.text == "Show")
|
||||||
{
|
{
|
||||||
hideText.text = "^";
|
hideText.text = "Hide";
|
||||||
controlsLayout.minHeight = 25;
|
contentObj.SetActive(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hideText.text = "v";
|
hideText.text = "Show";
|
||||||
controlsLayout.minHeight = CONTROLS_MAX_HEIGHT;
|
contentObj.SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var topTitle = UIFactory.CreateLabel(topRow, TextAnchor.MiddleLeft);
|
// ~~~ set parent ~~~
|
||||||
var topText = topTitle.GetComponent<Text>();
|
|
||||||
topText.text = "GameObject Controls";
|
var setParentGroupObj = UIFactory.CreateHorizontalGroup(contentObj, new Color(1, 1, 1, 0));
|
||||||
var titleLayout = topTitle.AddComponent<LayoutElement>();
|
var setParentGroup = setParentGroupObj.GetComponent<HorizontalLayoutGroup>();
|
||||||
titleLayout.minWidth = 100;
|
setParentGroup.childForceExpandHeight = false;
|
||||||
titleLayout.flexibleWidth = 9500;
|
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;
|
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
|
#endregion
|
@ -1,8 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public abstract class InspectorBase
|
public abstract class InspectorBase
|
||||||
{
|
{
|
||||||
@ -32,6 +33,16 @@ namespace UnityExplorer.UI.Main.Inspectors
|
|||||||
AddInspectorTab();
|
AddInspectorTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SetContentActive()
|
||||||
|
{
|
||||||
|
Content?.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void SetContentInactive()
|
||||||
|
{
|
||||||
|
Content?.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Update()
|
public virtual void Update()
|
||||||
{
|
{
|
||||||
if (ObjectNullOrDestroyed(Target, UnityTarget))
|
if (ObjectNullOrDestroyed(Target, UnityTarget))
|
@ -2,14 +2,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.UI.Main.Inspectors;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.PageModel;
|
||||||
using UnityExplorer.Unstrip.Scenes;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class InspectorManager
|
public class InspectorManager
|
||||||
{
|
{
|
||||||
@ -83,7 +82,7 @@ namespace UnityExplorer.UI.Main
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_currentInspectors.Add(inspector);
|
m_currentInspectors.Add(inspector);
|
||||||
inspector.Content?.SetActive(false);
|
inspector.SetContentInactive();
|
||||||
|
|
||||||
SetInspectorTab(inspector);
|
SetInspectorTab(inspector);
|
||||||
}
|
}
|
||||||
@ -99,7 +98,7 @@ namespace UnityExplorer.UI.Main
|
|||||||
|
|
||||||
m_activeInspector = inspector;
|
m_activeInspector = inspector;
|
||||||
|
|
||||||
m_activeInspector.Content?.SetActive(true);
|
inspector.SetContentActive();
|
||||||
|
|
||||||
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;
|
||||||
@ -115,7 +114,7 @@ namespace UnityExplorer.UI.Main
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_activeInspector.Content?.SetActive(false);
|
m_activeInspector.SetContentInactive();
|
||||||
|
|
||||||
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,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class InstanceInspector : ReflectionInspector
|
public class InstanceInspector : ReflectionInspector
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class ReflectionInspector : InspectorBase
|
public class ReflectionInspector : InspectorBase
|
||||||
{
|
{
|
@ -1,15 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Main.Inspectors;
|
using UnityExplorer.UI.PageModel;
|
||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.Shared;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Unstrip.Scenes;
|
using UnityExplorer.Unstrip.Scenes;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class SceneExplorer
|
public class SceneExplorer
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class StaticInspector : ReflectionInspector
|
public class StaticInspector : ReflectionInspector
|
||||||
{
|
{
|
@ -7,7 +7,7 @@
|
|||||||
//using UnityExplorer.Helpers;
|
//using UnityExplorer.Helpers;
|
||||||
//using UnityExplorer.UI.Shared;
|
//using UnityExplorer.UI.Shared;
|
||||||
|
|
||||||
//namespace UnityExplorer.UI
|
//namespace UnityExplorer.UI.InteractiveValue
|
||||||
//{
|
//{
|
||||||
// public class InteractiveValue
|
// public class InteractiveValue
|
||||||
// {
|
// {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityExplorer.UI.Main.Console;
|
using UnityExplorer.Console;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI.PageModel;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main
|
namespace UnityExplorer.UI
|
||||||
{
|
{
|
||||||
public class MainMenu
|
public class MainMenu
|
||||||
{
|
{
|
@ -3,16 +3,17 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.UI.Main.Console;
|
using UnityExplorer.Console;
|
||||||
using UnityExplorer.Unstrip.Resources;
|
using UnityExplorer.Unstrip.Resources;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
#if CPP
|
#if CPP
|
||||||
using UnhollowerRuntimeLib;
|
using UnhollowerRuntimeLib;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main
|
namespace UnityExplorer.UI.PageModel
|
||||||
{
|
{
|
||||||
public class ConsolePage : MainMenu.Page
|
public class ConsolePage : MainMenu.Page
|
||||||
{
|
{
|
@ -4,10 +4,8 @@ using UnityExplorer.Unstrip.ColorUtility;
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
#if CPP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main
|
namespace UnityExplorer.UI.PageModel
|
||||||
{
|
{
|
||||||
public class DebugConsole
|
public class DebugConsole
|
||||||
{
|
{
|
@ -3,8 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.Inspectors;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main
|
namespace UnityExplorer.UI.PageModel
|
||||||
{
|
{
|
||||||
public class HomePage : MainMenu.Page
|
public class HomePage : MainMenu.Page
|
||||||
{
|
{
|
@ -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
|
public class OptionsPage : MainMenu.Page
|
||||||
{
|
{
|
@ -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
|
public class SearchPage : MainMenu.Page
|
||||||
{
|
{
|
@ -8,7 +8,7 @@ using System.IO;
|
|||||||
using UnityExplorer.Unstrip.ImageConversion;
|
using UnityExplorer.Unstrip.ImageConversion;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Main
|
namespace UnityExplorer.UI
|
||||||
{
|
{
|
||||||
// Handles dragging and resizing for the main explorer window.
|
// Handles dragging and resizing for the main explorer window.
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
namespace UnityExplorer.UI.Shared
|
namespace UnityExplorer.UI.Shared
|
||||||
{
|
{
|
||||||
public class Syntax
|
public class SyntaxColors
|
||||||
{
|
{
|
||||||
public const string Field_Static = "#8d8dc6";
|
public const string Field_Static = "#8d8dc6";
|
||||||
public const string Field_Instance = "#c266ff";
|
public const string Field_Instance = "#c266ff";
|
@ -437,6 +437,7 @@ namespace UnityExplorer.UI
|
|||||||
GameObject placeHolderObj = CreateUIObject("Placeholder", textArea);
|
GameObject placeHolderObj = CreateUIObject("Placeholder", textArea);
|
||||||
TextMeshProUGUI placeholderText = placeHolderObj.AddComponent<TextMeshProUGUI>();
|
TextMeshProUGUI placeholderText = placeHolderObj.AddComponent<TextMeshProUGUI>();
|
||||||
placeholderText.fontSize = fontSize;
|
placeholderText.fontSize = fontSize;
|
||||||
|
placeholderText.fontSizeMax = fontSize;
|
||||||
placeholderText.text = "...";
|
placeholderText.text = "...";
|
||||||
placeholderText.color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
placeholderText.color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
||||||
placeholderText.overflowMode = (TextOverflowModes)overflowMode;
|
placeholderText.overflowMode = (TextOverflowModes)overflowMode;
|
||||||
@ -457,6 +458,7 @@ namespace UnityExplorer.UI
|
|||||||
GameObject inputTextObj = CreateUIObject("Text", textArea);
|
GameObject inputTextObj = CreateUIObject("Text", textArea);
|
||||||
TextMeshProUGUI inputText = inputTextObj.AddComponent<TextMeshProUGUI>();
|
TextMeshProUGUI inputText = inputTextObj.AddComponent<TextMeshProUGUI>();
|
||||||
inputText.fontSize = fontSize;
|
inputText.fontSize = fontSize;
|
||||||
|
inputText.fontSizeMax = fontSize;
|
||||||
inputText.text = "";
|
inputText.text = "";
|
||||||
inputText.color = new Color(1f, 1f, 1f, 1f);
|
inputText.color = new Color(1f, 1f, 1f, 1f);
|
||||||
inputText.overflowMode = (TextOverflowModes)overflowMode;
|
inputText.overflowMode = (TextOverflowModes)overflowMode;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using UnityExplorer.UI.Main;
|
using UnityEngine;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.Inspectors;
|
||||||
|
|
||||||
namespace UnityExplorer.UI
|
namespace UnityExplorer.UI
|
||||||
{
|
{
|
||||||
|
@ -327,20 +327,18 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="CacheObject\CacheEnumerated.cs" />
|
<Compile Include="Inspectors\CacheObject\CacheEnumerated.cs" />
|
||||||
<Compile Include="CacheObject\CacheFactory.cs" />
|
<Compile Include="Inspectors\CacheObject\CacheFactory.cs" />
|
||||||
<Compile Include="CacheObject\CacheField.cs" />
|
<Compile Include="Inspectors\CacheObject\CacheField.cs" />
|
||||||
<Compile Include="CacheObject\CacheMember.cs" />
|
<Compile Include="Inspectors\CacheObject\CacheMember.cs" />
|
||||||
<Compile Include="CacheObject\CacheMethod.cs" />
|
<Compile Include="Inspectors\CacheObject\CacheMethod.cs" />
|
||||||
<Compile Include="CacheObject\CacheProperty.cs" />
|
<Compile Include="Inspectors\CacheObject\CacheProperty.cs" />
|
||||||
<Compile Include="CacheObject\CacheObjectBase.cs" />
|
<Compile Include="Inspectors\CacheObject\CacheObjectBase.cs" />
|
||||||
<Compile Include="Helpers\Texture2DHelpers.cs" />
|
<Compile Include="Helpers\Texture2DHelpers.cs" />
|
||||||
<Compile Include="Config\ModConfig.cs" />
|
<Compile Include="Config\ModConfig.cs" />
|
||||||
<Compile Include="ExplorerCore.cs" />
|
<Compile Include="ExplorerCore.cs" />
|
||||||
<Compile Include="ExplorerBepInPlugin.cs" />
|
<Compile Include="ExplorerBepInPlugin.cs" />
|
||||||
<Compile Include="ExplorerMelonMod.cs" />
|
<Compile Include="ExplorerMelonMod.cs" />
|
||||||
<Compile Include="Extensions\ReflectionExtensions.cs" />
|
|
||||||
<Compile Include="Extensions\UnityExtensions.cs" />
|
|
||||||
<Compile Include="Helpers\ReflectionHelpers.cs" />
|
<Compile Include="Helpers\ReflectionHelpers.cs" />
|
||||||
<Compile Include="Helpers\UnityHelpers.cs" />
|
<Compile Include="Helpers\UnityHelpers.cs" />
|
||||||
<Compile Include="UI\ForceUnlockCursor.cs" />
|
<Compile Include="UI\ForceUnlockCursor.cs" />
|
||||||
@ -350,36 +348,36 @@
|
|||||||
<Compile Include="Input\InputSystem.cs" />
|
<Compile Include="Input\InputSystem.cs" />
|
||||||
<Compile Include="Input\LegacyInput.cs" />
|
<Compile Include="Input\LegacyInput.cs" />
|
||||||
<Compile Include="Input\NoInput.cs" />
|
<Compile Include="Input\NoInput.cs" />
|
||||||
<Compile Include="UI\Main\DebugConsole.cs" />
|
<Compile Include="UI\PageModel\DebugConsole.cs" />
|
||||||
<Compile Include="UI\Main\InspectorManager.cs" />
|
<Compile Include="Inspectors\InspectorManager.cs" />
|
||||||
<Compile Include="UI\Main\Inspectors\ReflectionInspector.cs" />
|
<Compile Include="Inspectors\ReflectionInspector.cs" />
|
||||||
<Compile Include="UI\Main\MainMenu.cs" />
|
<Compile Include="UI\MainMenu.cs" />
|
||||||
<Compile Include="UI\Main\ConsolePage.cs" />
|
<Compile Include="UI\PageModel\ConsolePage.cs" />
|
||||||
<Compile Include="UI\Main\Console\AutoCompleter.cs" />
|
<Compile Include="Console\AutoCompleter.cs" />
|
||||||
<Compile Include="UI\Main\Console\CodeEditor.cs" />
|
<Compile Include="Console\CodeEditor.cs" />
|
||||||
<Compile Include="UI\Main\Console\CSharpLexer.cs" />
|
<Compile Include="Console\CSharpLexer.cs" />
|
||||||
<Compile Include="UI\Main\Console\Lexer\CommentMatch.cs" />
|
<Compile Include="Console\Lexer\CommentMatch.cs" />
|
||||||
<Compile Include="UI\Main\Console\Lexer\InputLexer.cs" />
|
<Compile Include="Console\Lexer\InputLexer.cs" />
|
||||||
<Compile Include="UI\Main\Console\Lexer\KeywordMatch.cs" />
|
<Compile Include="Console\Lexer\KeywordMatch.cs" />
|
||||||
<Compile Include="UI\Main\Console\Lexer\StringMatch.cs" />
|
<Compile Include="Console\Lexer\StringMatch.cs" />
|
||||||
<Compile Include="UI\Main\Console\Lexer\Matcher.cs" />
|
<Compile Include="Console\Lexer\Matcher.cs" />
|
||||||
<Compile Include="UI\Main\Console\Lexer\NumberMatch.cs" />
|
<Compile Include="Console\Lexer\NumberMatch.cs" />
|
||||||
<Compile Include="UI\Main\Console\Lexer\SymbolMatch.cs" />
|
<Compile Include="Console\Lexer\SymbolMatch.cs" />
|
||||||
<Compile Include="UI\Main\Console\Suggestion.cs" />
|
<Compile Include="Console\Suggestion.cs" />
|
||||||
<Compile Include="UI\Main\Console\ScriptEvaluator.cs" />
|
<Compile Include="Console\ScriptEvaluator.cs" />
|
||||||
<Compile Include="UI\Main\Console\ScriptInteraction.cs" />
|
<Compile Include="Console\ScriptInteraction.cs" />
|
||||||
<Compile Include="UI\Main\HomePage.cs" />
|
<Compile Include="UI\PageModel\HomePage.cs" />
|
||||||
<Compile Include="UI\Main\Inspectors\GameObjectInspector.cs" />
|
<Compile Include="Inspectors\GameObjectInspector.cs" />
|
||||||
<Compile Include="UI\Main\Inspectors\InspectorBase.cs" />
|
<Compile Include="Inspectors\InspectorBase.cs" />
|
||||||
<Compile Include="UI\Main\Inspectors\InstanceInspector.cs" />
|
<Compile Include="Inspectors\InstanceInspector.cs" />
|
||||||
<Compile Include="UI\Main\Inspectors\StaticInspector.cs" />
|
<Compile Include="Inspectors\StaticInspector.cs" />
|
||||||
<Compile Include="UI\Main\OptionsPage.cs" />
|
<Compile Include="UI\PageModel\OptionsPage.cs" />
|
||||||
<Compile Include="UI\Main\SceneExplorer.cs" />
|
<Compile Include="Inspectors\SceneExplorer.cs" />
|
||||||
<Compile Include="UI\Main\SearchPage.cs" />
|
<Compile Include="UI\PageModel\SearchPage.cs" />
|
||||||
<Compile Include="UI\Main\PanelDragger.cs" />
|
<Compile Include="UI\PanelDragger.cs" />
|
||||||
<Compile Include="UI\InteractiveValue\InteractiveValue.cs" />
|
<Compile Include="UI\InteractiveValue\InteractiveValue.cs" />
|
||||||
<Compile Include="UI\Shared\PageHandler.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="UI\UIManager.cs" />
|
||||||
<Compile Include="Unstrip\ColorUtility\ColorUtilityUnstrip.cs" />
|
<Compile Include="Unstrip\ColorUtility\ColorUtilityUnstrip.cs" />
|
||||||
<Compile Include="Unstrip\ImageConversion\ImageConversionUnstrip.cs" />
|
<Compile Include="Unstrip\ImageConversion\ImageConversionUnstrip.cs" />
|
||||||
@ -394,9 +392,7 @@
|
|||||||
<None Include="ILRepack.targets" />
|
<None Include="ILRepack.targets" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup />
|
||||||
<Folder Include="UI\MouseInspector\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<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')" />
|
<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">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.UI.Main;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using UnityExplorer.Inspectors;
|
||||||
|
|
||||||
namespace UnityExplorer.Unstrip.Scenes
|
namespace UnityExplorer.Unstrip.Scenes
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user