mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-12 23:06:56 +08:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
a6c24f91e4 | |||
9e4c335a05 | |||
a1c2dfbe50 |
@ -24,6 +24,7 @@ namespace UnityExplorer.Core.Config
|
|||||||
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;
|
||||||
@ -85,6 +86,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",
|
||||||
|
@ -164,8 +164,10 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp
|
|||||||
internal static PropertyInfo _normalColorProp;
|
internal static PropertyInfo _normalColorProp;
|
||||||
internal static PropertyInfo _highlightColorProp;
|
internal static PropertyInfo _highlightColorProp;
|
||||||
internal static PropertyInfo _pressedColorProp;
|
internal static PropertyInfo _pressedColorProp;
|
||||||
|
internal static PropertyInfo _disabledColorProp;
|
||||||
|
|
||||||
public override void SetColorBlock(Selectable selectable, 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;
|
var colors = selectable.colors;
|
||||||
|
|
||||||
@ -183,6 +185,8 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp
|
|||||||
_highlightColorProp = high;
|
_highlightColorProp = high;
|
||||||
if (ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "pressedColor") is PropertyInfo pres && pres.CanWrite)
|
if (ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "pressedColor") is PropertyInfo pres && pres.CanWrite)
|
||||||
_pressedColorProp = pres;
|
_pressedColorProp = pres;
|
||||||
|
if (ReflectionUtility.GetPropertyInfo(typeof(ColorBlock), "disabledColor") is PropertyInfo disa && disa.CanWrite)
|
||||||
|
_disabledColorProp = disa;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -210,6 +214,14 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp
|
|||||||
else if (ReflectionUtility.GetFieldInfo(typeof(ColorBlock), "m_PressedColor") is FieldInfo fi)
|
else if (ReflectionUtility.GetFieldInfo(typeof(ColorBlock), "m_PressedColor") is FieldInfo fi)
|
||||||
fi.SetValue(boxed, (Color)pressed);
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,8 @@ namespace UnityExplorer.Core.Runtime.Mono
|
|||||||
return scene.rootCount;
|
return scene.rootCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetColorBlock(Selectable selectable, 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;
|
var colors = selectable.colors;
|
||||||
|
|
||||||
@ -99,6 +100,9 @@ namespace UnityExplorer.Core.Runtime.Mono
|
|||||||
if (pressed != null)
|
if (pressed != null)
|
||||||
colors.pressedColor = (Color)pressed;
|
colors.pressedColor = (Color)pressed;
|
||||||
|
|
||||||
|
if (disabled != null)
|
||||||
|
colors.disabledColor = (Color)disabled;
|
||||||
|
|
||||||
SetColorBlock(selectable, colors);
|
SetColorBlock(selectable, colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
public abstract void SetColorBlock(Selectable selectable, ColorBlock colors);
|
public abstract void SetColorBlock(Selectable selectable, ColorBlock colors);
|
||||||
|
|
||||||
public abstract void SetColorBlock(Selectable selectable, Color? normal = null, Color? highlighted = null, Color? pressed = null);
|
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.11";
|
public const string VERSION = "3.3.12";
|
||||||
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,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()
|
||||||
|
Reference in New Issue
Block a user