mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
what
This commit is contained in:
parent
ddb6c85717
commit
453d8023c1
3 changed files with 95 additions and 100 deletions
|
@ -13,63 +13,59 @@ public class FuckMetricsMod : MelonMod
|
|||
public static readonly MelonPreferences_Entry<bool> EntryDisableCohtmlViewOnIdle =
|
||||
CategoryFuckMetrics.CreateEntry("Disable CohtmlView On Idle", false, description: "Disables CohtmlView on the menus when idle. Takes up to 6 seconds after menu exit. This can give a huge performance boost.");
|
||||
|
||||
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<FuckMetrics.SettingState> EntryDisableMetrics =
|
||||
CategoryFuckMetrics.CreateEntry("Menu Metrics", FuckMetrics.SettingState.MenuOnly, description: "Disables menu metrics (FPS & Ping). 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 static readonly MelonPreferences_Entry<FuckMetrics.SettingState> EntryDisableCoreUpdates =
|
||||
CategoryFuckMetrics.CreateEntry("Menu Core Updates", FuckMetrics.SettingState.MenuOnly, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<float> EntryMetricsUpdateRate =
|
||||
CategoryFuckMetrics.CreateEntry("Metrics Update Rate", 1f, description: "Sets the update rate for the menu metrics. Default is 0.5f. Recommended to be 1f or higher.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<float> EntryCoreUpdateRate =
|
||||
CategoryFuckMetrics.CreateEntry("Core Update Rate", 2f, description: "Sets the update rate for the menu core updates. Default is 0.1f. Recommended to be 2f or higher.");
|
||||
public enum SettingState
|
||||
{
|
||||
Always,
|
||||
MenuOnly,
|
||||
Disabled
|
||||
}
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
Logger = LoggerInstance;
|
||||
|
||||
EntryDisableMetrics.OnEntryValueChangedUntyped.Subscribe(OnDisableMetrics);
|
||||
EntryDisableCoreUpdates.OnEntryValueChangedUntyped.Subscribe(OnDisableCoreUpdates);
|
||||
EntryMetricsUpdateRate.OnEntryValueChangedUntyped.Subscribe(OnChangeMetricsUpdateRate);
|
||||
EntryCoreUpdateRate.OnEntryValueChangedUntyped.Subscribe(OnChangeCoreUpdateRate);
|
||||
|
||||
ApplyPatches(typeof(HarmonyPatches.CVR_MenuManagerPatches));
|
||||
ApplyPatches(typeof(HarmonyPatches.ViewManagerPatches));
|
||||
ApplyPatches(typeof(HarmonyPatches.CohtmlViewPatches));
|
||||
MelonCoroutines.Start(WaitForLocalPlayer());
|
||||
}
|
||||
|
||||
IEnumerator WaitForLocalPlayer()
|
||||
private IEnumerator WaitForLocalPlayer()
|
||||
{
|
||||
while (PlayerSetup.Instance == null)
|
||||
yield return null;
|
||||
UpdateSettings();
|
||||
}
|
||||
|
||||
private void UpdateSettings()
|
||||
{
|
||||
FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == FuckMetrics.SettingState.Always);
|
||||
FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == FuckMetrics.SettingState.Always);
|
||||
}
|
||||
|
||||
private void OnDisableMetrics(object arg1, object arg2)
|
||||
{
|
||||
FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == SettingState.Always);
|
||||
FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == FuckMetrics.SettingState.Always);
|
||||
}
|
||||
|
||||
private void OnDisableCoreUpdates(object arg1, object arg2)
|
||||
{
|
||||
FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == SettingState.Always);
|
||||
}
|
||||
|
||||
private void UpdateSettings()
|
||||
{
|
||||
FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == SettingState.Always);
|
||||
FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == SettingState.Always);
|
||||
FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == FuckMetrics.SettingState.Always);
|
||||
}
|
||||
|
||||
private void OnChangeMetricsUpdateRate(object arg1, object arg2)
|
||||
{
|
||||
if (EntryDisableMetrics.Value != SettingState.Disabled)
|
||||
if (EntryDisableMetrics.Value != FuckMetrics.SettingState.Disabled)
|
||||
{
|
||||
FuckMetrics.ToggleMetrics(false);
|
||||
FuckMetrics.ToggleMetrics(true);
|
||||
|
@ -78,7 +74,7 @@ public class FuckMetricsMod : MelonMod
|
|||
|
||||
private void OnChangeCoreUpdateRate(object arg1, object arg2)
|
||||
{
|
||||
if (EntryDisableCoreUpdates.Value != SettingState.Disabled)
|
||||
if (EntryDisableCoreUpdates.Value != FuckMetrics.SettingState.Disabled)
|
||||
{
|
||||
FuckMetrics.ToggleCoreUpdates(false);
|
||||
FuckMetrics.ToggleCoreUpdates(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue