diff --git a/src/Core/Runtime/Il2Cpp/Il2CppProvider.cs b/src/Core/Runtime/Il2Cpp/Il2CppProvider.cs index 52f2868..76b1a3a 100644 --- a/src/Core/Runtime/Il2Cpp/Il2CppProvider.cs +++ b/src/Core/Runtime/Il2Cpp/Il2CppProvider.cs @@ -164,8 +164,10 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp internal static PropertyInfo _normalColorProp; internal static PropertyInfo _highlightColorProp; 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; @@ -183,6 +185,8 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp _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; } try @@ -210,6 +214,14 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp 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) { diff --git a/src/Core/Runtime/Mono/MonoProvider.cs b/src/Core/Runtime/Mono/MonoProvider.cs index 52a293b..3501634 100644 --- a/src/Core/Runtime/Mono/MonoProvider.cs +++ b/src/Core/Runtime/Mono/MonoProvider.cs @@ -86,7 +86,8 @@ namespace UnityExplorer.Core.Runtime.Mono 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; @@ -99,6 +100,9 @@ namespace UnityExplorer.Core.Runtime.Mono if (pressed != null) colors.pressedColor = (Color)pressed; + if (disabled != null) + colors.disabledColor = (Color)disabled; + SetColorBlock(selectable, colors); } diff --git a/src/Core/Runtime/RuntimeProvider.cs b/src/Core/Runtime/RuntimeProvider.cs index c97d3bc..7715676 100644 --- a/src/Core/Runtime/RuntimeProvider.cs +++ b/src/Core/Runtime/RuntimeProvider.cs @@ -64,7 +64,8 @@ namespace UnityExplorer 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 instances) {