Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of ClockMod v1.1.5
ClockMod-Il2Cpp.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using ClockMod; using Il2CppInterop.Runtime.InteropTypes.Arrays; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(global::ClockMod.ClockMod), "ClockMod_Il2Cpp", "1.1.5", "TfourJ", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("ClockMod-Il2Cpp")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f1e3646789fbf762f89b55ceb5d33e9ef6a3107f")] [assembly: AssemblyProduct("ClockMod-Il2Cpp")] [assembly: AssemblyTitle("ClockMod-Il2Cpp")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ClockMod { public class ClockMod : MelonMod { private Text timeText; private const int MaxAttempts = 10; private const float AttemptInterval = 1f; private string filepath = "UserData/ClockMod.cfg"; private bool guiSubscribed; private int currentPositionIndex; private MelonPreferences_Category myCategory; private MelonPreferences_Entry<int> clockPosition; private MelonPreferences_Entry<float> clockSizePreference; private MelonPreferences_Entry<bool> clockEnabledPreference; private MelonPreferences_Entry<int> clockStylePreference; private MelonPreferences_Entry<float> customXPosition; private MelonPreferences_Entry<float> customYPosition; private MelonPreferences_Entry<string> hotkeyModifierEntry; private MelonPreferences_Entry<string> hotkeyKeyEntry; private string hotkeyModifier = "Left Shift"; private string hotkeyKey = "F12"; private float keyCooldownTime = 0.5f; private float lastKeyPressTime; private float clockSize; private bool isClockEnabled = true; private int clockStyle; private readonly Vector2[] positionOptions = (Vector2[])(object)new Vector2[5] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 0.5f) }; public int CurrentPositionIndex => currentPositionIndex; public float ClockSize => clockSize; public bool IsClockEnabled => isClockEnabled; public int ClockStyle => clockStyle; public float CustomXPosition => customXPosition.Value; public float CustomYPosition => customYPosition.Value; public string HotkeyModifier => hotkeyModifier; public string HotkeyKey => hotkeyKey; public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("ClockMod Initialized."); myCategory = MelonPreferences.CreateCategory("ClockMod_Settings"); myCategory.SetFilePath(filepath); clockPosition = myCategory.CreateEntry<int>("Clock_Position", 1, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); clockSizePreference = myCategory.CreateEntry<float>("Clock_Size", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); clockEnabledPreference = myCategory.CreateEntry<bool>("Clock_Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); clockStylePreference = myCategory.CreateEntry<int>("Clock_Style", 0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); customXPosition = myCategory.CreateEntry<float>("Custom_X_Position", 0.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); customYPosition = myCategory.CreateEntry<float>("Custom_Y_Position", 0.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); hotkeyModifierEntry = myCategory.CreateEntry<string>("HotkeyModifier", "Left Shift", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); hotkeyKeyEntry = myCategory.CreateEntry<string>("HotkeyKey", "F12", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); if (File.Exists(filepath)) { myCategory.LoadFromFile(true); } else { ((MelonBase)this).LoggerInstance.Msg("Config file does not exist. Creating default configuration."); myCategory.SaveToFile(true); } LoadSettings(); Menu.Initialize(this); myCategory.SaveToFile(true); } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { if (sceneName == "Main") { ((MelonBase)this).LoggerInstance.Msg("Scene " + sceneName + " loaded. Starting to find clock."); MelonCoroutines.Start(StartClockFind()); } } public override void OnSceneWasUnloaded(int buildIndex, string sceneName) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (sceneName == "Main") { ((MelonBase)this).LoggerInstance.Msg("Main scene was unloaded. Stopping clock display."); if (guiSubscribed) { ((MelonEventBase<LemonAction>)(object)MelonEvents.OnGUI).Unsubscribe(new LemonAction(DrawClock)); guiSubscribed = false; } timeText = null; } } private IEnumerator StartClockFind() { yield return (object)new WaitForSeconds(2f); MelonCoroutines.Start(FindClockComponent()); } private IEnumerator FindClockComponent() { int attempts = 0; while (attempts < 10 && (Object)(object)timeText == (Object)null) { attempts++; GameObject val = GameObject.Find("Player_Local"); if ((Object)(object)val == (Object)null) { ((MelonBase)this).LoggerInstance.Warning($"Attempt {attempts}: Player_Local object not found. Retrying in {1f} seconds..."); yield return (object)new WaitForSeconds(1f); continue; } Transform parent = val.transform.parent; if ((Object)(object)parent == (Object)null) { ((MelonBase)this).LoggerInstance.Warning($"Attempt {attempts}: Parent of Player_Local not found. Retrying in {1f} seconds..."); yield return (object)new WaitForSeconds(1f); continue; } ((MelonBase)this).LoggerInstance.Msg("Parent of Player_Local found: " + ((Object)parent).name); Transform val2 = val.transform.Find("CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/HomeScreen/InfoBar"); if ((Object)(object)val2 != (Object)null) { Transform obj = val2.Find("Time"); GameObject val3 = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val3 != (Object)null) { timeText = val3.GetComponent<Text>(); if ((Object)(object)timeText != (Object)null) { ((MelonBase)this).LoggerInstance.Msg("Clock component found."); if (!guiSubscribed) { ((MelonEventBase<LemonAction>)(object)MelonEvents.OnGUI).Subscribe(new LemonAction(DrawClock), 100, false); guiSubscribed = true; } yield break; } } } ((MelonBase)this).LoggerInstance.Warning($"Attempt {attempts}: Clock not found. Retrying in {1f} seconds..."); yield return (object)new WaitForSeconds(1f); } if ((Object)(object)timeText == (Object)null) { ((MelonBase)this).LoggerInstance.Error("Max attempts reached. Failed to find the Clock component."); } } private void DrawClock() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_003b: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) HandleKeyInput(); if ((Object)(object)timeText == (Object)null || !isClockEnabled) { return; } GUIStyle val = new GUIStyle(GUI.skin.box) { padding = new RectOffset(8, 8, 4, 4), alignment = (TextAnchor)4 }; float num = 1f + clockSize / 10f; string text = timeText.text; if (clockStyle == 1) { string[] array = text.Split(' '); if (array.Length >= 3) { int value = Mathf.RoundToInt(14f * num); text = $"{array[0]} {array[1]}\n<size={value}>{array[2]}</size>"; } } Vector2 val2 = val.CalcSize(new GUIContent(text)); GUIStyle val3 = new GUIStyle(val); val3.fontSize = Mathf.RoundToInt(18f * num); val2 = val3.CalcSize(new GUIContent(text)); val2.x += 16f * num; val2.y += 8f * num; float num2 = 10f; float num3 = 0f; float num4 = 0f; if (currentPositionIndex == 4) { num3 = (float)Screen.width * customXPosition.Value - val2.x / 2f; num4 = (float)Screen.height * customYPosition.Value - val2.y / 2f; } else { switch (currentPositionIndex) { case 0: num3 = num2; num4 = num2; break; case 1: num3 = (float)Screen.width - val2.x - num2; num4 = num2; break; case 2: num3 = num2; num4 = (float)Screen.height - val2.y - num2; break; case 3: num3 = (float)Screen.width - val2.x - num2; num4 = (float)Screen.height - val2.y - num2; break; } } GUI.Box(new Rect(num3, num4, val2.x, val2.y), text, val3); } private void HandleKeyInput() { if (Time.time - lastKeyPressTime >= keyCooldownTime && Menu.HandleKeyInput()) { lastKeyPressTime = Time.time; } } public void SetClockPosition(int positionIndex) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (positionIndex >= 0 && positionIndex < positionOptions.Length) { currentPositionIndex = positionIndex; ((MelonBase)this).LoggerInstance.Msg($"Clock position set to {positionOptions[currentPositionIndex]}"); } } public void SetClockSize(float size) { clockSize = Mathf.Clamp(size, -10f, 10f); ((MelonBase)this).LoggerInstance.Msg($"Clock size set to {clockSize}"); } public void SetClockEnabled(bool enabled) { isClockEnabled = enabled; ((MelonBase)this).LoggerInstance.Msg("Clock display " + (enabled ? "enabled" : "disabled")); } public void SetClockStyle(int style) { clockStyle = style; ((MelonBase)this).LoggerInstance.Msg("Clock style set to " + ((style == 0) ? "Classic" : "Modern")); } public void SetCustomPosition(float x, float y) { customXPosition.Value = Mathf.Clamp01(x); customYPosition.Value = Mathf.Clamp01(y); ((MelonBase)this).LoggerInstance.Msg($"Custom position set to ({customXPosition.Value}, {customYPosition.Value})"); } public void SaveSettings() { clockPosition.Value = currentPositionIndex; clockSizePreference.Value = clockSize; clockEnabledPreference.Value = isClockEnabled; clockStylePreference.Value = clockStyle; myCategory.SaveToFile(true); ((MelonBase)this).LoggerInstance.Msg("Settings saved to file"); } private void LoadSettings() { currentPositionIndex = clockPosition.Value; clockSize = clockSizePreference.Value; isClockEnabled = clockEnabledPreference.Value; clockStyle = clockStylePreference.Value; hotkeyModifier = hotkeyModifierEntry.Value; hotkeyKey = hotkeyKeyEntry.Value; ((MelonBase)this).LoggerInstance.Msg($"Loaded settings - Position: {currentPositionIndex}, Size: {clockSize}, Enabled: {isClockEnabled}, Style: {clockStyle}, Modifier: {hotkeyModifier}, Key: {hotkeyKey}"); } } public static class Menu { [CompilerGenerated] private static class <>O { public static LemonAction <0>__OnGUI; public static Action<int> <1>__DrawWindow; } private static int selectedPosition = 1; private static float sliderValue = 0f; private static bool isClockEnabled = true; private static bool settingsChanged = false; private static ClockMod clockMod; private static bool isMenuOpen = false; private static Rect windowRect = new Rect(100f, 100f, 320f, 400f); private static bool isResizing = false; private static Vector2 resizeStartPos; private static Rect originalRect; private static readonly string[] positionNames = new string[5] { "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right", "Custom" }; private static int selectedStyle = 0; private static float customX = 0.5f; private static float customY = 0.5f; private static readonly string[] styleNames = new string[2] { "Classic", "Modern" }; private static readonly Color backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1f); private static readonly Color elementBackgroundColor = new Color(0.3f, 0.3f, 0.3f); public static void Initialize(ClockMod mod) { //IL_005d: 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_0068: Expected O, but got Unknown clockMod = mod; selectedPosition = mod.CurrentPositionIndex; sliderValue = mod.ClockSize; isClockEnabled = mod.IsClockEnabled; selectedStyle = mod.ClockStyle; customX = mod.CustomXPosition; customY = mod.CustomYPosition; MelonEvent onGUI = MelonEvents.OnGUI; object obj = <>O.<0>__OnGUI; if (obj == null) { LemonAction val = OnGUI; <>O.<0>__OnGUI = val; obj = (object)val; } ((MelonEventBase<LemonAction>)(object)onGUI).Subscribe((LemonAction)obj, 200, false); MelonLogger.Msg("Clock Mod initialized"); } public static bool HandleKeyInput() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0089: Unknown result type (might be due to invalid IL or missing references) if (clockMod != null) { KeyCode val; KeyCode val2; try { val = (KeyCode)Enum.Parse(typeof(KeyCode), clockMod.HotkeyModifier.Replace(" ", "")); val2 = (KeyCode)Enum.Parse(typeof(KeyCode), clockMod.HotkeyKey.Replace(" ", "")); } catch { MelonLogger.Msg("Hotkey parsing failed, using default hotkey LeftShift + F12."); val = (KeyCode)304; val2 = (KeyCode)293; } if (Input.GetKeyDown(val2) && Input.GetKey(val)) { isMenuOpen = !isMenuOpen; return true; } } if (isMenuOpen && Input.GetKeyDown((KeyCode)27)) { isMenuOpen = false; return true; } return false; } private static void OnGUI() { //IL_0008: 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) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown if (isMenuOpen) { GUI.backgroundColor = backgroundColor; GUI.contentColor = Color.white; GUIStyle val = new GUIStyle(GUI.skin.window); val.normal.background = MakeSolidTexture(2, 2, backgroundColor); val.hover.background = val.normal.background; val.active.background = val.normal.background; val.focused.background = val.normal.background; val.onNormal.background = val.normal.background; val.onHover.background = val.normal.background; val.onActive.background = val.normal.background; val.onFocused.background = val.normal.background; val.border = new RectOffset(2, 2, 2, 2); val.padding = new RectOffset(10, 10, 10, 10); val.normal.textColor = Color.white; val.hover.textColor = Color.white; val.active.textColor = Color.white; val.focused.textColor = Color.white; val.onNormal.textColor = Color.white; val.onHover.textColor = Color.white; val.onActive.textColor = Color.white; val.onFocused.textColor = Color.white; val.alignment = (TextAnchor)4; windowRect = GUI.Window(12345, windowRect, WindowFunction.op_Implicit((Action<int>)DrawWindow), "", val); Rect val2 = new Rect(((Rect)(ref windowRect)).width + ((Rect)(ref windowRect)).x - 20f, ((Rect)(ref windowRect)).height + ((Rect)(ref windowRect)).y - 20f, 20f, 20f); GUI.Box(val2, "↘", new GUIStyle { alignment = (TextAnchor)4 }); HandleResizing(val2); if (settingsChanged) { ApplySettings(); settingsChanged = false; } } } private static void HandleResizing(Rect resizeHandleRect) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0036: 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) Event current = Event.current; if ((int)current.type == 0 && current.button == 0 && ((Rect)(ref resizeHandleRect)).Contains(current.mousePosition)) { isResizing = true; resizeStartPos = current.mousePosition; originalRect = windowRect; current.Use(); } if (isResizing && (int)current.type == 3) { float width = Mathf.Max(320f, ((Rect)(ref originalRect)).width + (current.mousePosition.x - resizeStartPos.x)); float height = Mathf.Max(400f, ((Rect)(ref originalRect)).height + (current.mousePosition.y - resizeStartPos.y)); ((Rect)(ref windowRect)).width = width; ((Rect)(ref windowRect)).height = height; current.Use(); } if (isResizing && (int)current.type == 1) { isResizing = false; current.Use(); } } private static Texture2D MakeSolidTexture(int width, int height, Color color) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = color; } Texture2D val = new Texture2D(width, height); val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); return val; } private static void DrawWindow(int id) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Expected O, but got Unknown //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Expected O, but got Unknown //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Expected O, but got Unknown //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(10f); GUIStyle val = new GUIStyle(GUI.skin.label); val.normal.textColor = Color.white; val.fontSize = 14; GUIStyle val2 = new GUIStyle(val); val2.alignment = (TextAnchor)4; val2.fontSize = 16; val2.normal.textColor = Color.white; GUILayout.Label("Clock Mod Settings", val2, (Il2CppReferenceArray<GUILayoutOption>)null); GUILayout.Label("Clock Style:", val, (Il2CppReferenceArray<GUILayoutOption>)null); int num = GUILayout.SelectionGrid(selectedStyle, Il2CppStringArray.op_Implicit(styleNames), 2, (Il2CppReferenceArray<GUILayoutOption>)null); if (num != selectedStyle) { selectedStyle = num; settingsChanged = true; } GUILayout.Space(15f); GUILayout.Label("Position:", val, (Il2CppReferenceArray<GUILayoutOption>)null); int num2 = GUILayout.SelectionGrid(selectedPosition, Il2CppStringArray.op_Implicit(positionNames), 2, (Il2CppReferenceArray<GUILayoutOption>)null); if (num2 != selectedPosition) { selectedPosition = num2; settingsChanged = true; if (selectedPosition == 4) { ((Rect)(ref windowRect)).height = 500f; } else { ((Rect)(ref windowRect)).height = 400f; } } if (selectedPosition == 4) { GUILayout.Space(10f); GUILayout.Label("Custom Position:", val, (Il2CppReferenceArray<GUILayoutOption>)null); GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null); GUILayout.Label("X:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f) }); float num3 = GUILayout.HorizontalSlider(customX, 0f, 1f, (Il2CppReferenceArray<GUILayoutOption>)null); GUILayout.Label(customX.ToString("F2"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null); GUILayout.Label("Y:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f) }); float num4 = GUILayout.HorizontalSlider(customY, 0f, 1f, (Il2CppReferenceArray<GUILayoutOption>)null); GUILayout.Label(customY.ToString("F2"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); GUILayout.EndHorizontal(); if (Math.Abs(num3 - customX) > 0.01f || Math.Abs(num4 - customY) > 0.01f) { customX = num3; customY = num4; settingsChanged = true; } } GUILayout.Space(15f); GUILayout.Label("Size (-10 to +10): " + sliderValue.ToString("F1"), val, (Il2CppReferenceArray<GUILayoutOption>)null); GUI.backgroundColor = elementBackgroundColor; GUILayout.BeginVertical(GUI.skin.box, (Il2CppReferenceArray<GUILayoutOption>)null); GUIStyle val3 = new GUIStyle(GUI.skin.horizontalSlider); val3.normal.background = MakeSolidTexture(2, 2, new Color(0.4f, 0.4f, 0.4f)); GUIStyle val4 = new GUIStyle(GUI.skin.horizontalSliderThumb); val4.normal.background = MakeSolidTexture(10, 20, new Color(0.6f, 0.6f, 0.6f)); val4.fixedHeight = 20f; val4.fixedWidth = 15f; val4.margin = new RectOffset(0, 0, -8, 0); float num5 = GUILayout.HorizontalSlider(sliderValue, -10f, 10f, val3, val4, Array.Empty<GUILayoutOption>()); GUILayout.EndVertical(); GUI.backgroundColor = backgroundColor; if (Math.Abs(num5 - sliderValue) > 0.1f) { sliderValue = num5; settingsChanged = true; } GUILayout.Space(20f); GUI.backgroundColor = elementBackgroundColor; GUILayout.BeginVertical(GUI.skin.box, (Il2CppReferenceArray<GUILayoutOption>)null); GUIStyle val5 = new GUIStyle(GUI.skin.toggle); val5.fontSize = 16; val5.normal.textColor = Color.white; val5.onNormal.textColor = Color.white; bool flag = GUILayout.Toggle(isClockEnabled, "Display Clock", val5, (Il2CppReferenceArray<GUILayoutOption>)null); GUILayout.EndVertical(); GUI.backgroundColor = backgroundColor; if (flag != isClockEnabled) { isClockEnabled = flag; settingsChanged = true; } GUILayout.Space(20f); GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null); GUILayout.FlexibleSpace(); GUI.backgroundColor = elementBackgroundColor; if (GUILayout.Button("Save", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(90f), GUILayout.Height(30f) })) { ApplySettings(); SaveSettings(); isMenuOpen = false; } GUILayout.Space(10f); if (GUILayout.Button("Close", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(90f), GUILayout.Height(30f) })) { isMenuOpen = false; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 20f)); } private static void ApplySettings() { if (clockMod != null) { clockMod.SetClockPosition(selectedPosition); clockMod.SetClockSize(sliderValue); clockMod.SetClockEnabled(isClockEnabled); clockMod.SetClockStyle(selectedStyle); if (selectedPosition == 4) { clockMod.SetCustomPosition(customX, customY); } } } private static void SaveSettings() { if (clockMod != null) { clockMod.SaveSettings(); MelonLogger.Msg("Clock settings saved"); } } } }
ClockMod-Mono.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using ClockMod; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(global::ClockMod.ClockMod), "ClockMod_Il2Cpp", "1.1.5", "TfourJ", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ClockMod-Mono")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f1e3646789fbf762f89b55ceb5d33e9ef6a3107f")] [assembly: AssemblyProduct("ClockMod-Mono")] [assembly: AssemblyTitle("ClockMod-Mono")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ClockMod { public class ClockMod : MelonMod { private Text timeText; private const int MaxAttempts = 10; private const float AttemptInterval = 1f; private string filepath = "UserData/ClockMod.cfg"; private bool guiSubscribed; private int currentPositionIndex; private MelonPreferences_Category myCategory; private MelonPreferences_Entry<int> clockPosition; private MelonPreferences_Entry<float> clockSizePreference; private MelonPreferences_Entry<bool> clockEnabledPreference; private MelonPreferences_Entry<int> clockStylePreference; private MelonPreferences_Entry<float> customXPosition; private MelonPreferences_Entry<float> customYPosition; private MelonPreferences_Entry<string> hotkeyModifierEntry; private MelonPreferences_Entry<string> hotkeyKeyEntry; private string hotkeyModifier = "Left Shift"; private string hotkeyKey = "F12"; private float keyCooldownTime = 0.5f; private float lastKeyPressTime; private float clockSize; private bool isClockEnabled = true; private int clockStyle; private readonly Vector2[] positionOptions = (Vector2[])(object)new Vector2[5] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 0.5f) }; public int CurrentPositionIndex => currentPositionIndex; public float ClockSize => clockSize; public bool IsClockEnabled => isClockEnabled; public int ClockStyle => clockStyle; public float CustomXPosition => customXPosition.Value; public float CustomYPosition => customYPosition.Value; public string HotkeyModifier => hotkeyModifier; public string HotkeyKey => hotkeyKey; public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("ClockMod Initialized."); myCategory = MelonPreferences.CreateCategory("ClockMod_Settings"); myCategory.SetFilePath(filepath); clockPosition = myCategory.CreateEntry<int>("Clock_Position", 1, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); clockSizePreference = myCategory.CreateEntry<float>("Clock_Size", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); clockEnabledPreference = myCategory.CreateEntry<bool>("Clock_Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); clockStylePreference = myCategory.CreateEntry<int>("Clock_Style", 0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); customXPosition = myCategory.CreateEntry<float>("Custom_X_Position", 0.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); customYPosition = myCategory.CreateEntry<float>("Custom_Y_Position", 0.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); hotkeyModifierEntry = myCategory.CreateEntry<string>("HotkeyModifier", "Left Shift", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); hotkeyKeyEntry = myCategory.CreateEntry<string>("HotkeyKey", "F12", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); if (File.Exists(filepath)) { myCategory.LoadFromFile(true); } else { ((MelonBase)this).LoggerInstance.Msg("Config file does not exist. Creating default configuration."); myCategory.SaveToFile(true); } LoadSettings(); Menu.Initialize(this); myCategory.SaveToFile(true); } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { if (sceneName == "Main") { ((MelonBase)this).LoggerInstance.Msg("Scene " + sceneName + " loaded. Starting to find clock."); MelonCoroutines.Start(StartClockFind()); } } public override void OnSceneWasUnloaded(int buildIndex, string sceneName) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (sceneName == "Main") { ((MelonBase)this).LoggerInstance.Msg("Main scene was unloaded. Stopping clock display."); if (guiSubscribed) { ((MelonEventBase<LemonAction>)(object)MelonEvents.OnGUI).Unsubscribe(new LemonAction(DrawClock)); guiSubscribed = false; } timeText = null; } } private IEnumerator StartClockFind() { yield return (object)new WaitForSeconds(2f); MelonCoroutines.Start(FindClockComponent()); } private IEnumerator FindClockComponent() { int attempts = 0; while (attempts < 10 && (Object)(object)timeText == (Object)null) { attempts++; GameObject val = GameObject.Find("Player_Local"); if ((Object)(object)val == (Object)null) { ((MelonBase)this).LoggerInstance.Warning($"Attempt {attempts}: Player_Local object not found. Retrying in {1f} seconds..."); yield return (object)new WaitForSeconds(1f); continue; } Transform parent = val.transform.parent; if ((Object)(object)parent == (Object)null) { ((MelonBase)this).LoggerInstance.Warning($"Attempt {attempts}: Parent of Player_Local not found. Retrying in {1f} seconds..."); yield return (object)new WaitForSeconds(1f); continue; } ((MelonBase)this).LoggerInstance.Msg("Parent of Player_Local found: " + ((Object)parent).name); Transform val2 = val.transform.Find("CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/HomeScreen/InfoBar"); if ((Object)(object)val2 != (Object)null) { Transform obj = val2.Find("Time"); GameObject val3 = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val3 != (Object)null) { timeText = val3.GetComponent<Text>(); if ((Object)(object)timeText != (Object)null) { ((MelonBase)this).LoggerInstance.Msg("Clock component found."); if (!guiSubscribed) { ((MelonEventBase<LemonAction>)(object)MelonEvents.OnGUI).Subscribe(new LemonAction(DrawClock), 100, false); guiSubscribed = true; } yield break; } } } ((MelonBase)this).LoggerInstance.Warning($"Attempt {attempts}: Clock not found. Retrying in {1f} seconds..."); yield return (object)new WaitForSeconds(1f); } if ((Object)(object)timeText == (Object)null) { ((MelonBase)this).LoggerInstance.Error("Max attempts reached. Failed to find the Clock component."); } } private void DrawClock() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00c2: 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) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) HandleKeyInput(); if ((Object)(object)timeText == (Object)null || !isClockEnabled) { return; } GUIStyle val = new GUIStyle(GUI.skin.box); val.padding = new RectOffset(8, 8, 4, 4); val.alignment = (TextAnchor)4; float num = 1f + clockSize / 10f; string text = timeText.text; if (clockStyle == 1) { string[] array = text.Split(' '); if (array.Length >= 3) { int num2 = Mathf.RoundToInt(14f * num); text = $"{array[0]} {array[1]}\n<size={num2}>{array[2]}</size>"; } } Vector2 val2 = val.CalcSize(new GUIContent(text)); GUIStyle val3 = new GUIStyle(val); val3.fontSize = Mathf.RoundToInt(18f * num); val2 = val3.CalcSize(new GUIContent(text)); val2.x += 16f * num; val2.y += 8f * num; float num3 = 10f; float num4 = 0f; float num5 = 0f; if (currentPositionIndex == 4) { num4 = (float)Screen.width * customXPosition.Value - val2.x / 2f; num5 = (float)Screen.height * customYPosition.Value - val2.y / 2f; } else { switch (currentPositionIndex) { case 0: num4 = num3; num5 = num3; break; case 1: num4 = (float)Screen.width - val2.x - num3; num5 = num3; break; case 2: num4 = num3; num5 = (float)Screen.height - val2.y - num3; break; case 3: num4 = (float)Screen.width - val2.x - num3; num5 = (float)Screen.height - val2.y - num3; break; } } GUI.Box(new Rect(num4, num5, val2.x, val2.y), text, val3); } private void HandleKeyInput() { if (Time.time - lastKeyPressTime >= keyCooldownTime && Menu.HandleKeyInput()) { lastKeyPressTime = Time.time; } } public void SetClockPosition(int positionIndex) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (positionIndex >= 0 && positionIndex < positionOptions.Length) { currentPositionIndex = positionIndex; ((MelonBase)this).LoggerInstance.Msg($"Clock position set to {positionOptions[currentPositionIndex]}"); } } public void SetClockSize(float size) { clockSize = Mathf.Clamp(size, -10f, 10f); ((MelonBase)this).LoggerInstance.Msg($"Clock size set to {clockSize}"); } public void SetClockEnabled(bool enabled) { isClockEnabled = enabled; ((MelonBase)this).LoggerInstance.Msg("Clock display " + (enabled ? "enabled" : "disabled")); } public void SetClockStyle(int style) { clockStyle = style; ((MelonBase)this).LoggerInstance.Msg("Clock style set to " + ((style == 0) ? "Classic" : "Modern")); } public void SetCustomPosition(float x, float y) { customXPosition.Value = Mathf.Clamp01(x); customYPosition.Value = Mathf.Clamp01(y); ((MelonBase)this).LoggerInstance.Msg($"Custom position set to ({customXPosition.Value}, {customYPosition.Value})"); } public void SaveSettings() { clockPosition.Value = currentPositionIndex; clockSizePreference.Value = clockSize; clockEnabledPreference.Value = isClockEnabled; clockStylePreference.Value = clockStyle; myCategory.SaveToFile(true); ((MelonBase)this).LoggerInstance.Msg("Settings saved to file"); } private void LoadSettings() { currentPositionIndex = clockPosition.Value; clockSize = clockSizePreference.Value; isClockEnabled = clockEnabledPreference.Value; clockStyle = clockStylePreference.Value; hotkeyModifier = hotkeyModifierEntry.Value; hotkeyKey = hotkeyKeyEntry.Value; ((MelonBase)this).LoggerInstance.Msg($"Loaded settings - Position: {currentPositionIndex}, Size: {clockSize}, Enabled: {isClockEnabled}, Style: {clockStyle}, Modifier: {hotkeyModifier}, Key: {hotkeyKey}"); } } public static class Menu { [CompilerGenerated] private static class <>O { public static LemonAction <0>__OnGUI; public static WindowFunction <1>__DrawWindow; } private static int selectedPosition = 1; private static float sliderValue = 0f; private static bool isClockEnabled = true; private static bool settingsChanged = false; private static ClockMod clockMod; private static bool isMenuOpen = false; private static Rect windowRect = new Rect(100f, 100f, 320f, 400f); private static bool isResizing = false; private static Vector2 resizeStartPos; private static Rect originalRect; private static readonly string[] positionNames = new string[5] { "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right", "Custom" }; private static int selectedStyle = 0; private static float customX = 0.5f; private static float customY = 0.5f; private static readonly string[] styleNames = new string[2] { "Classic", "Modern" }; private static readonly Color backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1f); private static readonly Color elementBackgroundColor = new Color(0.3f, 0.3f, 0.3f); public static void Initialize(ClockMod mod) { //IL_005d: 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_0068: Expected O, but got Unknown clockMod = mod; selectedPosition = mod.CurrentPositionIndex; sliderValue = mod.ClockSize; isClockEnabled = mod.IsClockEnabled; selectedStyle = mod.ClockStyle; customX = mod.CustomXPosition; customY = mod.CustomYPosition; MelonEvent onGUI = MelonEvents.OnGUI; object obj = <>O.<0>__OnGUI; if (obj == null) { LemonAction val = OnGUI; <>O.<0>__OnGUI = val; obj = (object)val; } ((MelonEventBase<LemonAction>)(object)onGUI).Subscribe((LemonAction)obj, 200, false); MelonLogger.Msg("Clock Mod initialized"); } public static bool HandleKeyInput() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0089: Unknown result type (might be due to invalid IL or missing references) if (clockMod != null) { KeyCode val; KeyCode val2; try { val = (KeyCode)Enum.Parse(typeof(KeyCode), clockMod.HotkeyModifier.Replace(" ", "")); val2 = (KeyCode)Enum.Parse(typeof(KeyCode), clockMod.HotkeyKey.Replace(" ", "")); } catch { MelonLogger.Msg("Hotkey parsing failed, using default hotkey LeftShift + F12."); val = (KeyCode)304; val2 = (KeyCode)293; } if (Input.GetKeyDown(val2) && Input.GetKey(val)) { isMenuOpen = !isMenuOpen; return true; } } if (isMenuOpen && Input.GetKeyDown((KeyCode)27)) { isMenuOpen = false; return true; } return false; } private static void OnGUI() { //IL_0008: 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) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_01a0: 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_01ab: Expected O, but got Unknown if (isMenuOpen) { GUI.backgroundColor = backgroundColor; GUI.contentColor = Color.white; GUIStyle val = new GUIStyle(GUI.skin.window); val.normal.background = MakeSolidTexture(2, 2, backgroundColor); val.hover.background = val.normal.background; val.active.background = val.normal.background; val.focused.background = val.normal.background; val.onNormal.background = val.normal.background; val.onHover.background = val.normal.background; val.onActive.background = val.normal.background; val.onFocused.background = val.normal.background; val.border = new RectOffset(2, 2, 2, 2); val.padding = new RectOffset(10, 10, 10, 10); val.normal.textColor = Color.white; val.hover.textColor = Color.white; val.active.textColor = Color.white; val.focused.textColor = Color.white; val.onNormal.textColor = Color.white; val.onHover.textColor = Color.white; val.onActive.textColor = Color.white; val.onFocused.textColor = Color.white; val.alignment = (TextAnchor)4; Rect val2 = windowRect; object obj = <>O.<1>__DrawWindow; if (obj == null) { WindowFunction val3 = DrawWindow; <>O.<1>__DrawWindow = val3; obj = (object)val3; } windowRect = GUI.Window(12345, val2, (WindowFunction)obj, "", val); Rect val4 = new Rect(((Rect)(ref windowRect)).width + ((Rect)(ref windowRect)).x - 20f, ((Rect)(ref windowRect)).height + ((Rect)(ref windowRect)).y - 20f, 20f, 20f); GUI.Box(val4, "↘", new GUIStyle { alignment = (TextAnchor)4 }); HandleResizing(val4); if (settingsChanged) { ApplySettings(); settingsChanged = false; } } } private static void HandleResizing(Rect resizeHandleRect) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0036: 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) Event current = Event.current; if ((int)current.type == 0 && current.button == 0 && ((Rect)(ref resizeHandleRect)).Contains(current.mousePosition)) { isResizing = true; resizeStartPos = current.mousePosition; originalRect = windowRect; current.Use(); } if (isResizing && (int)current.type == 3) { float width = Mathf.Max(320f, ((Rect)(ref originalRect)).width + (current.mousePosition.x - resizeStartPos.x)); float height = Mathf.Max(400f, ((Rect)(ref originalRect)).height + (current.mousePosition.y - resizeStartPos.y)); ((Rect)(ref windowRect)).width = width; ((Rect)(ref windowRect)).height = height; current.Use(); } if (isResizing && (int)current.type == 1) { isResizing = false; current.Use(); } } private static Texture2D MakeSolidTexture(int width, int height, Color color) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = color; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } private static void DrawWindow(int id) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Expected O, but got Unknown //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Expected O, but got Unknown //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Expected O, but got Unknown //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(10f); GUIStyle val = new GUIStyle(GUI.skin.label); val.normal.textColor = Color.white; val.fontSize = 14; GUIStyle val2 = new GUIStyle(val); val2.alignment = (TextAnchor)4; val2.fontSize = 16; val2.normal.textColor = Color.white; GUILayout.Label("Clock Mod Settings", val2, Array.Empty<GUILayoutOption>()); GUILayout.Label("Clock Style:", val, Array.Empty<GUILayoutOption>()); int num = GUILayout.SelectionGrid(selectedStyle, styleNames, 2, Array.Empty<GUILayoutOption>()); if (num != selectedStyle) { selectedStyle = num; settingsChanged = true; } GUILayout.Space(15f); GUILayout.Label("Position:", val, Array.Empty<GUILayoutOption>()); int num2 = GUILayout.SelectionGrid(selectedPosition, positionNames, 2, Array.Empty<GUILayoutOption>()); if (num2 != selectedPosition) { selectedPosition = num2; settingsChanged = true; if (selectedPosition == 4) { ((Rect)(ref windowRect)).height = 500f; } else { ((Rect)(ref windowRect)).height = 400f; } } if (selectedPosition == 4) { GUILayout.Space(10f); GUILayout.Label("Custom Position:", val, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("X:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f) }); float num3 = GUILayout.HorizontalSlider(customX, 0f, 1f, Array.Empty<GUILayoutOption>()); GUILayout.Label(customX.ToString("F2"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Y:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f) }); float num4 = GUILayout.HorizontalSlider(customY, 0f, 1f, Array.Empty<GUILayoutOption>()); GUILayout.Label(customY.ToString("F2"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); GUILayout.EndHorizontal(); if (Math.Abs(num3 - customX) > 0.01f || Math.Abs(num4 - customY) > 0.01f) { customX = num3; customY = num4; settingsChanged = true; } } GUILayout.Space(15f); GUILayout.Label("Size (-10 to +10): " + sliderValue.ToString("F1"), val, Array.Empty<GUILayoutOption>()); GUI.backgroundColor = elementBackgroundColor; GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>()); GUIStyle val3 = new GUIStyle(GUI.skin.horizontalSlider); val3.normal.background = MakeSolidTexture(2, 2, new Color(0.4f, 0.4f, 0.4f)); GUIStyle val4 = new GUIStyle(GUI.skin.horizontalSliderThumb); val4.normal.background = MakeSolidTexture(10, 20, new Color(0.6f, 0.6f, 0.6f)); val4.fixedHeight = 20f; val4.fixedWidth = 15f; val4.margin = new RectOffset(0, 0, -8, 0); float num5 = GUILayout.HorizontalSlider(sliderValue, -10f, 10f, val3, val4, Array.Empty<GUILayoutOption>()); GUILayout.EndVertical(); GUI.backgroundColor = backgroundColor; if (Math.Abs(num5 - sliderValue) > 0.1f) { sliderValue = num5; settingsChanged = true; } GUILayout.Space(20f); GUI.backgroundColor = elementBackgroundColor; GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>()); GUIStyle val5 = new GUIStyle(GUI.skin.toggle); val5.fontSize = 16; val5.normal.textColor = Color.white; val5.onNormal.textColor = Color.white; bool flag = GUILayout.Toggle(isClockEnabled, "Display Clock", val5, Array.Empty<GUILayoutOption>()); GUILayout.EndVertical(); GUI.backgroundColor = backgroundColor; if (flag != isClockEnabled) { isClockEnabled = flag; settingsChanged = true; } GUILayout.Space(20f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); GUI.backgroundColor = elementBackgroundColor; if (GUILayout.Button("Save", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(90f), GUILayout.Height(30f) })) { ApplySettings(); SaveSettings(); isMenuOpen = false; } GUILayout.Space(10f); if (GUILayout.Button("Close", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(90f), GUILayout.Height(30f) })) { isMenuOpen = false; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 20f)); } private static void ApplySettings() { if (clockMod != null) { clockMod.SetClockPosition(selectedPosition); clockMod.SetClockSize(sliderValue); clockMod.SetClockEnabled(isClockEnabled); clockMod.SetClockStyle(selectedStyle); if (selectedPosition == 4) { clockMod.SetCustomPosition(customX, customY); } } } private static void SaveSettings() { if (clockMod != null) { clockMod.SaveSettings(); MelonLogger.Msg("Clock settings saved"); } } } }