diff --git a/FuckCohtml/FuckMetrics.cs b/FuckMetrics/FuckMetrics.cs similarity index 100% rename from FuckCohtml/FuckMetrics.cs rename to FuckMetrics/FuckMetrics.cs diff --git a/FuckCohtml/FuckCohtml.csproj b/FuckMetrics/FuckMetrics.csproj similarity index 100% rename from FuckCohtml/FuckCohtml.csproj rename to FuckMetrics/FuckMetrics.csproj diff --git a/FuckCohtml/FuckCohtml.sln b/FuckMetrics/FuckMetrics.sln similarity index 59% rename from FuckCohtml/FuckCohtml.sln rename to FuckMetrics/FuckMetrics.sln index eb1c8a7..b6c2e37 100644 --- a/FuckCohtml/FuckCohtml.sln +++ b/FuckMetrics/FuckMetrics.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.2.32630.192 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FuckCohtml", "FuckCohtml.csproj", "{D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FuckMetrics", "FuckMetrics.csproj", "{D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,15 +11,15 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}.Release|Any CPU.Build.0 = Release|Any CPU + {D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A63345C7-1CD9-4EA0-B891-8CE1CEB97C8B} + SolutionGuid = {CE55D93A-682A-47F4-A971-65132B854210} EndGlobalSection EndGlobal diff --git a/FuckCohtml/HarmonyPatches.cs b/FuckMetrics/HarmonyPatches.cs similarity index 58% rename from FuckCohtml/HarmonyPatches.cs rename to FuckMetrics/HarmonyPatches.cs index 282c58c..e897efe 100644 --- a/FuckCohtml/HarmonyPatches.cs +++ b/FuckMetrics/HarmonyPatches.cs @@ -10,8 +10,8 @@ class PlayerSetupPatches [HarmonyPatch(typeof(PlayerSetup), "Start")] private static void Postfix_PlayerSetup_Start() { - FuckMetrics.ToggleMetrics(FuckMetricsMod.EntryDisableMetrics.Value); - FuckMetrics.ToggleCoreUpdates(FuckMetricsMod.EntryDisableCoreUpdates.Value); + FuckMetrics.ToggleMetrics(FuckMetricsMod.EntryDisableMetrics.Value == FuckMetricsMod.SettingState.Enabled); + FuckMetrics.ToggleCoreUpdates(FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.Enabled); } } @@ -21,11 +21,17 @@ class CVR_MenuManagerPatches [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show) { - if (!FuckMetricsMod.EntryDisableCoreUpdates.Value) return; - if (show) + if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.Disabled) return; + + if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.MenuOnly) + { + FuckMetrics.ToggleMetrics(show); + FuckMetrics.ToggleCoreUpdates(show); + } + else if (show) { - CVR_MenuManager.Instance.SendCoreUpdate(); ViewManager.Instance.UpdateMetrics(); + CVR_MenuManager.Instance.SendCoreUpdate(); } } } @@ -36,11 +42,17 @@ class ViewManagerPatches [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] private static void Postfix_ViewManager_UiStateToggle(bool show) { - if (!FuckMetricsMod.EntryDisableMetrics.Value) return; - if (show) + if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.Disabled) return; + + if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.MenuOnly) + { + FuckMetrics.ToggleMetrics(show); + FuckMetrics.ToggleCoreUpdates(show); + } + else if (show) { - CVR_MenuManager.Instance.SendCoreUpdate(); ViewManager.Instance.UpdateMetrics(); + CVR_MenuManager.Instance.SendCoreUpdate(); } } } \ No newline at end of file diff --git a/FuckCohtml/Main.cs b/FuckMetrics/Main.cs similarity index 59% rename from FuckCohtml/Main.cs rename to FuckMetrics/Main.cs index 5bd8aec..47883e0 100644 --- a/FuckCohtml/Main.cs +++ b/FuckMetrics/Main.cs @@ -9,11 +9,18 @@ public class FuckMetricsMod : MelonMod public const string SettingsCategory = "FuckMetrics"; public static readonly MelonPreferences_Category CategoryFuckMetrics = MelonPreferences.CreateCategory(SettingsCategory); - public static readonly MelonPreferences_Entry EntryDisableMetrics = - CategoryFuckMetrics.CreateEntry("Disable Metrics", true, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); + public static readonly MelonPreferences_Entry EntryDisableMetrics = + CategoryFuckMetrics.CreateEntry("Menu Metrics", SettingState.MenuOnly, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); - public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = - CategoryFuckMetrics.CreateEntry("Disable Core Updates", true, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); + public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = + CategoryFuckMetrics.CreateEntry("Menu Core Updates", SettingState.MenuOnly, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); + + public enum SettingState + { + Enabled, + MenuOnly, + Disabled + } public override void OnInitializeMelon() { @@ -27,12 +34,12 @@ public class FuckMetricsMod : MelonMod private void OnDisableMetrics(object arg1, object arg2) { - FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value); + FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == SettingState.Enabled); } private void OnDisableCoreUpdates(object arg1, object arg2) { - FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value); + FuckMetrics.ToggleCoreUpdates(EntryDisableMetrics.Value == SettingState.Enabled); } private void ApplyPatches(Type type) diff --git a/FuckCohtml/ManagedLibs/.keep b/FuckMetrics/ManagedLibs/.keep similarity index 100% rename from FuckCohtml/ManagedLibs/.keep rename to FuckMetrics/ManagedLibs/.keep diff --git a/FuckCohtml/Properties/AssemblyInfo.cs b/FuckMetrics/Properties/AssemblyInfo.cs similarity index 100% rename from FuckCohtml/Properties/AssemblyInfo.cs rename to FuckMetrics/Properties/AssemblyInfo.cs diff --git a/FuckCohtml/format.json b/FuckMetrics/format.json similarity index 100% rename from FuckCohtml/format.json rename to FuckMetrics/format.json