mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
rename mod & add settings
This commit is contained in:
parent
ef3efc001d
commit
28347e45a4
8 changed files with 39 additions and 20 deletions
|
@ -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
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<bool> EntryDisableMetrics =
|
||||
CategoryFuckMetrics.CreateEntry("Disable Metrics", true, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled.");
|
||||
public static readonly MelonPreferences_Entry<SettingState> 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<bool> 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<SettingState> 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)
|
Loading…
Add table
Add a link
Reference in a new issue