using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib; using BoneLib.BoneMenu; using BoneLib.BoneMenu.UI; using Colorful; using HarmonyLib; using Il2CppSLZ.Bonelab; using Il2CppSLZ.UI; using Il2CppTMPro; using MelonLoader; using MelonLoader.Preferences; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Main), "Colorful-Revived", "1.0.0", "TogenMerfagen", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: MelonPriority(1)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("TogenMerfagen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3caa917183c681c5043edd69ed952ee739edf82b")] [assembly: AssemblyProduct("Colorful")] [assembly: AssemblyTitle("Colorful")] [assembly: AssemblyVersion("1.0.0.0")] namespace Colorful; internal class PreferencesCreator { private static Page _menuPage; private static Page _northPage; private static Page _northEastPage; private static Page _eastPage; private static Page _southEastPage; private static Page _southPage; private static Page _southWestPage; private static Page _westPage; private static Page _northWestPage; private static Page _middlePage; private static Page[] _directionalPages; public static MelonPreferences_Category MelonPrefCategory { get; private set; } public static MelonPreferences_Entry MelonPrefEnabled { get; private set; } public static bool IsEnabled { get; private set; } public static MelonPreferences_Entry NorthPref { get; private set; } public static MelonPreferences_Entry NorthEastPref { get; private set; } public static MelonPreferences_Entry EastPref { get; private set; } public static MelonPreferences_Entry SouthEastPref { get; private set; } public static MelonPreferences_Entry SouthPref { get; private set; } public static MelonPreferences_Entry SouthWestPref { get; private set; } public static MelonPreferences_Entry WestPref { get; private set; } public static MelonPreferences_Entry NorthWestPref { get; private set; } public static MelonPreferences_Entry MiddlePref { get; private set; } public static MelonPreferences_Entry MenuPref { get; private set; } public static void BonemenuCreator() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) Page val = Page.Root.CreatePage(BuildRainbowName(), Color.white, 0, true); val.CreateBool("Mod Toggle", Color.yellow, IsEnabled, (Action)OnSetEnabled); Page root = val.CreatePage("UI Colors", Colors.Menu, 0, true); _menuPage = CreateColorPage(root, "Menu", Colors.Menu, MenuPref); _middlePage = CreateColorPage(root, "Radial Cancel", Colors.Middle, MiddlePref); Page root2 = val.CreatePage("Radial Menu", Color.white, 0, true); _northPage = CreateColorPage(root2, "Eject", Colors.North, NorthPref); _northEastPage = CreateColorPage(root2, "Level Select", Colors.NorthEast, NorthEastPref); _eastPage = CreateColorPage(root2, "Preferences", Colors.East, EastPref); _southEastPage = CreateColorPage(root2, "Quick Mute", Colors.SouthEast, SouthEastPref); _southPage = CreateColorPage(root2, "Inventory", Colors.South, SouthPref); _southWestPage = CreateColorPage(root2, "Spawn Devtools", Colors.SouthWest, SouthWestPref); _westPage = CreateColorPage(root2, "SpawnGun Menu", Colors.West, WestPref); _northWestPage = CreateColorPage(root2, "Avatar Select", Colors.NorthWest, NorthWestPref); _directionalPages = (Page[])(object)new Page[8] { _northPage, _northEastPage, _eastPage, _southEastPage, _southPage, _southWestPage, _westPage, _northWestPage }; ModModuleManager.InitializeAll(MelonPrefCategory, val); CreateOverrideOnRoot(val); CreateDefaultAllOnRoot(val); } private static string BuildRainbowName() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) return $"Colorful"; } private static void RefreshRootName(Page root) { root.Name = BuildRainbowName(); } private static Page CreateColorPage(Page root, string name, Color color, MelonPreferences_Entry pref) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Page page = root.CreatePage(name, color, 0, true); ColorSliders.Create(page, color, delegate(Color updatedColor) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) SetColor(page, pref, updatedColor); RefreshRootName(root); }); return page; } private static void SetColor(Page page, MelonPreferences_Entry pref, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) page.Color = color; pref.Value = color; MelonPrefCategory.SaveToFile(true); Main.MoggingTime(); } private static void SetAllColors(Color color) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) SetColor(_menuPage, MenuPref, color); SetColor(_northPage, NorthPref, color); SetColor(_northEastPage, NorthEastPref, color); SetColor(_eastPage, EastPref, color); SetColor(_southEastPage, SouthEastPref, color); SetColor(_southPage, SouthPref, color); SetColor(_southWestPage, SouthWestPref, color); SetColor(_westPage, WestPref, color); SetColor(_northWestPage, NorthWestPref, color); SetColor(_middlePage, MiddlePref, color); ModModuleManager.SetAllColors(color); } private static void ResetColor(Page page, MelonPreferences_Entry pref, Color defaultColor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) page.Color = defaultColor; pref.Value = defaultColor; MelonPrefCategory.SaveToFile(true); Main.MoggingTime(); } private static void CreateOverrideOnRoot(Page root) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) ColorSliders.CreateWithConfirm(root, Color.white, delegate(Color updatedColor) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SetAllColors(updatedColor); RefreshRootName(root); }); } private static void CreateDefaultAllOnRoot(Page root) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) root.CreateFunction("Default All", Color.black, (Action)delegate { Menu.DisplayDialog("Reset All Colors", "Are you sure? This will set all colors to default", (Texture2D)null, (Action)delegate { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) SetColor(_menuPage, MenuPref, Colors.MenuDefault); ResetColor(_northPage, NorthPref, Colors.NorthDefault); ResetColor(_northEastPage, NorthEastPref, Colors.NorthEastDefault); ResetColor(_eastPage, EastPref, Colors.EastDefault); ResetColor(_southEastPage, SouthEastPref, Colors.SouthEastDefault); ResetColor(_southPage, SouthPref, Colors.SouthDefault); ResetColor(_southWestPage, SouthWestPref, Colors.SouthWestDefault); ResetColor(_westPage, WestPref, Colors.WestDefault); ResetColor(_northWestPage, NorthWestPref, Colors.NorthWestDefault); ResetColor(_middlePage, MiddlePref, Colors.MiddleDefault); ModModuleManager.ResetAll(); RefreshRootName(root); }, (Action)null); }); } public static void UpdateColorPageNames(string[] names) { if (_directionalPages == null || names == null || names.Length < 8) { return; } for (int i = 0; i < 8; i++) { if (!string.IsNullOrEmpty(names[i])) { _directionalPages[i].Name = names[i]; } } } public static void MelonPreferencesCreator() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) MelonPrefCategory = MelonPreferences.CreateCategory("Colorful"); MelonPrefEnabled = MelonPrefCategory.CreateEntry("IsEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); IsEnabled = MelonPrefEnabled.Value; NorthPref = MelonPrefCategory.CreateEntry("Eject Color", Colors.NorthDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); NorthEastPref = MelonPrefCategory.CreateEntry("Level Select Color", Colors.NorthEastDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); EastPref = MelonPrefCategory.CreateEntry("Preferences Color", Colors.EastDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SouthEastPref = MelonPrefCategory.CreateEntry("Quick Mute Color", Colors.SouthEastDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SouthPref = MelonPrefCategory.CreateEntry("Inventory Color", Colors.SouthDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SouthWestPref = MelonPrefCategory.CreateEntry("Spawn Devtools Color", Colors.SouthWestDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); WestPref = MelonPrefCategory.CreateEntry("SpawnGun Menu Color", Colors.WestDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); NorthWestPref = MelonPrefCategory.CreateEntry("Avatar Select Color", Colors.NorthWestDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MiddlePref = MelonPrefCategory.CreateEntry("Radial Cancel Color", Colors.MiddleDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); MenuPref = MelonPrefCategory.CreateEntry("Menu Color", Colors.MenuDefault, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); foreach (ModModule module in ModModuleManager.Modules) { module.SetupPref(MelonPrefCategory); } } public static void OnSetEnabled(bool value) { IsEnabled = value; MelonPrefEnabled.Value = value; MelonPrefCategory.SaveToFile(true); Main.MoggingTime(); } } public class AvatarSelectUI { public static void Avatar(Transform parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) Color color = (PreferencesCreator.IsEnabled ? Colors.NorthWest : Color.white); for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (!(((Object)child).name == "img_outline") && !(((Object)child).name == "img_bg") && !(((Object)child).name == "image_bgFade")) { PaintChild(child, color); Avatar(child); } } } public static void Bodymall(Transform parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) Color val = (PreferencesCreator.IsEnabled ? Colors.NorthWest : Color.white); Color black = Color.black; for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (((Object)child).name == "img_outline" || ((Object)child).name == "img_bg") { continue; } if (((Object)child).name == "Chart") { Renderer component = ((Component)child).GetComponent(); if ((Object)(object)component != (Object)null) { Material material = component.material; if ((Object)(object)material != (Object)null) { material.color = val; } } Bodymall(child); } else { bool flag = ((Object)child).name == "text_avatars_val"; PaintChild(child, flag ? black : val); Bodymall(child); } } } private static void PaintChild(Transform t, Color color) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI component = ((Component)t).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; return; } TextMeshPro component2 = ((Component)t).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = color; return; } Image component3 = ((Component)t).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Graphic)component3).color = color; } } } public static class BoneMenuUI { public static void Paint() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) GUIMenu val = FindGuiMenu(); if (!((Object)(object)val == (Object)null)) { Color targetColor = (PreferencesCreator.IsEnabled ? Colors.Menu : Color.white); PaintRecursive(((Component)val).transform, targetColor); } } private static GUIMenu FindGuiMenu() { GUIMenu val = Object.FindObjectOfType(); if ((Object)(object)val != (Object)null) { return val; } GameObject val2 = GameObject.Find("[BoneMenu] - Canvas(Clone)"); if ((Object)(object)val2 != (Object)null) { return val2.GetComponent(); } return null; } private static void PaintRecursive(Transform parent, Color targetColor) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); TryPaint(child, targetColor); PaintRecursive(child, targetColor); } } private static void TryPaint(Transform t, Color targetColor) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI component = ((Component)t).GetComponent(); if ((Object)(object)component != (Object)null) { if (IsWhite(((Graphic)component).color)) { ((Graphic)component).color = targetColor; } return; } TextMeshPro component2 = ((Component)t).GetComponent(); if ((Object)(object)component2 != (Object)null) { if (IsWhite(((Graphic)component2).color)) { ((Graphic)component2).color = targetColor; } return; } Text component3 = ((Component)t).GetComponent(); if ((Object)(object)component3 != (Object)null) { if (IsWhite(((Graphic)component3).color)) { ((Graphic)component3).color = targetColor; } return; } Image component4 = ((Component)t).GetComponent(); if ((Object)(object)component4 != (Object)null) { ((Graphic)component4).color = targetColor; return; } RawImage component5 = ((Component)t).GetComponent(); if ((Object)(object)component5 != (Object)null) { ((Graphic)component5).color = targetColor; } } private static bool IsWhite(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (c.r > 0.9f && c.g > 0.9f) { return c.b > 0.9f; } return false; } } public static class FusionUI { public static void Paint(Transform parent, Color color) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); TryPaint(child, color); Paint(child, color); } } private static void TryPaint(Transform t, Color targetColor) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI component = ((Component)t).GetComponent(); if ((Object)(object)component != (Object)null) { if (!IsNameTagPreview(t) || IsWhite(((Graphic)component).color)) { ((Graphic)component).color = targetColor; } return; } TextMeshPro component2 = ((Component)t).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = targetColor; return; } Text component3 = ((Component)t).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Graphic)component3).color = targetColor; return; } Image component4 = ((Component)t).GetComponent(); if ((Object)(object)component4 != (Object)null && IsWhite(((Graphic)component4).color)) { ((Graphic)component4).color = targetColor; return; } RawImage component5 = ((Component)t).GetComponent(); if ((Object)(object)component5 != (Object)null && IsWhite(((Graphic)component5).color) && !IsProfilePicture(component5)) { ((Graphic)component5).color = targetColor; } } private static bool IsWhite(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (c.r > 0.9f && c.g > 0.9f) { return c.b > 0.9f; } return false; } private static bool IsNameTagPreview(Transform t) { Transform val = t; while ((Object)(object)val != (Object)null) { if (((Object)val).name == "NameTag Color") { return true; } val = val.parent; } return false; } private static bool IsProfilePicture(RawImage raw) { Transform parent = ((Component)raw).transform.parent; while ((Object)(object)parent != (Object)null) { if ((Object)(object)((Component)parent).GetComponent() != (Object)null) { return (Object)(object)raw.texture != (Object)null; } parent = parent.parent; } return false; } } public static class InfoBoardUI { public static void Paint(Transform parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) Color color = (PreferencesCreator.IsEnabled ? Colors.Menu : Color.white); TransformPainter.Paint(parent, color); } public static void PaintLeaderboard(Transform parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Color val = (PreferencesCreator.IsEnabled ? Colors.Menu : Color.white); Color color = Color.Lerp(val, Color.black, 0.6f); for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); Image component = ((Component)child).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; } else { TextMeshProUGUI component2 = ((Component)child).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = val; } else { RawImage component3 = ((Component)child).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Graphic)component3).color = val; } } } PaintLeaderboard(child); } } } public static class InventorySlotsUI { public static void Paint(Transform parent, Color color) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); PageElementView component = ((Component)child).GetComponent(); if ((Object)(object)component != (Object)null) { component.color2 = color; } else { MeshRenderer component2 = ((Component)child).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Renderer)component2).material.color = color; } } Paint(child, color); } } } public class LevelSelectUI { public static void LevelSelect(Transform parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Color color = (PreferencesCreator.IsEnabled ? Colors.NorthEast : Color.white); for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (((Object)child).name == "image_bgFade" || ((Object)child).name == "Background") { continue; } Image component = ((Component)child).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; } else { TextMeshProUGUI component2 = ((Component)child).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = color; } } LevelSelect(child); } } } public class MenuUI { private static readonly HashSet NoRecurse = new HashSet { "group_Options", "group_CAMPAIGNS", "group_BETA" }; public static void MainMenu(Transform parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) Color color = (PreferencesCreator.IsEnabled ? Colors.Menu : Color.white); for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (((Object)child).name == "Background" || ((Object)child).name.Contains("img_outline") || ((Object)child).name.Contains("img_bg")) { continue; } Image component = ((Component)child).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; } else { TextMeshProUGUI component2 = ((Component)child).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = color; } else { TextMeshPro component3 = ((Component)child).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Graphic)component3).color = color; } else { RawImage component4 = ((Component)child).GetComponent(); if ((Object)(object)component4 != (Object)null) { ((Graphic)component4).color = color; } } } } if (!NoRecurse.Contains(((Object)child).name)) { MainMenu(child); } } } } public class FusionModule : ModModule { private bool _patched; private static FusionModule _instance; public override string DisplayName => "Fusion Menu"; public override string AssemblyName => "LabFusion"; public override string PrefEntryName => "Fusion Menu Color"; public override Color DefaultColor => Color.white; public FusionModule() { _instance = this; } public override void Apply() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("canvas_FusionMenu [0]"); if ((Object)(object)val != (Object)null) { FusionUI.Paint(val.transform, base.Color); } PaintFusionNavButton(); ModModuleManager.SetDividerLineColor(base.Color); } public override void ApplyPatches() { if (_patched) { return; } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { Type[] exportedTypes = assembly.GetExportedTypes(); foreach (Type type in exportedTypes) { if (type.Name.Contains("MenuPage")) { TryPatch(type); } } } catch { } } foreach (MelonMod registeredMelon in MelonTypeBase.RegisteredMelons) { try { MelonAssembly melonAssembly = ((MelonBase)registeredMelon).MelonAssembly; Assembly assembly2 = ((melonAssembly != null) ? melonAssembly.Assembly : null); if (assembly2 == null) { continue; } Type[] exportedTypes = assembly2.GetExportedTypes(); foreach (Type type2 in exportedTypes) { if (type2.Name.Contains("MenuPage")) { TryPatch(type2); } } } catch { } } } private void TryPatch(Type type) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo method = type.GetMethod("OnEnable", bindingAttr); if (method != null) { Harmony val = new Harmony("Colorful.Fusion." + type.FullName + ".OnEnable"); HarmonyMethod val2 = new HarmonyMethod(typeof(FusionModule), "OnMenuEnabled", (Type[])null); val.Patch((MethodBase)method, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _patched = true; MelonLogger.Msg("Patched " + type.FullName + ".OnEnable"); } MethodInfo method2 = type.GetMethod("OnDisable", bindingAttr); if (method2 != null) { Harmony val3 = new Harmony("Colorful.Fusion." + type.FullName + ".OnDisable"); HarmonyMethod val4 = new HarmonyMethod(typeof(FusionModule), "OnMenuDisabled", (Type[])null); val3.Patch((MethodBase)method2, (HarmonyMethod)null, val4, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _patched = true; MelonLogger.Msg("Patched " + type.FullName + ".OnDisable"); } } private static void OnMenuEnabled(MonoBehaviour __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (!PreferencesCreator.IsEnabled || (Object)(object)__instance == (Object)null || _instance == null) { return; } Transform val = ((Component)__instance).transform; while ((Object)(object)val != (Object)null) { if (((Object)val).name.Contains("canvas_FusionMenu")) { FusionUI.Paint(((Component)__instance).transform, _instance.Color); _instance.PaintFusionNavButton(); ModModuleManager.SetDividerLineColor(_instance.Color); break; } val = val.parent; } } private static void OnMenuDisabled(MonoBehaviour __instance) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!PreferencesCreator.IsEnabled || (Object)(object)__instance == (Object)null || _instance == null) { return; } Transform val = ((Component)__instance).transform; while ((Object)(object)val != (Object)null) { if (((Object)val).name.Contains("canvas_FusionMenu")) { ModModuleManager.SetDividerLineColor(Colors.East); break; } val = val.parent; } } public override void OnMoggingTime(GameObject obj) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) LoadFromPrefs(); if (((Object)obj).name.Contains("canvas_FusionMenu")) { FusionUI.Paint(obj.transform, PreferencesCreator.IsEnabled ? base.Color : Color.white); } if (((Object)obj).name.Contains("button_Fusion")) { PaintFusionNavButton(); } if (((Object)obj).name == "image----------------") { Image component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = base.Color; } } } private void PaintFusionNavButton() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("button_Fusion"); if ((Object)(object)val == (Object)null) { return; } Transform val2 = val.transform.Find("image_backline"); if ((Object)(object)val2 != (Object)null) { Image component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = base.Color; } } } } public abstract class ModModule { public abstract string DisplayName { get; } public abstract string AssemblyName { get; } public abstract string PrefEntryName { get; } public abstract Color DefaultColor { get; } public bool IsLoaded { get; private set; } public Color Color { get; set; } public MelonPreferences_Entry ColorPref { get; private set; } public Page BoneMenuPage { get; set; } public bool Detect() { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { if (assemblies[i].GetName().Name == AssemblyName) { IsLoaded = true; return true; } } return false; } public void SetupPref(MelonPreferences_Category category) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (IsLoaded) { ColorPref = category.CreateEntry(PrefEntryName, DefaultColor, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); Color = ColorPref.Value; } } public void LoadFromPrefs() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (IsLoaded) { Color = ((ColorPref != null) ? ColorPref.Value : DefaultColor); } } public Page CreateBoneMenuPage(Page parent) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!IsLoaded) { return null; } BoneMenuPage = parent.CreatePage(DisplayName, Color, 0, true); ColorSliders.Create(BoneMenuPage, Color, delegate(Color updatedColor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) SetColor(updatedColor); }); return BoneMenuPage; } public virtual void SetColor(Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Color = color; if (BoneMenuPage != null) { BoneMenuPage.Color = color; } if (ColorPref != null) { ColorPref.Value = color; PreferencesCreator.MelonPrefCategory.SaveToFile(true); } Apply(); } public virtual void ResetToDefault() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetColor(DefaultColor); } public virtual void Apply() { } public virtual void ApplyPatches() { } public virtual void OnSceneAwake() { } public virtual void OnMoggingTime(GameObject obj) { } } public static class ModModuleManager { public static List Modules { get; } = new List(); public static void Register(ModModule module) { Modules.Add(module); } public static void InitializeAll(MelonPreferences_Category category, Page root) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Page parent = root.CreatePage("Mods", Color.white, 0, true); foreach (ModModule module in Modules) { if (module.Detect()) { module.SetupPref(category); module.LoadFromPrefs(); module.CreateBoneMenuPage(parent); module.ApplyPatches(); } } } public static void OnSceneAwakeAll() { foreach (ModModule module in Modules) { if (module.IsLoaded) { module.OnSceneAwake(); } } } public static void OnMoggingTimeAll(GameObject obj) { foreach (ModModule module in Modules) { if (module.IsLoaded) { module.OnMoggingTime(obj); } } } public static void SetAllColors(Color color) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) foreach (ModModule module in Modules) { if (module.IsLoaded) { module.SetColor(color); } } } public static void ResetAll() { foreach (ModModule module in Modules) { if (module.IsLoaded) { module.ResetToDefault(); } } } public static T Get() where T : ModModule { foreach (ModModule module in Modules) { if (module is T result) { return result; } } return null; } public static void SetDividerLineColor(Color color) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject item in Object.FindObjectsOfType(true)) { if (((Object)item).name != "image----------------") { continue; } Transform parent = item.transform.parent; if ((Object)(object)parent != (Object)null && ((Object)parent).name == "panel_Preferences") { Image component = item.GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; } break; } } } } public class PreferencesUI { public static void Preferences(Transform parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) Color color = (PreferencesCreator.IsEnabled ? Colors.East : Color.white); for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (ContainsName(new string[5] { "Viewport_Spectator", "Viewport_Graphics", "Viewport", "Name", "image_bgFade" }, ((Object)child).name) || ((Object)child).name.Contains("canvas_FusionMenu")) { continue; } Image component = ((Component)child).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; } else { TextMeshProUGUI component2 = ((Component)child).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = color; } else { RawImage component3 = ((Component)child).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Graphic)component3).color = color; } else { TextMeshPro component4 = ((Component)child).GetComponent(); if ((Object)(object)component4 != (Object)null) { ((Graphic)component4).color = color; } else { Text component5 = ((Component)child).GetComponent(); if ((Object)(object)component5 != (Object)null) { ((Graphic)component5).color = color; } } } } } Preferences(child); } } public static void Extra(Transform parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) Color color = (PreferencesCreator.IsEnabled ? Colors.East : Color.white); for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); Image component = ((Component)child).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; } else { TextMeshProUGUI component2 = ((Component)child).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = color; } } Extra(child); } } private static bool ContainsName(string[] names, string name) { for (int i = 0; i < names.Length; i++) { if (names[i] == name) { return true; } } return false; } } internal static class RadialLabelReader { private static readonly int[] TextButtonIndices = new int[8] { 0, 3, 6, 9, 12, 15, 18, 21 }; private static readonly string[] DefaultNames = new string[8] { "Eject", "Level Select", "Preferences", "Quick Mute", "Inventory", "Spawn Devtools", "SpawnGun Menu", "Avatar Select" }; public static string[] GetButtonNames() { string[] array = new string[8]; GameObject val = GameObject.Find("CANVAS_RADIALUI"); if ((Object)(object)val != (Object)null) { Transform transform = val.transform; for (int i = 0; i < 8; i++) { int num = TextButtonIndices[i]; if (num < transform.childCount) { TextMeshProUGUI component = ((Component)transform.GetChild(num)).GetComponent(); if ((Object)(object)component != (Object)null && !string.IsNullOrEmpty(((TMP_Text)component).text)) { array[i] = ((TMP_Text)component).text; continue; } } array[i] = DefaultNames[i]; } } else { for (int j = 0; j < 8; j++) { array[j] = DefaultNames[j]; } } return array; } public static void StartPolling() { MelonCoroutines.Start(PollRadialText()); } private static IEnumerator PollRadialText() { yield return (object)new WaitForSeconds(1f); for (int attempt = 0; attempt < 30; attempt++) { GameObject val = GameObject.Find("CANVAS_RADIALUI"); if ((Object)(object)val != (Object)null) { Transform transform = val.transform; bool flag = false; string[] array = new string[8]; for (int i = 0; i < 8; i++) { int num = TextButtonIndices[i]; if (num < transform.childCount) { TextMeshProUGUI component = ((Component)transform.GetChild(num)).GetComponent(); if ((Object)(object)component != (Object)null && !string.IsNullOrEmpty(((TMP_Text)component).text)) { array[i] = ((TMP_Text)component).text; flag = true; } else { array[i] = DefaultNames[i]; } } else { array[i] = DefaultNames[i]; } } if (flag) { for (int j = 0; j < 8; j++) { if (string.IsNullOrEmpty(array[j]) || array[j].IndexOf("COOL", StringComparison.OrdinalIgnoreCase) >= 0 || array[j].IndexOf("cool", StringComparison.OrdinalIgnoreCase) >= 0) { array[j] = DefaultNames[j]; } } PreferencesCreator.UpdateColorPageNames(array); break; } } yield return (object)new WaitForSeconds(1f); } } } public class RadialMenuButtonsUI { private static PageItemView N; private static PageItemView NE; private static PageItemView E; private static PageItemView SE; private static PageItemView S; private static PageItemView SW; private static PageItemView W; private static PageItemView NW; private static PageElementView M; public static void RadialMenuButtons() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) SetupButton(ref N, "button_Region_N", Colors.North); SetupButton(ref NE, "button_Region_NE", Colors.NorthEast); SetupButton(ref E, "button_Region_E", Colors.East); SetupButton(ref SE, "button_Region_SE", Colors.SouthEast); SetupButton(ref S, "button_Region_S", Colors.South); SetupButton(ref SW, "button_Region_SW", Colors.SouthWest); SetupButton(ref W, "button_Region_W", Colors.West); SetupButton(ref NW, "button_Region_NW", Colors.NorthWest); SetupCancelButton(); } private static void SetupButton(ref PageItemView field, string objectName, Color activeColor) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)field == (Object)null) { foreach (GameObject item in Object.FindObjectsOfType(true)) { if (((Object)item).name == objectName) { field = item.GetComponent(); break; } } } if ((Object)(object)field != (Object)null) { field.color2 = (PreferencesCreator.IsEnabled ? activeColor : Color.white); } } private static void SetupCancelButton() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)M == (Object)null) { foreach (GameObject item in Object.FindObjectsOfType(true)) { if (((Object)item).name == "button_cancel") { M = item.GetComponent(); break; } } } if ((Object)(object)M != (Object)null) { if (PreferencesCreator.IsEnabled) { M.color2 = Colors.Middle; } else { M.color2 = new Color(1f, 0.2667f, 0.4824f, 0.749f); } } } } public class RadialMenuTextAndImageUI { public static void RadialMenuTextAndImage(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (((Object)child).name == "text_Information") { continue; } if (PreferencesCreator.IsEnabled) { Color? val = ColorForIndex(i); if (val.HasValue) { Paint(child, val.Value); } } else { Paint(child, Color.white); } RadialMenuTextAndImage(child); } } private static Color? ColorForIndex(int i) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) switch (i) { case 0: case 1: return Colors.North; case 3: case 4: return Colors.NorthEast; case 6: case 7: return Colors.East; case 9: case 10: return Colors.SouthEast; case 12: case 13: return Colors.South; case 15: case 16: return Colors.SouthWest; case 18: case 19: return Colors.West; case 21: case 22: return Colors.NorthWest; default: return null; } } private static void Paint(Transform t, Color color) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Image component = ((Component)t).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; return; } TextMeshProUGUI component2 = ((Component)t).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = color; } } } public class SpawnGunUI { public static void SpawnGun(Transform parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) Color color = (PreferencesCreator.IsEnabled ? Colors.West : Color.white); for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (((Object)child).name == "Background" || (((Object)child).name == "image_backline" && ((Object)((Component)child.parent).gameObject).name == "group_selectedInfo") || ((Object)child).name == "image_bgFade") { continue; } Image component = ((Component)child).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; } else { TextMeshProUGUI component2 = ((Component)child).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = color; } else { TextMeshPro component3 = ((Component)child).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Graphic)component3).color = color; } } } SpawnGun(child); } } } public static class TransformPainter { public static void Paint(Transform parent, Color color, HashSet skipList = null) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (skipList == null || !skipList.Contains(((Object)child).name)) { TryPaint(child, color); Paint(child, color, skipList); } } } private static void TryPaint(Transform t, Color color) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Image component = ((Component)t).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; return; } TextMeshProUGUI component2 = ((Component)t).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = color; return; } TextMeshPro component3 = ((Component)t).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Graphic)component3).color = color; return; } RawImage component4 = ((Component)t).GetComponent(); if ((Object)(object)component4 != (Object)null) { ((Graphic)component4).color = color; return; } Text component5 = ((Component)t).GetComponent(); if ((Object)(object)component5 != (Object)null) { ((Graphic)component5).color = color; } } } public static class Colors { public static Color North = new Color(0f, 1f, 1f, 1f); public static Color NorthEast = new Color(1f, 0.5f, 0f, 1f); public static Color East = new Color(1f, 1f, 0f, 1f); public static Color SouthEast = new Color(0f, 0f, 1f, 1f); public static Color South = new Color(1f, 0f, 1f, 1f); public static Color SouthWest = new Color(0.5f, 0f, 1f, 1f); public static Color West = new Color(1f, 0f, 0f, 1f); public static Color NorthWest = new Color(0f, 1f, 0f, 1f); public static Color Middle = new Color(1f, 0.2f, 0.2f, 0.7f); public static Color Menu = new Color(1f, 1f, 1f, 1f); public static readonly Color NorthDefault = new Color(0f, 1f, 1f, 1f); public static readonly Color NorthEastDefault = new Color(1f, 0.5f, 0f, 1f); public static readonly Color EastDefault = new Color(1f, 1f, 0f, 1f); public static readonly Color SouthEastDefault = new Color(0f, 0f, 1f, 1f); public static readonly Color SouthDefault = new Color(1f, 0f, 1f, 1f); public static readonly Color SouthWestDefault = new Color(0.5f, 0f, 1f, 1f); public static readonly Color WestDefault = new Color(1f, 0f, 0f, 1f); public static readonly Color NorthWestDefault = new Color(0f, 1f, 0f, 1f); public static readonly Color MiddleDefault = new Color(1f, 0.2f, 0.2f, 1f); public static readonly Color MenuDefault = new Color(1f, 1f, 1f, 1f); public static void LoadFromPrefs() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) North = FromPref(PreferencesCreator.NorthPref, NorthDefault); NorthEast = FromPref(PreferencesCreator.NorthEastPref, NorthEastDefault); East = FromPref(PreferencesCreator.EastPref, EastDefault); SouthEast = FromPref(PreferencesCreator.SouthEastPref, SouthEastDefault); South = FromPref(PreferencesCreator.SouthPref, SouthDefault); SouthWest = FromPref(PreferencesCreator.SouthWestPref, SouthWestDefault); West = FromPref(PreferencesCreator.WestPref, WestDefault); NorthWest = FromPref(PreferencesCreator.NorthWestPref, NorthWestDefault); Middle = FromPref(PreferencesCreator.MiddlePref, MiddleDefault); Menu = FromPref(PreferencesCreator.MenuPref, MenuDefault); } private static Color FromPref(MelonPreferences_Entry pref, Color fallback) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return pref?.Value ?? fallback; } } internal static class ColorSliders { public static void Create(Page page, Color currentColor, Action applyCallback) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) FunctionElement colorPreview = page.CreateFunction("Preview", currentColor, (Action)null); page.CreateFloat("Red", Color.red, currentColor.r, 0.1f, 0f, 1f, (Action)delegate(float r) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) currentColor.r = r; ((Element)colorPreview).ElementColor = currentColor; }); page.CreateFloat("Green", Color.green, currentColor.g, 0.1f, 0f, 1f, (Action)delegate(float g) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) currentColor.g = g; ((Element)colorPreview).ElementColor = currentColor; }); page.CreateFloat("Blue", Color.blue, currentColor.b, 0.1f, 0f, 1f, (Action)delegate(float b) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) currentColor.b = b; ((Element)colorPreview).ElementColor = currentColor; }); page.CreateFloat("Alpha", Color.gray, currentColor.a, 0.1f, 0f, 1f, (Action)delegate(float a) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) currentColor.a = a; ((Element)colorPreview).ElementColor = currentColor; }); page.CreateFunction("Apply", Color.white, (Action)delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) applyCallback(currentColor); Main.MoggingTime(); }); } public static void CreateWithConfirm(Page page, Color currentColor, Action applyCallback) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) FunctionElement colorPreview = page.CreateFunction("Preview", currentColor, (Action)null); page.CreateFloat("Red", Color.red, currentColor.r, 0.1f, 0f, 1f, (Action)delegate(float r) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) currentColor.r = r; ((Element)colorPreview).ElementColor = currentColor; }); page.CreateFloat("Green", Color.green, currentColor.g, 0.1f, 0f, 1f, (Action)delegate(float g) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) currentColor.g = g; ((Element)colorPreview).ElementColor = currentColor; }); page.CreateFloat("Blue", Color.blue, currentColor.b, 0.1f, 0f, 1f, (Action)delegate(float b) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) currentColor.b = b; ((Element)colorPreview).ElementColor = currentColor; }); page.CreateFloat("Alpha", Color.gray, currentColor.a, 0.1f, 0f, 1f, (Action)delegate(float a) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) currentColor.a = a; ((Element)colorPreview).ElementColor = currentColor; }); page.CreateFunction("Apply", Color.white, (Action)delegate { Menu.DisplayDialog("Override All Colors", "Are you sure? This will override all colors you've set", (Texture2D)null, (Action)delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) applyCallback(currentColor); }, (Action)null); }); } } public class Main : MelonMod { public void OnSceneAwake() { if (PreferencesCreator.IsEnabled) { MoggingTime(); } RadialMenuButtonsUI.RadialMenuButtons(); RadialLabelReader.StartPolling(); PanelPatches.ApplySearchThingPatches(); ModModuleManager.OnSceneAwakeAll(); } public override void OnInitializeMelon() { ModModuleManager.Register(new FusionModule()); Hooking.OnLevelLoaded += delegate { OnSceneAwake(); }; PreferencesCreator.MelonPreferencesCreator(); Colors.LoadFromPrefs(); PreferencesCreator.BonemenuCreator(); PanelPatches.Apply(); } public static void MoggingTime() { //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) Colors.LoadFromPrefs(); foreach (GameObject item in Object.FindObjectsOfType(true)) { if (((Object)item).name.Contains("group_levelSelect")) { LevelSelectUI.LevelSelect(item.transform); } else if (((Object)item).name.Contains("panel_Preferences")) { PreferencesUI.Preferences(item.transform); } else if (((Object)item).name.Contains("grid_Graphics")) { PreferencesUI.Extra(item.transform); } else if (((Object)item).name.Contains("group_toolMenu")) { SpawnGunUI.SpawnGun(item.transform); } else if (((Object)item).name.Contains("group_AvatarSelect")) { AvatarSelectUI.Avatar(item.transform); } else if (((Object)item).name.Contains("BodyMallController")) { AvatarSelectUI.Bodymall(item.transform); } else if (((Object)item).name.Contains("CANVAS_RADIALUI")) { RadialMenuTextAndImageUI.RadialMenuTextAndImage(item.transform); } else if (((Object)item).name.Contains("canvasMainMenu")) { MenuUI.MainMenu(item.transform); } else if (((Object)item).name.Contains("CANVAS_UX")) { Transform val = item.transform.Find("MENU"); if ((Object)(object)val != (Object)null) { MenuUI.MainMenu(val); } } else if (((Object)item).name.Contains("GashaponMachine")) { Transform val2 = item.transform.Find("UI"); if ((Object)(object)val2 != (Object)null) { TransformPainter.Paint(val2, PreferencesCreator.IsEnabled ? Colors.Menu : Color.white); } } else if (((Object)item).name.Contains("slot_target")) { InventorySlotsUI.Paint(item.transform, PreferencesCreator.IsEnabled ? Colors.South : Color.white); } else if (((Object)item).name == "CANVAS_INFOBOARD") { InfoBoardUI.Paint(item.transform); } else if (((Object)item).name == "HighscoreLeaderboard_UI_Group") { InfoBoardUI.PaintLeaderboard(item.transform); } else if (((Object)item).name == "SpawnableCanvas") { TransformPainter.Paint(item.transform, PreferencesCreator.IsEnabled ? Colors.West : Color.white); } else if (((Object)item).name.Contains("GameControl_Display")) { TransformPainter.Paint(item.transform, PreferencesCreator.IsEnabled ? Colors.Menu : Color.white); } else if (((Object)item).name.Contains("ui_Module")) { HashSet skipList = new HashSet { "popup_MOD WARNING", "popup_AVATARWARNING" }; TransformPainter.Paint(item.transform, PreferencesCreator.IsEnabled ? Colors.Menu : Color.white, skipList); } ModModuleManager.OnMoggingTimeAll(item); } BoneMenuUI.Paint(); RadialMenuButtonsUI.RadialMenuButtons(); } } internal static class PanelPatches { private static bool _searchThingPatched; public static void Apply() { TryPatch("OnEnable"); TryPatch("OnEnable"); } public static void ApplySearchThingPatches() { if (!_searchThingPatched) { _searchThingPatched = true; TryPatchByName("SearchThing.Extensions.SpawnablePanelExtension", "Show"); TryPatchByName("SearchThing.Extensions.SpawnablePanelExtension", "RenderAll"); } } private static void TryPatch(string methodName) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo method = typeof(T).GetMethod(methodName, bindingAttr); if (method == null) { MelonLogger.Warning("Could not find " + methodName + " on " + typeof(T).Name); return; } Harmony val = new Harmony("Colorful." + typeof(T).Name); HarmonyMethod val2 = new HarmonyMethod(typeof(PanelPatches), "OnPanelEnabled", (Type[])null); val.Patch((MethodBase)method, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MelonLogger.Msg("Patched " + typeof(T).Name + "." + methodName); } private static void TryPatchByName(string typeName, string methodName) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown Type type = FindTypeByName(typeName); if (type == null) { MelonLogger.Msg($"Type {typeName} not found, skipping {methodName} patch"); return; } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo method = type.GetMethod(methodName, bindingAttr); if (method == null) { MelonLogger.Warning("Could not find " + methodName + " on " + typeName); return; } Harmony val = new Harmony("Colorful." + typeName); HarmonyMethod val2 = new HarmonyMethod(typeof(PanelPatches), "OnSearchThingShow", (Type[])null); val.Patch((MethodBase)method, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MelonLogger.Msg("Patched " + typeName + "." + methodName); } private static Type FindTypeByName(string typeName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = assemblies[i].GetType(typeName); if (type != null) { return type; } } foreach (MelonMod registeredMelon in MelonTypeBase.RegisteredMelons) { MelonAssembly melonAssembly = ((MelonBase)registeredMelon).MelonAssembly; if (!(((melonAssembly != null) ? melonAssembly.Assembly : null) == null)) { Type type2 = ((MelonBase)registeredMelon).MelonAssembly.Assembly.GetType(typeName); if (type2 != null) { return type2; } } } return null; } private static void OnSearchThingShow(object __instance) { if (!PreferencesCreator.IsEnabled || __instance == null) { return; } PropertyInfo property = __instance.GetType().GetProperty("PanelView"); if (property == null) { return; } object? value = property.GetValue(__instance); Component val = (Component)((value is Component) ? value : null); if (!((Object)(object)val == (Object)null)) { Transform val2 = val.transform; while ((Object)(object)val2.parent != (Object)null) { val2 = val2.parent; } Transform val3 = val2.Find("group_toolMenu"); if ((Object)(object)val3 != (Object)null) { SpawnGunUI.SpawnGun(val3); } } } private static void OnPanelEnabled(MonoBehaviour __instance) { if (PreferencesCreator.IsEnabled && !((Object)(object)__instance == (Object)null)) { Transform transform = ((Component)__instance).transform; if (__instance is LevelsPanelView) { LevelSelectUI.LevelSelect(transform); } else if (__instance is AvatarsPanelView) { AvatarSelectUI.Avatar(transform); } } } }