mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-04 04:22:53 +08:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
1c5306b7c8 | |||
ea1e183c4a | |||
8080129d58 | |||
4b8298fd2e | |||
ad055b4383 | |||
23483a6108 | |||
a6c24f91e4 | |||
9e4c335a05 | |||
a1c2dfbe50 | |||
a5a07a0a23 | |||
e0fd682c81 | |||
7426bd1dd6 | |||
b39b044f79 | |||
7a2b4aa257 | |||
3762d14bdb |
@ -6,6 +6,10 @@
|
|||||||
An in-game explorer and a suite of debugging tools for <a href="https://docs.unity3d.com/Manual/IL2CPP.html">IL2CPP</a> and <b>Mono</b> Unity games, to aid with modding development.
|
An in-game explorer and a suite of debugging tools for <a href="https://docs.unity3d.com/Manual/IL2CPP.html">IL2CPP</a> and <b>Mono</b> Unity games, to aid with modding development.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
Supports most Unity games from versions 5.2 to 2020+.
|
||||||
|
</p>
|
||||||
|
|
||||||
## Releases [](../../releases/latest) [](../../releases) [](../../releases/latest)
|
## Releases [](../../releases/latest) [](../../releases) [](../../releases/latest)
|
||||||
|
|
||||||
| Mod Loader | IL2CPP | Mono |
|
| Mod Loader | IL2CPP | Mono |
|
||||||
|
@ -19,11 +19,13 @@ namespace UnityExplorer.Core.Config
|
|||||||
|
|
||||||
public static ConfigElement<KeyCode> Main_Menu_Toggle;
|
public static ConfigElement<KeyCode> Main_Menu_Toggle;
|
||||||
public static ConfigElement<bool> Force_Unlock_Mouse;
|
public static ConfigElement<bool> Force_Unlock_Mouse;
|
||||||
|
public static ConfigElement<bool> Aggressive_Force_Unlock;
|
||||||
public static ConfigElement<MenuPages> Default_Tab;
|
public static ConfigElement<MenuPages> Default_Tab;
|
||||||
public static ConfigElement<int> Default_Page_Limit;
|
public static ConfigElement<int> Default_Page_Limit;
|
||||||
public static ConfigElement<string> Default_Output_Path;
|
public static ConfigElement<string> Default_Output_Path;
|
||||||
public static ConfigElement<bool> Log_Unity_Debug;
|
public static ConfigElement<bool> Log_Unity_Debug;
|
||||||
public static ConfigElement<bool> Hide_On_Startup;
|
public static ConfigElement<bool> Hide_On_Startup;
|
||||||
|
public static ConfigElement<float> Startup_Delay_Time;
|
||||||
|
|
||||||
public static ConfigElement<string> Last_Window_Anchors;
|
public static ConfigElement<string> Last_Window_Anchors;
|
||||||
public static ConfigElement<string> Last_Window_Position;
|
public static ConfigElement<string> Last_Window_Position;
|
||||||
@ -77,6 +79,10 @@ namespace UnityExplorer.Core.Config
|
|||||||
"Force the Cursor to be unlocked (visible) when the UnityExplorer menu is open.",
|
"Force the Cursor to be unlocked (visible) when the UnityExplorer menu is open.",
|
||||||
true);
|
true);
|
||||||
|
|
||||||
|
Aggressive_Force_Unlock = new ConfigElement<bool>("Aggressive Mouse Unlock",
|
||||||
|
"Use WaitForEndOfFrame to aggressively force the Mouse to be unlocked (requires game restart).",
|
||||||
|
false);
|
||||||
|
|
||||||
Default_Page_Limit = new ConfigElement<int>("Default Page Limit",
|
Default_Page_Limit = new ConfigElement<int>("Default Page Limit",
|
||||||
"The default maximum number of elements per 'page' in UnityExplorer.",
|
"The default maximum number of elements per 'page' in UnityExplorer.",
|
||||||
25);
|
25);
|
||||||
@ -85,6 +91,10 @@ namespace UnityExplorer.Core.Config
|
|||||||
"The default output path when exporting things from UnityExplorer.",
|
"The default output path when exporting things from UnityExplorer.",
|
||||||
Path.Combine(ExplorerCore.Loader.ExplorerFolder, "Output"));
|
Path.Combine(ExplorerCore.Loader.ExplorerFolder, "Output"));
|
||||||
|
|
||||||
|
Startup_Delay_Time = new ConfigElement<float>("Startup Delay Time",
|
||||||
|
"The delay on startup before the UI is created.",
|
||||||
|
1f);
|
||||||
|
|
||||||
// Internal configs
|
// Internal configs
|
||||||
|
|
||||||
Last_Window_Anchors = new ConfigElement<string>("Last_Window_Anchors",
|
Last_Window_Anchors = new ConfigElement<string>("Last_Window_Anchors",
|
||||||
|
@ -7,6 +7,7 @@ using BF = System.Reflection.BindingFlags;
|
|||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
using UnityExplorer.Core;
|
using UnityExplorer.Core;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
|
using System.Collections;
|
||||||
#if ML
|
#if ML
|
||||||
using Harmony;
|
using Harmony;
|
||||||
#else
|
#else
|
||||||
@ -48,6 +49,34 @@ namespace UnityExplorer.Core.Input
|
|||||||
|
|
||||||
Unlock = ConfigManager.Force_Unlock_Mouse.Value;
|
Unlock = ConfigManager.Force_Unlock_Mouse.Value;
|
||||||
ConfigManager.Force_Unlock_Mouse.OnValueChanged += (bool val) => { Unlock = val; };
|
ConfigManager.Force_Unlock_Mouse.OnValueChanged += (bool val) => { Unlock = val; };
|
||||||
|
|
||||||
|
if (ConfigManager.Aggressive_Force_Unlock.Value)
|
||||||
|
SetupAggressiveUnlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetupAggressiveUnlock()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RuntimeProvider.Instance.StartCoroutine(AggressiveUnlockCoroutine());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning($"Exception setting up Aggressive Mouse Unlock: {ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame();
|
||||||
|
|
||||||
|
private static IEnumerator AggressiveUnlockCoroutine()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
yield return _waitForEndOfFrame;
|
||||||
|
|
||||||
|
if (UIManager.ShowMenu)
|
||||||
|
UpdateCursorControl();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateCursorControl()
|
public static void UpdateCursorControl()
|
||||||
|
@ -163,12 +163,14 @@ namespace UnityExplorer.Core.Input
|
|||||||
|
|
||||||
var assetType = ReflectionUtility.GetTypeByName("UnityEngine.InputSystem.InputActionAsset");
|
var assetType = ReflectionUtility.GetTypeByName("UnityEngine.InputSystem.InputActionAsset");
|
||||||
m_newInputModule = RuntimeProvider.Instance.AddComponent<BaseInputModule>(UIManager.CanvasRoot, TInputSystemUIInputModule);
|
m_newInputModule = RuntimeProvider.Instance.AddComponent<BaseInputModule>(UIManager.CanvasRoot, TInputSystemUIInputModule);
|
||||||
var asset = RuntimeProvider.Instance.CreateScriptable(assetType);
|
var asset = RuntimeProvider.Instance.CreateScriptable(assetType)
|
||||||
|
.Cast(assetType);
|
||||||
|
|
||||||
inputExtensions = ReflectionUtility.GetTypeByName("UnityEngine.InputSystem.InputActionSetupExtensions");
|
inputExtensions = ReflectionUtility.GetTypeByName("UnityEngine.InputSystem.InputActionSetupExtensions");
|
||||||
|
|
||||||
var addMap = inputExtensions.GetMethod("AddActionMap", new Type[] { assetType, typeof(string) });
|
var addMap = inputExtensions.GetMethod("AddActionMap", new Type[] { assetType, typeof(string) });
|
||||||
var map = addMap.Invoke(null, new object[] { asset, "UI" });
|
var map = addMap.Invoke(null, new object[] { asset, "UI" })
|
||||||
|
.Cast(ReflectionUtility.GetTypeByName("UnityEngine.InputSystem.InputActionMap"));
|
||||||
|
|
||||||
CreateAction(map, "point", new[] { "<Mouse>/position" }, "point");
|
CreateAction(map, "point", new[] { "<Mouse>/position" }, "point");
|
||||||
CreateAction(map, "click", new[] { "<Mouse>/leftButton" }, "leftClick");
|
CreateAction(map, "click", new[] { "<Mouse>/leftButton" }, "leftClick");
|
||||||
@ -186,23 +188,25 @@ namespace UnityExplorer.Core.Input
|
|||||||
|
|
||||||
private void CreateAction(object map, string actionName, string[] bindings, string propertyName)
|
private void CreateAction(object map, string actionName, string[] bindings, string propertyName)
|
||||||
{
|
{
|
||||||
|
var inputActionType = ReflectionUtility.GetTypeByName("UnityEngine.InputSystem.InputAction");
|
||||||
var addAction = inputExtensions.GetMethod("AddAction");
|
var addAction = inputExtensions.GetMethod("AddAction");
|
||||||
var pointAction = addAction.Invoke(null, new object[] { map, actionName, default, null, null, null, null, null });
|
var action = addAction.Invoke(null, new object[] { map, actionName, default, null, null, null, null, null })
|
||||||
|
.Cast(inputActionType);
|
||||||
|
|
||||||
var inputActionType = pointAction.GetType();
|
|
||||||
var addBinding = inputExtensions.GetMethod("AddBinding",
|
var addBinding = inputExtensions.GetMethod("AddBinding",
|
||||||
new Type[] { inputActionType, typeof(string), typeof(string), typeof(string), typeof(string) });
|
new Type[] { inputActionType, typeof(string), typeof(string), typeof(string), typeof(string) });
|
||||||
|
|
||||||
foreach (string binding in bindings)
|
foreach (string binding in bindings)
|
||||||
addBinding.Invoke(null, new object[] { pointAction, binding, null, null, null });
|
addBinding.Invoke(null, new object[] { action.Cast(inputActionType), binding, null, null, null });
|
||||||
|
|
||||||
var inputRef = ReflectionUtility.GetTypeByName("UnityEngine.InputSystem.InputActionReference")
|
var refType = ReflectionUtility.GetTypeByName("UnityEngine.InputSystem.InputActionReference");
|
||||||
.GetMethod("Create")
|
var inputRef = refType.GetMethod("Create")
|
||||||
.Invoke(null, new object[] { pointAction });
|
.Invoke(null, new object[] { action })
|
||||||
|
.Cast(refType);
|
||||||
|
|
||||||
TInputSystemUIInputModule
|
TInputSystemUIInputModule
|
||||||
.GetProperty(propertyName)
|
.GetProperty(propertyName)
|
||||||
.SetValue(m_newInputModule, inputRef, null);
|
.SetValue(m_newInputModule.Cast(TInputSystemUIInputModule), inputRef, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivateModule()
|
public void ActivateModule()
|
||||||
|
@ -192,6 +192,51 @@ namespace UnityExplorer
|
|||||||
return s_cachedPropInfos[type][propertyName];
|
return s_cachedPropInfos[type][propertyName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static Dictionary<Type, Dictionary<string, MethodInfo>> s_cachedMethodInfos = new Dictionary<Type, Dictionary<string, MethodInfo>>();
|
||||||
|
|
||||||
|
public static MethodInfo GetMethodInfo(Type type, string methodName, Type[] argumentTypes)
|
||||||
|
{
|
||||||
|
if (!s_cachedMethodInfos.ContainsKey(type))
|
||||||
|
s_cachedMethodInfos.Add(type, new Dictionary<string, MethodInfo>());
|
||||||
|
|
||||||
|
var sig = methodName;
|
||||||
|
|
||||||
|
if (argumentTypes != null)
|
||||||
|
{
|
||||||
|
sig += "(";
|
||||||
|
for (int i = 0; i < argumentTypes.Length; i++)
|
||||||
|
{
|
||||||
|
if (i > 0)
|
||||||
|
sig += ",";
|
||||||
|
sig += argumentTypes[i].FullName;
|
||||||
|
}
|
||||||
|
sig += ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!s_cachedMethodInfos[type].ContainsKey(sig))
|
||||||
|
{
|
||||||
|
if (argumentTypes != null)
|
||||||
|
s_cachedMethodInfos[type].Add(sig, type.GetMethod(methodName, AllFlags, null, argumentTypes, null));
|
||||||
|
else
|
||||||
|
s_cachedMethodInfos[type].Add(sig, type.GetMethod(methodName, AllFlags));
|
||||||
|
}
|
||||||
|
|
||||||
|
return s_cachedMethodInfos[type][sig];
|
||||||
|
}
|
||||||
|
catch (AmbiguousMatchException)
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning($"AmbiguousMatchException trying to get method '{sig}'");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning($"{e.GetType()} trying to get method '{sig}': {e.Message}\r\n{e.StackTrace}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper to display a simple "{ExceptionType}: {Message}" of the exception, and optionally use the inner-most exception.
|
/// Helper to display a simple "{ExceptionType}: {Message}" of the exception, and optionally use the inner-most exception.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -160,42 +160,95 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp
|
|||||||
.Invoke(handle);
|
.Invoke(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool? s_doPropertiesExist;
|
internal static bool triedToGetColorBlockProps;
|
||||||
|
internal static PropertyInfo _normalColorProp;
|
||||||
|
internal static PropertyInfo _highlightColorProp;
|
||||||
|
internal static PropertyInfo _pressedColorProp;
|
||||||
|
internal static PropertyInfo _disabledColorProp;
|
||||||
|
|
||||||
public override ColorBlock SetColorBlock(ColorBlock colors, Color? normal = null, Color? highlighted = null, Color? pressed = null)
|
public override void SetColorBlock(Selectable selectable, Color? normal = null, Color? highlighted = null, Color? pressed = null,
|
||||||
|
Color? disabled = null)
|
||||||
{
|
{
|
||||||
if (s_doPropertiesExist == null)
|
var colors = selectable.colors;
|
||||||
{
|
|
||||||
var prop = ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "normalColor") as PropertyInfo;
|
|
||||||
s_doPropertiesExist = prop != null && prop.CanWrite;
|
|
||||||
}
|
|
||||||
|
|
||||||
colors.colorMultiplier = 1;
|
colors.colorMultiplier = 1;
|
||||||
|
|
||||||
object boxed = (object)colors;
|
object boxed = (object)colors;
|
||||||
|
|
||||||
if (s_doPropertiesExist == true)
|
if (!triedToGetColorBlockProps)
|
||||||
{
|
{
|
||||||
if (normal != null)
|
triedToGetColorBlockProps = true;
|
||||||
ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "normalColor").SetValue(boxed, (Color)normal);
|
|
||||||
if (pressed != null)
|
if (ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "normalColor") is PropertyInfo norm && norm.CanWrite)
|
||||||
ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "pressedColor").SetValue(boxed, (Color)pressed);
|
_normalColorProp = norm;
|
||||||
if (highlighted != null)
|
if (ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "highlightedColor") is PropertyInfo high && high.CanWrite)
|
||||||
ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "highlightedColor").SetValue(boxed, (Color)highlighted);
|
_highlightColorProp = high;
|
||||||
|
if (ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "pressedColor") is PropertyInfo pres && pres.CanWrite)
|
||||||
|
_pressedColorProp = pres;
|
||||||
|
if (ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "disabledColor") is PropertyInfo disa && disa.CanWrite)
|
||||||
|
_disabledColorProp = disa;
|
||||||
}
|
}
|
||||||
else if (s_doPropertiesExist == false)
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (normal != null)
|
if (normal != null)
|
||||||
ReflectionUtility.GetFieldInfo(typeof(ColorBlock), "m_NormalColor").SetValue(boxed, (Color)normal);
|
{
|
||||||
if (pressed != null)
|
if (_normalColorProp != null)
|
||||||
ReflectionUtility.GetFieldInfo(typeof(ColorBlock), "m_PressedColor").SetValue(boxed, (Color)pressed);
|
_normalColorProp.SetValue(boxed, (Color)normal);
|
||||||
|
else if (ReflectionUtility.GetFieldInfo(typeof(ColorBlock), "m_NormalColor") is FieldInfo fi)
|
||||||
|
fi.SetValue(boxed, (Color)normal);
|
||||||
|
}
|
||||||
|
|
||||||
if (highlighted != null)
|
if (highlighted != null)
|
||||||
ReflectionUtility.GetFieldInfo(typeof(ColorBlock), "m_HighlightedColor").SetValue(boxed, (Color)highlighted);
|
{
|
||||||
|
if (_highlightColorProp != null)
|
||||||
|
_highlightColorProp.SetValue(boxed, (Color)highlighted);
|
||||||
|
else if (ReflectionUtility.GetFieldInfo(typeof(ColorBlock), "m_HighlightedColor") is FieldInfo fi)
|
||||||
|
fi.SetValue(boxed, (Color)highlighted);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pressed != null)
|
||||||
|
{
|
||||||
|
if (_pressedColorProp != null)
|
||||||
|
_pressedColorProp.SetValue(boxed, (Color)pressed);
|
||||||
|
else if (ReflectionUtility.GetFieldInfo(typeof(ColorBlock), "m_PressedColor") is FieldInfo fi)
|
||||||
|
fi.SetValue(boxed, (Color)pressed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disabled != null)
|
||||||
|
{
|
||||||
|
if (_disabledColorProp != null)
|
||||||
|
_disabledColorProp.SetValue(boxed, (Color)disabled);
|
||||||
|
else if (ReflectionUtility.GetFieldInfo(typeof(ColorBlock), "m_DisabledColor") is FieldInfo fi)
|
||||||
|
fi.SetValue(boxed, (Color)disabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ExplorerCore.Log(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
colors = (ColorBlock)boxed;
|
colors = (ColorBlock)boxed;
|
||||||
|
|
||||||
return colors;
|
SetColorBlock(selectable, colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetColorBlock(Selectable selectable, ColorBlock _colorBlock)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
selectable = selectable.TryCast<Selectable>();
|
||||||
|
|
||||||
|
ReflectionUtility.GetPropertyInfo(typeof(Selectable), "m_Colors")
|
||||||
|
.SetValue(selectable, _colorBlock, null);
|
||||||
|
|
||||||
|
ReflectionUtility.GetMethodInfo(typeof(Selectable), "OnSetProperty", new Type[0])
|
||||||
|
.Invoke(selectable, new object[0]);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ExplorerCore.Log(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void FindSingleton(string[] possibleNames, Type type, BF flags, List<object> instances)
|
public override void FindSingleton(string[] possibleNames, Type type, BF flags, List<object> instances)
|
||||||
|
@ -86,8 +86,11 @@ namespace UnityExplorer.Core.Runtime.Mono
|
|||||||
return scene.rootCount;
|
return scene.rootCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ColorBlock SetColorBlock(ColorBlock colors, Color? normal = null, Color? highlighted = null, Color? pressed = null)
|
public override void SetColorBlock(Selectable selectable, Color? normal = null, Color? highlighted = null, Color? pressed = null,
|
||||||
|
Color? disabled = null)
|
||||||
{
|
{
|
||||||
|
var colors = selectable.colors;
|
||||||
|
|
||||||
if (normal != null)
|
if (normal != null)
|
||||||
colors.normalColor = (Color)normal;
|
colors.normalColor = (Color)normal;
|
||||||
|
|
||||||
@ -97,7 +100,15 @@ namespace UnityExplorer.Core.Runtime.Mono
|
|||||||
if (pressed != null)
|
if (pressed != null)
|
||||||
colors.pressedColor = (Color)pressed;
|
colors.pressedColor = (Color)pressed;
|
||||||
|
|
||||||
return colors;
|
if (disabled != null)
|
||||||
|
colors.disabledColor = (Color)disabled;
|
||||||
|
|
||||||
|
SetColorBlock(selectable, colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetColorBlock(Selectable selectable, ColorBlock colors)
|
||||||
|
{
|
||||||
|
selectable.colors = colors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,10 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
public abstract int GetRootCount(Scene scene);
|
public abstract int GetRootCount(Scene scene);
|
||||||
|
|
||||||
public abstract ColorBlock SetColorBlock(ColorBlock colors, Color? normal = null, Color? highlighted = null, Color? pressed = null);
|
public abstract void SetColorBlock(Selectable selectable, ColorBlock colors);
|
||||||
|
|
||||||
|
public abstract void SetColorBlock(Selectable selectable, Color? normal = null, Color? highlighted = null, Color? pressed = null,
|
||||||
|
Color? disabled = null);
|
||||||
|
|
||||||
public virtual void FindSingleton(string[] s_instanceNames, Type type, BindingFlags flags, List<object> instances)
|
public virtual void FindSingleton(string[] s_instanceNames, Type type, BindingFlags flags, List<object> instances)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
@ -13,7 +14,7 @@ namespace UnityExplorer
|
|||||||
public class ExplorerCore
|
public class ExplorerCore
|
||||||
{
|
{
|
||||||
public const string NAME = "UnityExplorer";
|
public const string NAME = "UnityExplorer";
|
||||||
public const string VERSION = "3.3.10";
|
public const string VERSION = "3.3.15";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.unityexplorer";
|
public const string GUID = "com.sinai.unityexplorer";
|
||||||
|
|
||||||
@ -44,10 +45,24 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
InputManager.Init();
|
InputManager.Init();
|
||||||
|
|
||||||
UIManager.Init();
|
|
||||||
|
|
||||||
Log($"{NAME} {VERSION} initialized.");
|
Log($"{NAME} {VERSION} initialized.");
|
||||||
|
|
||||||
|
RuntimeProvider.Instance.StartCoroutine(SetupCoroutine());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do a delayed setup so that objects aren't destroyed instantly.
|
||||||
|
// This can happen for a multitude of reasons.
|
||||||
|
// Default delay is 1 second which is usually enough.
|
||||||
|
private static IEnumerator SetupCoroutine()
|
||||||
|
{
|
||||||
|
float f = Time.realtimeSinceStartup;
|
||||||
|
float delay = ConfigManager.Startup_Delay_Time.Value;
|
||||||
|
while (Time.realtimeSinceStartup - f < delay)
|
||||||
|
yield return null;
|
||||||
|
|
||||||
|
Log($"Creating UI, after delay of {delay} second(s).");
|
||||||
|
UIManager.Init();
|
||||||
|
|
||||||
//InspectorManager.Instance.Inspect(typeof(TestClass));
|
//InspectorManager.Instance.Inspect(typeof(TestClass));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,11 @@ namespace UnityExplorer.Loader.BIE
|
|||||||
|
|
||||||
public override void RegisterConfigElement<T>(ConfigElement<T> config)
|
public override void RegisterConfigElement<T>(ConfigElement<T> config)
|
||||||
{
|
{
|
||||||
var entry = Config.Bind(CTG_NAME, config.Name, config.Value, config.Description);
|
object[] tags = null;
|
||||||
|
if (config.IsInternal)
|
||||||
|
tags = new[] { "Advanced" };
|
||||||
|
|
||||||
|
var entry = Config.Bind(CTG_NAME, config.Name, config.Value, new ConfigDescription(config.Description, null, tags));
|
||||||
|
|
||||||
entry.SettingChanged += (object o, EventArgs e) =>
|
entry.SettingChanged += (object o, EventArgs e) =>
|
||||||
{
|
{
|
||||||
|
@ -21,13 +21,9 @@ namespace UnityExplorer.Loader.ML
|
|||||||
{
|
{
|
||||||
prefCategory = MelonPreferences.CreateCategory(CTG_NAME, $"{CTG_NAME} Settings");
|
prefCategory = MelonPreferences.CreateCategory(CTG_NAME, $"{CTG_NAME} Settings");
|
||||||
|
|
||||||
try
|
// temporary until melonloader 0.3.1 released
|
||||||
{
|
try { MelonPreferences.Mapper.RegisterMapper(KeycodeReader, KeycodeWriter); } catch { }
|
||||||
// TEMPORARY - JUST REQUIRED UNTIL ML 0.3.1 RELEASED
|
try { MelonPreferences.Mapper.RegisterMapper(MenuPagesReader, MenuPagesWriter); } catch { }
|
||||||
MelonPreferences.Mapper.RegisterMapper(KeycodeReader, KeycodeWriter);
|
|
||||||
MelonPreferences.Mapper.RegisterMapper(MenuPagesReader, MenuPagesWriter);
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadConfig()
|
public override void LoadConfig()
|
||||||
|
@ -319,15 +319,13 @@ namespace UnityExplorer.UI.CacheObject
|
|||||||
default, new Color(1, 1, 1, 0));
|
default, new Color(1, 1, 1, 0));
|
||||||
UIFactory.SetLayoutElement(evalGroupObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 5000);
|
UIFactory.SetLayoutElement(evalGroupObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 5000);
|
||||||
|
|
||||||
var colors = new ColorBlock();
|
|
||||||
colors = RuntimeProvider.Instance.SetColorBlock(colors, new Color(0.4f, 0.4f, 0.4f),
|
|
||||||
new Color(0.4f, 0.7f, 0.4f), new Color(0.3f, 0.3f, 0.3f));
|
|
||||||
|
|
||||||
var evalButton = UIFactory.CreateButton(evalGroupObj,
|
var evalButton = UIFactory.CreateButton(evalGroupObj,
|
||||||
"EvalButton",
|
"EvalButton",
|
||||||
$"Evaluate ({ParamCount})",
|
$"Evaluate ({ParamCount})",
|
||||||
null,
|
null);
|
||||||
colors);
|
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(evalButton, new Color(0.4f, 0.4f, 0.4f),
|
||||||
|
new Color(0.4f, 0.7f, 0.4f), new Color(0.3f, 0.3f, 0.3f));
|
||||||
|
|
||||||
UIFactory.SetLayoutElement(evalButton.gameObject, minWidth: 100, minHeight: 22, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(evalButton.gameObject, minWidth: 100, minHeight: 22, flexibleWidth: 0);
|
||||||
|
|
||||||
@ -345,7 +343,7 @@ namespace UnityExplorer.UI.CacheObject
|
|||||||
argsHolder.SetActive(true);
|
argsHolder.SetActive(true);
|
||||||
m_isEvaluating = true;
|
m_isEvaluating = true;
|
||||||
evalText.text = "Evaluate";
|
evalText.text = "Evaluate";
|
||||||
evalButton.colors = RuntimeProvider.Instance.SetColorBlock(evalButton.colors, new Color(0.3f, 0.6f, 0.3f));
|
RuntimeProvider.Instance.SetColorBlock(evalButton, new Color(0.3f, 0.6f, 0.3f));
|
||||||
|
|
||||||
cancelButton.gameObject.SetActive(true);
|
cancelButton.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
@ -365,18 +363,17 @@ namespace UnityExplorer.UI.CacheObject
|
|||||||
m_isEvaluating = false;
|
m_isEvaluating = false;
|
||||||
|
|
||||||
evalText.text = $"Evaluate ({ParamCount})";
|
evalText.text = $"Evaluate ({ParamCount})";
|
||||||
evalButton.colors = RuntimeProvider.Instance.SetColorBlock(evalButton.colors, new Color(0.4f, 0.4f, 0.4f));
|
RuntimeProvider.Instance.SetColorBlock(evalButton, new Color(0.4f, 0.4f, 0.4f));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (this is CacheMethod)
|
else if (this is CacheMethod)
|
||||||
{
|
{
|
||||||
// simple method evaluate button
|
// simple method evaluate button
|
||||||
|
|
||||||
var colors = new ColorBlock();
|
var evalButton = UIFactory.CreateButton(m_rightGroup, "EvalButton", "Evaluate", () => { (this as CacheMethod).Evaluate(); });
|
||||||
colors = RuntimeProvider.Instance.SetColorBlock(colors, new Color(0.4f, 0.4f, 0.4f),
|
RuntimeProvider.Instance.SetColorBlock(evalButton, new Color(0.4f, 0.4f, 0.4f),
|
||||||
new Color(0.4f, 0.7f, 0.4f), new Color(0.3f, 0.3f, 0.3f));
|
new Color(0.4f, 0.7f, 0.4f), new Color(0.3f, 0.3f, 0.3f));
|
||||||
|
|
||||||
var evalButton = UIFactory.CreateButton(m_rightGroup, "EvalButton", "Evaluate", () => { (this as CacheMethod).Evaluate(); }, colors);
|
|
||||||
UIFactory.SetLayoutElement(evalButton.gameObject, minWidth: 100, minHeight: 22, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(evalButton.gameObject, minWidth: 100, minHeight: 22, flexibleWidth: 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,15 +168,13 @@ namespace UnityExplorer.UI.Inspectors.GameObjects
|
|||||||
s_childListToggles.Add(toggle);
|
s_childListToggles.Add(toggle);
|
||||||
toggle.onValueChanged.AddListener((bool val) => { OnToggleClicked(thisIndex, val); });
|
toggle.onValueChanged.AddListener((bool val) => { OnToggleClicked(thisIndex, val); });
|
||||||
|
|
||||||
ColorBlock mainColors = new ColorBlock();
|
|
||||||
mainColors = RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
|
|
||||||
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.05f, 0.05f, 0.05f));
|
|
||||||
|
|
||||||
var mainBtn = UIFactory.CreateButton(btnGroupObj,
|
var mainBtn = UIFactory.CreateButton(btnGroupObj,
|
||||||
"MainButton",
|
"MainButton",
|
||||||
"",
|
"",
|
||||||
() => { OnChildListObjectClicked(thisIndex); },
|
() => { OnChildListObjectClicked(thisIndex); });
|
||||||
mainColors);
|
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(mainBtn, new Color(0.07f, 0.07f, 0.07f),
|
||||||
|
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.05f, 0.05f, 0.05f));
|
||||||
|
|
||||||
UIFactory.SetLayoutElement(mainBtn.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(mainBtn.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
|
@ -165,15 +165,13 @@ namespace UnityExplorer.UI.Inspectors.GameObjects
|
|||||||
|
|
||||||
// Main component button
|
// Main component button
|
||||||
|
|
||||||
ColorBlock mainColors = new ColorBlock();
|
|
||||||
mainColors = RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
|
|
||||||
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.05f, 0.05f, 0.05f));
|
|
||||||
|
|
||||||
var mainBtn = UIFactory.CreateButton(groupObj,
|
var mainBtn = UIFactory.CreateButton(groupObj,
|
||||||
"MainButton",
|
"MainButton",
|
||||||
"",
|
"",
|
||||||
() => { OnCompListObjectClicked(thisIndex); },
|
() => { OnCompListObjectClicked(thisIndex); });
|
||||||
mainColors);
|
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(mainBtn, new Color(0.07f, 0.07f, 0.07f),
|
||||||
|
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.05f, 0.05f, 0.05f));
|
||||||
|
|
||||||
UIFactory.SetLayoutElement(mainBtn.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 25, flexibleWidth: 999);
|
UIFactory.SetLayoutElement(mainBtn.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 25, flexibleWidth: 999);
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ namespace UnityExplorer.UI.Inspectors.GameObjects
|
|||||||
var sliderObj = UIFactory.CreateSlider(rowObject, "VectorSlider", out Slider slider);
|
var sliderObj = UIFactory.CreateSlider(rowObject, "VectorSlider", out Slider slider);
|
||||||
UIFactory.SetLayoutElement(sliderObj, minHeight: 20, flexibleHeight: 0, minWidth: 200, flexibleWidth: 9000);
|
UIFactory.SetLayoutElement(sliderObj, minHeight: 20, flexibleHeight: 0, minWidth: 200, flexibleWidth: 9000);
|
||||||
sliderObj.transform.Find("Fill Area").gameObject.SetActive(false);
|
sliderObj.transform.Find("Fill Area").gameObject.SetActive(false);
|
||||||
slider.colors = RuntimeProvider.Instance.SetColorBlock(slider.colors, new Color(0.65f, 0.65f, 0.65f));
|
RuntimeProvider.Instance.SetColorBlock(slider, new Color(0.65f, 0.65f, 0.65f));
|
||||||
slider.minValue = -2;
|
slider.minValue = -2;
|
||||||
slider.maxValue = 2;
|
slider.maxValue = 2;
|
||||||
slider.value = 0;
|
slider.value = 0;
|
||||||
|
@ -130,12 +130,12 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
public void OnSetInspectorTab(InspectorBase inspector)
|
public void OnSetInspectorTab(InspectorBase inspector)
|
||||||
{
|
{
|
||||||
Color activeColor = new Color(0, 0.25f, 0, 1);
|
Color activeColor = new Color(0, 0.25f, 0, 1);
|
||||||
inspector.m_tabButton.colors = RuntimeProvider.Instance.SetColorBlock(inspector.m_tabButton.colors, activeColor, activeColor);
|
RuntimeProvider.Instance.SetColorBlock(inspector.m_tabButton, activeColor, activeColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnUnsetInspectorTab()
|
public void OnUnsetInspectorTab()
|
||||||
{
|
{
|
||||||
m_activeInspector.m_tabButton.colors = RuntimeProvider.Instance.SetColorBlock(m_activeInspector.m_tabButton.colors,
|
RuntimeProvider.Instance.SetColorBlock(m_activeInspector.m_tabButton,
|
||||||
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.1f, 0.3f, 0.1f, 1));
|
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.1f, 0.3f, 0.1f, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ namespace UnityExplorer.UI.Inspectors.Reflection
|
|||||||
internal void OnScopeFilterClicked(MemberScopes type, Button button)
|
internal void OnScopeFilterClicked(MemberScopes type, Button button)
|
||||||
{
|
{
|
||||||
if (m_lastActiveScopeButton)
|
if (m_lastActiveScopeButton)
|
||||||
m_lastActiveScopeButton.colors = RuntimeProvider.Instance.SetColorBlock(m_lastActiveScopeButton.colors, new Color(0.2f, 0.2f, 0.2f));
|
RuntimeProvider.Instance.SetColorBlock(m_lastActiveScopeButton, new Color(0.2f, 0.2f, 0.2f));
|
||||||
|
|
||||||
m_scopeFilter = type;
|
m_scopeFilter = type;
|
||||||
m_lastActiveScopeButton = button;
|
m_lastActiveScopeButton = button;
|
||||||
|
|
||||||
m_lastActiveScopeButton.colors = RuntimeProvider.Instance.SetColorBlock(m_lastActiveScopeButton.colors, new Color(0.2f, 0.6f, 0.2f));
|
RuntimeProvider.Instance.SetColorBlock(m_lastActiveScopeButton, new Color(0.2f, 0.6f, 0.2f));
|
||||||
|
|
||||||
FilterMembers(null, true);
|
FilterMembers(null, true);
|
||||||
m_sliderScroller.m_slider.value = 1f;
|
m_sliderScroller.m_slider.value = 1f;
|
||||||
@ -240,11 +240,11 @@ namespace UnityExplorer.UI.Inspectors.Reflection
|
|||||||
|
|
||||||
btn.onClick.AddListener(() => { OnScopeFilterClicked(type, btn); });
|
btn.onClick.AddListener(() => { OnScopeFilterClicked(type, btn); });
|
||||||
|
|
||||||
btn.colors = RuntimeProvider.Instance.SetColorBlock(btn.colors, highlighted: new Color(0.3f, 0.7f, 0.3f));
|
RuntimeProvider.Instance.SetColorBlock(btn, highlighted: new Color(0.3f, 0.7f, 0.3f));
|
||||||
|
|
||||||
if (setEnabled)
|
if (setEnabled)
|
||||||
{
|
{
|
||||||
btn.colors = RuntimeProvider.Instance.SetColorBlock(btn.colors, new Color(0.2f, 0.6f, 0.2f));
|
RuntimeProvider.Instance.SetColorBlock(btn, new Color(0.2f, 0.6f, 0.2f));
|
||||||
m_scopeFilter = type;
|
m_scopeFilter = type;
|
||||||
m_lastActiveScopeButton = btn;
|
m_lastActiveScopeButton = btn;
|
||||||
}
|
}
|
||||||
|
@ -241,12 +241,12 @@ namespace UnityExplorer.UI.Inspectors.Reflection
|
|||||||
internal void OnMemberFilterClicked(MemberTypes type, Button button)
|
internal void OnMemberFilterClicked(MemberTypes type, Button button)
|
||||||
{
|
{
|
||||||
if (m_lastActiveMemButton)
|
if (m_lastActiveMemButton)
|
||||||
m_lastActiveMemButton.colors = RuntimeProvider.Instance.SetColorBlock(m_lastActiveMemButton.colors, new Color(0.2f, 0.2f, 0.2f));
|
RuntimeProvider.Instance.SetColorBlock(m_lastActiveMemButton, new Color(0.2f, 0.2f, 0.2f));
|
||||||
|
|
||||||
m_memberFilter = type;
|
m_memberFilter = type;
|
||||||
m_lastActiveMemButton = button;
|
m_lastActiveMemButton = button;
|
||||||
|
|
||||||
m_lastActiveMemButton.colors = RuntimeProvider.Instance.SetColorBlock(m_lastActiveMemButton.colors, new Color(0.2f, 0.6f, 0.2f));
|
RuntimeProvider.Instance.SetColorBlock(m_lastActiveMemButton, new Color(0.2f, 0.6f, 0.2f));
|
||||||
|
|
||||||
FilterMembers(null, true);
|
FilterMembers(null, true);
|
||||||
m_sliderScroller.m_slider.value = 1f;
|
m_sliderScroller.m_slider.value = 1f;
|
||||||
@ -461,11 +461,11 @@ namespace UnityExplorer.UI.Inspectors.Reflection
|
|||||||
UIFactory.SetLayoutElement(btn.gameObject, minHeight: 25, minWidth: 70);
|
UIFactory.SetLayoutElement(btn.gameObject, minHeight: 25, minWidth: 70);
|
||||||
btn.onClick.AddListener(() => { OnMemberFilterClicked(type, btn); });
|
btn.onClick.AddListener(() => { OnMemberFilterClicked(type, btn); });
|
||||||
|
|
||||||
btn.colors = RuntimeProvider.Instance.SetColorBlock(btn.colors, highlighted: new Color(0.3f, 0.7f, 0.3f));
|
RuntimeProvider.Instance.SetColorBlock(btn, highlighted: new Color(0.3f, 0.7f, 0.3f));
|
||||||
|
|
||||||
if (setEnabled)
|
if (setEnabled)
|
||||||
{
|
{
|
||||||
btn.colors = RuntimeProvider.Instance.SetColorBlock(btn.colors, new Color(0.2f, 0.6f, 0.2f));
|
RuntimeProvider.Instance.SetColorBlock(btn, new Color(0.2f, 0.6f, 0.2f));
|
||||||
m_memberFilter = type;
|
m_memberFilter = type;
|
||||||
m_lastActiveMemButton = btn;
|
m_lastActiveMemButton = btn;
|
||||||
}
|
}
|
||||||
|
@ -271,12 +271,10 @@ namespace UnityExplorer.UI.Main.CSConsole
|
|||||||
mainGroup.childForceExpandHeight = false;
|
mainGroup.childForceExpandHeight = false;
|
||||||
mainGroup.childForceExpandWidth = true;
|
mainGroup.childForceExpandWidth = true;
|
||||||
|
|
||||||
ColorBlock btnColors = new ColorBlock();
|
|
||||||
RuntimeProvider.Instance.SetColorBlock(btnColors, new Color(0, 0, 0, 0), highlighted: new Color(0.2f, 0.2f, 0.2f, 1.0f));
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_LABELS; i++)
|
for (int i = 0; i < MAX_LABELS; i++)
|
||||||
{
|
{
|
||||||
var btn = UIFactory.CreateButton(content, "AutoCompleteButton", "", null, btnColors);
|
var btn = UIFactory.CreateButton(content, "AutoCompleteButton", "", null);
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(btn, new Color(0, 0, 0, 0), highlighted: new Color(0.2f, 0.2f, 0.2f, 1.0f));
|
||||||
|
|
||||||
var nav = btn.navigation;
|
var nav = btn.navigation;
|
||||||
nav.mode = Navigation.Mode.Vertical;
|
nav.mode = Navigation.Mode.Vertical;
|
||||||
|
@ -199,23 +199,10 @@ The following helper methods are available:
|
|||||||
InputField.onValueChanged.AddListener((string s) => { OnInputChanged(s); });
|
InputField.onValueChanged.AddListener((string s) => { OnInputChanged(s); });
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool IsUserCopyPasting()
|
|
||||||
{
|
|
||||||
return (InputManager.GetKey(KeyCode.LeftControl) || InputManager.GetKey(KeyCode.RightControl))
|
|
||||||
&& InputManager.GetKeyDown(KeyCode.V);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateConsole()
|
public void UpdateConsole()
|
||||||
{
|
{
|
||||||
if (s_copyPasteBuffer != null)
|
if (Time.time > s_timeOfLastInternalSet)
|
||||||
{
|
Writing = false;
|
||||||
if (!IsUserCopyPasting())
|
|
||||||
{
|
|
||||||
OnInputChanged(s_copyPasteBuffer);
|
|
||||||
|
|
||||||
s_copyPasteBuffer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EnableCtrlRShortcut)
|
if (EnableCtrlRShortcut)
|
||||||
{
|
{
|
||||||
@ -274,6 +261,8 @@ The following helper methods are available:
|
|||||||
|
|
||||||
public void UseAutocomplete(string suggestion)
|
public void UseAutocomplete(string suggestion)
|
||||||
{
|
{
|
||||||
|
Writing = true;
|
||||||
|
|
||||||
string input = InputField.text;
|
string input = InputField.text;
|
||||||
input = input.Insert(m_lastCaretPos, suggestion);
|
input = input.Insert(m_lastCaretPos, suggestion);
|
||||||
InputField.text = input;
|
InputField.text = input;
|
||||||
@ -288,20 +277,32 @@ The following helper methods are available:
|
|||||||
AutoCompleter.ClearAutocompletes();
|
AutoCompleter.ClearAutocompletes();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string s_copyPasteBuffer;
|
private static float s_timeOfLastUpdate;
|
||||||
|
private static bool Writing
|
||||||
|
{
|
||||||
|
get => s_writing;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
s_timeOfLastInternalSet = Time.time;
|
||||||
|
s_writing = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static bool s_writing;
|
||||||
|
private static float s_timeOfLastInternalSet;
|
||||||
|
|
||||||
public void OnInputChanged(string newText, bool forceUpdate = false)
|
public void OnInputChanged(string newText, bool forceUpdate = false)
|
||||||
{
|
{
|
||||||
if (IsUserCopyPasting())
|
if (!Writing && Time.time <= s_timeOfLastUpdate)
|
||||||
{
|
|
||||||
//Console.WriteLine("Copy+Paste detected!");
|
|
||||||
s_copyPasteBuffer = newText;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
s_timeOfLastUpdate = Time.time;
|
||||||
|
|
||||||
if (EnableAutoIndent)
|
if (EnableAutoIndent)
|
||||||
UpdateIndent(newText);
|
UpdateIndent(newText);
|
||||||
|
|
||||||
|
Writing = true;
|
||||||
|
|
||||||
if (!forceUpdate && string.IsNullOrEmpty(newText))
|
if (!forceUpdate && string.IsNullOrEmpty(newText))
|
||||||
inputHighlightText.text = string.Empty;
|
inputHighlightText.text = string.Empty;
|
||||||
else
|
else
|
||||||
@ -378,6 +379,8 @@ The following helper methods are available:
|
|||||||
|
|
||||||
private void AutoIndentCaret()
|
private void AutoIndentCaret()
|
||||||
{
|
{
|
||||||
|
Writing = true;
|
||||||
|
|
||||||
if (CurrentIndent > 0)
|
if (CurrentIndent > 0)
|
||||||
{
|
{
|
||||||
string indent = GetAutoIndentTab(CurrentIndent);
|
string indent = GetAutoIndentTab(CurrentIndent);
|
||||||
|
@ -522,15 +522,13 @@ namespace UnityExplorer.UI.Main.Home
|
|||||||
m_shortListToggles.Add(toggle);
|
m_shortListToggles.Add(toggle);
|
||||||
toggle.onValueChanged.AddListener((bool val) => { OnToggleClicked(thisIndex, val); });
|
toggle.onValueChanged.AddListener((bool val) => { OnToggleClicked(thisIndex, val); });
|
||||||
|
|
||||||
ColorBlock mainColors = new ColorBlock();
|
|
||||||
mainColors = RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.1f, 0.1f, 0.1f),
|
|
||||||
new Color(0.2f, 0.2f, 0.2f), new Color(0.05f, 0.05f, 0.05f));
|
|
||||||
|
|
||||||
var mainButton = UIFactory.CreateButton(btnGroupObj,
|
var mainButton = UIFactory.CreateButton(btnGroupObj,
|
||||||
"MainButton",
|
"MainButton",
|
||||||
"",
|
"",
|
||||||
() => { SceneListObjectClicked(thisIndex); },
|
() => { SceneListObjectClicked(thisIndex); });
|
||||||
mainColors);
|
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(mainButton, new Color(0.1f, 0.1f, 0.1f),
|
||||||
|
new Color(0.2f, 0.2f, 0.2f), new Color(0.05f, 0.05f, 0.05f));
|
||||||
|
|
||||||
UIFactory.SetLayoutElement(mainButton.gameObject, minHeight: 25, minWidth: 230);
|
UIFactory.SetLayoutElement(mainButton.gameObject, minHeight: 25, minWidth: 230);
|
||||||
|
|
||||||
@ -539,15 +537,13 @@ namespace UnityExplorer.UI.Main.Home
|
|||||||
mainText.horizontalOverflow = HorizontalWrapMode.Overflow;
|
mainText.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||||
m_shortListTexts.Add(mainText);
|
m_shortListTexts.Add(mainText);
|
||||||
|
|
||||||
ColorBlock inspectColors = new ColorBlock();
|
|
||||||
inspectColors = RuntimeProvider.Instance.SetColorBlock(inspectColors, new Color(0.15f, 0.15f, 0.15f),
|
|
||||||
new Color(0.2f, 0.2f, 0.2f), new Color(0.1f, 0.1f, 0.1f));
|
|
||||||
|
|
||||||
var inspectButton = UIFactory.CreateButton(btnGroupObj,
|
var inspectButton = UIFactory.CreateButton(btnGroupObj,
|
||||||
"InspectButton",
|
"InspectButton",
|
||||||
"Inspect",
|
"Inspect",
|
||||||
() => { InspectorManager.Instance.Inspect(m_shortList[thisIndex]); },
|
() => { InspectorManager.Instance.Inspect(m_shortList[thisIndex]); });
|
||||||
inspectColors);
|
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(inspectButton, new Color(0.15f, 0.15f, 0.15f),
|
||||||
|
new Color(0.2f, 0.2f, 0.2f), new Color(0.1f, 0.1f, 0.1f));
|
||||||
|
|
||||||
UIFactory.SetLayoutElement(inspectButton.gameObject, minWidth: 60, minHeight: 25);
|
UIFactory.SetLayoutElement(inspectButton.gameObject, minWidth: 60, minHeight: 25);
|
||||||
}
|
}
|
||||||
|
@ -141,12 +141,12 @@ namespace UnityExplorer.UI.Main
|
|||||||
|
|
||||||
internal void SetButtonActiveColors(Button button)
|
internal void SetButtonActiveColors(Button button)
|
||||||
{
|
{
|
||||||
button.colors = RuntimeProvider.Instance.SetColorBlock(button.colors, m_navButtonSelected);
|
RuntimeProvider.Instance.SetColorBlock(button, m_navButtonSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetButtonInactiveColors(Button button)
|
internal void SetButtonInactiveColors(Button button)
|
||||||
{
|
{
|
||||||
button.colors = RuntimeProvider.Instance.SetColorBlock(button.colors, m_navButtonNormal);
|
RuntimeProvider.Instance.SetColorBlock(button, m_navButtonNormal);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region UI Construction
|
#region UI Construction
|
||||||
@ -184,15 +184,13 @@ namespace UnityExplorer.UI.Main
|
|||||||
|
|
||||||
// Hide button
|
// Hide button
|
||||||
|
|
||||||
ColorBlock colorBlock = new ColorBlock();
|
|
||||||
colorBlock = RuntimeProvider.Instance.SetColorBlock(colorBlock, new Color(65f / 255f, 23f / 255f, 23f / 255f),
|
|
||||||
new Color(35f / 255f, 10f / 255f, 10f / 255f), new Color(156f / 255f, 0f, 0f));
|
|
||||||
|
|
||||||
var hideButton = UIFactory.CreateButton(titleBar,
|
var hideButton = UIFactory.CreateButton(titleBar,
|
||||||
"HideButton",
|
"HideButton",
|
||||||
$"Hide ({ConfigManager.Main_Menu_Toggle.Value})",
|
$"Hide ({ConfigManager.Main_Menu_Toggle.Value})",
|
||||||
() => { UIManager.ShowMenu = false; },
|
() => { UIManager.ShowMenu = false; });
|
||||||
colorBlock);
|
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(hideButton, new Color(65f / 255f, 23f / 255f, 23f / 255f),
|
||||||
|
new Color(35f / 255f, 10f / 255f, 10f / 255f), new Color(156f / 255f, 0f, 0f));
|
||||||
|
|
||||||
UIFactory.SetLayoutElement(hideButton.gameObject, minWidth: 90, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(hideButton.gameObject, minWidth: 90, flexibleWidth: 0);
|
||||||
|
|
||||||
@ -213,16 +211,14 @@ namespace UnityExplorer.UI.Main
|
|||||||
GameObject navbarObj = UIFactory.CreateHorizontalGroup(content, "MainNavBar", true, true, true, true, 5);
|
GameObject navbarObj = UIFactory.CreateHorizontalGroup(content, "MainNavBar", true, true, true, true, 5);
|
||||||
UIFactory.SetLayoutElement(navbarObj, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(navbarObj, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
ColorBlock colorBlock = new ColorBlock();
|
|
||||||
colorBlock = RuntimeProvider.Instance.SetColorBlock(colorBlock, m_navButtonNormal, m_navButtonHighlight, m_navButtonSelected);
|
|
||||||
|
|
||||||
foreach (var page in Pages)
|
foreach (var page in Pages)
|
||||||
{
|
{
|
||||||
Button btn = UIFactory.CreateButton(navbarObj,
|
Button btn = UIFactory.CreateButton(navbarObj,
|
||||||
$"Button_{page.Name}",
|
$"Button_{page.Name}",
|
||||||
page.Name,
|
page.Name,
|
||||||
() => { SetPage(page); },
|
() => { SetPage(page); });
|
||||||
colorBlock);
|
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(btn, m_navButtonNormal, m_navButtonHighlight, m_navButtonSelected);
|
||||||
|
|
||||||
page.RefNavbarButton = btn;
|
page.RefNavbarButton = btn;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ namespace UnityExplorer.UI.Main.Search
|
|||||||
|
|
||||||
m_selectedContextButton = button;
|
m_selectedContextButton = button;
|
||||||
|
|
||||||
m_selectedContextButton.colors = RuntimeProvider.Instance.SetColorBlock(m_selectedContextButton.colors,
|
RuntimeProvider.Instance.SetColorBlock(m_selectedContextButton,
|
||||||
new Color(0.35f, 0.7f, 0.35f), new Color(0.35f, 0.7f, 0.35f));
|
new Color(0.35f, 0.7f, 0.35f), new Color(0.35f, 0.7f, 0.35f));
|
||||||
|
|
||||||
m_context = context;
|
m_context = context;
|
||||||
@ -439,15 +439,13 @@ namespace UnityExplorer.UI.Main.Search
|
|||||||
UIFactory.SetLayoutElement(btnGroupObj, flexibleWidth: 320, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(btnGroupObj, flexibleWidth: 320, minHeight: 25, flexibleHeight: 0);
|
||||||
btnGroupObj.AddComponent<Mask>();
|
btnGroupObj.AddComponent<Mask>();
|
||||||
|
|
||||||
var mainColors = new ColorBlock();
|
|
||||||
RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.1f, 0.1f, 0.1f),
|
|
||||||
new Color(0.2f, 0.2f, 0.2f), new Color(0.05f, 0.05f, 0.05f));
|
|
||||||
|
|
||||||
var mainButton = UIFactory.CreateButton(btnGroupObj,
|
var mainButton = UIFactory.CreateButton(btnGroupObj,
|
||||||
"ResultButton",
|
"ResultButton",
|
||||||
"",
|
"",
|
||||||
() => { OnResultClicked(thisIndex); },
|
() => { OnResultClicked(thisIndex); });
|
||||||
mainColors);
|
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(mainButton, new Color(0.1f, 0.1f, 0.1f),
|
||||||
|
new Color(0.2f, 0.2f, 0.2f), new Color(0.05f, 0.05f, 0.05f));
|
||||||
|
|
||||||
UIFactory.SetLayoutElement(mainButton.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 320, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(mainButton.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 320, flexibleWidth: 0);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
internal static void SetDefaultSelectableColors(Selectable selectable)
|
internal static void SetDefaultSelectableColors(Selectable selectable)
|
||||||
{
|
{
|
||||||
selectable.colors = RuntimeProvider.Instance.SetColorBlock(selectable.colors, new Color(0.2f, 0.2f, 0.2f),
|
RuntimeProvider.Instance.SetColorBlock(selectable, new Color(0.2f, 0.2f, 0.2f),
|
||||||
new Color(0.3f, 0.3f, 0.3f), new Color(0.15f, 0.15f, 0.15f));
|
new Color(0.3f, 0.3f, 0.3f), new Color(0.15f, 0.15f, 0.15f));
|
||||||
|
|
||||||
// Deselect all Buttons after they are clicked.
|
// Deselect all Buttons after they are clicked.
|
||||||
@ -60,19 +60,6 @@ namespace UnityExplorer.UI
|
|||||||
button.onClick.AddListener(() => { button.OnDeselect(null); });
|
button.onClick.AddListener(() => { button.OnDeselect(null); });
|
||||||
}
|
}
|
||||||
|
|
||||||
//public static void SetColorBlockValues(ref this ColorBlock colorBlock, Color? normal = null, Color? highlighted = null,
|
|
||||||
// Color? pressed = null)
|
|
||||||
//{
|
|
||||||
// if (normal != null)
|
|
||||||
// colorBlock.normalColor = (Color)normal;
|
|
||||||
|
|
||||||
// if (highlighted != null)
|
|
||||||
// colorBlock.highlightedColor = (Color)highlighted;
|
|
||||||
|
|
||||||
// if (pressed != null)
|
|
||||||
// colorBlock.pressedColor = (Color)pressed;
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get and/or Add a LayoutElement component to the GameObject, and set any of the values on it.
|
/// Get and/or Add a LayoutElement component to the GameObject, and set any of the values on it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -276,10 +263,12 @@ namespace UnityExplorer.UI
|
|||||||
{
|
{
|
||||||
var colors = new ColorBlock();
|
var colors = new ColorBlock();
|
||||||
normalColor = normalColor ?? new Color(0.25f, 0.25f, 0.25f);
|
normalColor = normalColor ?? new Color(0.25f, 0.25f, 0.25f);
|
||||||
colors = RuntimeProvider.Instance.SetColorBlock(colors, normalColor, new Color(0.4f, 0.4f, 0.4f),
|
|
||||||
new Color(0.15f, 0.15f, 0.15f));
|
|
||||||
|
|
||||||
return CreateButton(parent, name, text, onClick, colors);
|
var btn = CreateButton(parent, name, text, onClick, colors);
|
||||||
|
|
||||||
|
RuntimeProvider.Instance.SetColorBlock(btn, normalColor, new Color(0.4f, 0.4f, 0.4f), new Color(0.15f, 0.15f, 0.15f));
|
||||||
|
|
||||||
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Button CreateButton(GameObject parent, string name, string text, Action onClick, ColorBlock colors)
|
public static Button CreateButton(GameObject parent, string name, string text, Action onClick, ColorBlock colors)
|
||||||
@ -296,7 +285,7 @@ namespace UnityExplorer.UI
|
|||||||
SetDefaultSelectableColors(button);
|
SetDefaultSelectableColors(button);
|
||||||
|
|
||||||
colors.colorMultiplier = 1;
|
colors.colorMultiplier = 1;
|
||||||
button.colors = colors;
|
RuntimeProvider.Instance.SetColorBlock(button, colors);
|
||||||
|
|
||||||
Text textComp = textObj.AddComponent<Text>();
|
Text textComp = textObj.AddComponent<Text>();
|
||||||
textComp.text = text;
|
textComp.text = text;
|
||||||
@ -364,7 +353,7 @@ namespace UnityExplorer.UI
|
|||||||
slider.targetGraphic = handleImage;
|
slider.targetGraphic = handleImage;
|
||||||
slider.direction = Slider.Direction.LeftToRight;
|
slider.direction = Slider.Direction.LeftToRight;
|
||||||
|
|
||||||
slider.colors = RuntimeProvider.Instance.SetColorBlock(slider.colors, new Color(0.4f, 0.4f, 0.4f),
|
RuntimeProvider.Instance.SetColorBlock(slider, new Color(0.4f, 0.4f, 0.4f),
|
||||||
new Color(0.55f, 0.55f, 0.55f), new Color(0.3f, 0.3f, 0.3f));
|
new Color(0.55f, 0.55f, 0.55f), new Color(0.3f, 0.3f, 0.3f));
|
||||||
|
|
||||||
return sliderObj;
|
return sliderObj;
|
||||||
@ -504,7 +493,7 @@ namespace UnityExplorer.UI
|
|||||||
mainInput.transition = Selectable.Transition.ColorTint;
|
mainInput.transition = Selectable.Transition.ColorTint;
|
||||||
mainInput.targetGraphic = mainImage;
|
mainInput.targetGraphic = mainImage;
|
||||||
|
|
||||||
mainInput.colors = RuntimeProvider.Instance.SetColorBlock(mainInput.colors, new Color(1, 1, 1, 1),
|
RuntimeProvider.Instance.SetColorBlock(mainInput, new Color(1, 1, 1, 1),
|
||||||
new Color(0.95f, 0.95f, 0.95f, 1.0f), new Color(0.78f, 0.78f, 0.78f, 1.0f));
|
new Color(0.95f, 0.95f, 0.95f, 1.0f), new Color(0.78f, 0.78f, 0.78f, 1.0f));
|
||||||
|
|
||||||
SetLayoutGroup<VerticalLayoutGroup>(mainObj, true, true, true, true);
|
SetLayoutGroup<VerticalLayoutGroup>(mainObj, true, true, true, true);
|
||||||
@ -609,7 +598,7 @@ namespace UnityExplorer.UI
|
|||||||
Toggle itemToggle = itemObj.AddComponent<Toggle>();
|
Toggle itemToggle = itemObj.AddComponent<Toggle>();
|
||||||
itemToggle.targetGraphic = itemBgImage;
|
itemToggle.targetGraphic = itemBgImage;
|
||||||
itemToggle.isOn = true;
|
itemToggle.isOn = true;
|
||||||
itemToggle.colors = RuntimeProvider.Instance.SetColorBlock(itemToggle.colors,
|
RuntimeProvider.Instance.SetColorBlock(itemToggle,
|
||||||
new Color(0.35f, 0.35f, 0.35f, 1.0f), new Color(0.25f, 0.45f, 0.25f, 1.0f));
|
new Color(0.35f, 0.35f, 0.35f, 1.0f), new Color(0.25f, 0.45f, 0.25f, 1.0f));
|
||||||
|
|
||||||
itemToggle.onValueChanged.AddListener((bool val) => { itemToggle.OnDeselect(null); });
|
itemToggle.onValueChanged.AddListener((bool val) => { itemToggle.OnDeselect(null); });
|
||||||
|
Reference in New Issue
Block a user