mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
braindead
This commit is contained in:
parent
453d8023c1
commit
ea1e0da1ce
2 changed files with 107 additions and 108 deletions
|
@ -4,10 +4,10 @@ using cohtml;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NAK.Melons.FuckMetrics
|
namespace NAK.Melons.FuckMetrics;
|
||||||
|
|
||||||
|
public static class FuckMetrics
|
||||||
{
|
{
|
||||||
public static class FuckMetrics
|
|
||||||
{
|
|
||||||
public enum SettingState
|
public enum SettingState
|
||||||
{
|
{
|
||||||
Always,
|
Always,
|
||||||
|
@ -75,16 +75,16 @@ namespace NAK.Melons.FuckMetrics
|
||||||
{
|
{
|
||||||
if (!FuckMetricsMod.EntryDisableCohtmlViewOnIdle.Value) return;
|
if (!FuckMetricsMod.EntryDisableCohtmlViewOnIdle.Value) return;
|
||||||
|
|
||||||
// Don't execute if menu is open
|
FuckMetricsMod.Logger.Msg(cohtmlView != null && !menuOpenTraverse.GetValue<bool>());
|
||||||
if (cohtmlView == null || menuOpenTraverse.GetValue<bool>()) return;
|
FuckMetricsMod.Logger.Msg(menuOpenTraverse.GetValue<bool>());
|
||||||
|
|
||||||
// Disable cohtmlView (opening should enable)
|
if (cohtmlView != null && !menuOpenTraverse.GetValue<bool>())
|
||||||
|
{
|
||||||
cohtmlView.enabled = false;
|
cohtmlView.enabled = false;
|
||||||
|
|
||||||
// Death
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (cohtmlView.m_UISystem != null) cohtmlView.View.Advance(cohtmlView.m_UISystem.Id, (double)Time.unscaledTime * 1000.0);
|
cohtmlView.View.Advance(cohtmlView.m_UISystem?.Id ?? 0, (double)Time.unscaledTime * 1000.0);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,10 +3,10 @@ using ABI_RC.Core.IO;
|
||||||
using cohtml;
|
using cohtml;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
namespace NAK.Melons.FuckMetrics.HarmonyPatches
|
namespace NAK.Melons.FuckMetrics.HarmonyPatches;
|
||||||
|
|
||||||
|
public static class CVR_MenuManagerPatches
|
||||||
{
|
{
|
||||||
public static class CVR_MenuManagerPatches
|
|
||||||
{
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })]
|
[HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })]
|
||||||
private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show)
|
private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show)
|
||||||
|
@ -14,10 +14,10 @@ namespace NAK.Melons.FuckMetrics.HarmonyPatches
|
||||||
FuckMetrics.ApplyMetricsSettings(show);
|
FuckMetrics.ApplyMetricsSettings(show);
|
||||||
FuckMetrics.ApplyCoreUpdatesSettings(show);
|
FuckMetrics.ApplyCoreUpdatesSettings(show);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ViewManagerPatches
|
public static class ViewManagerPatches
|
||||||
{
|
{
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })]
|
[HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })]
|
||||||
private static void Postfix_ViewManager_UiStateToggle(bool show)
|
private static void Postfix_ViewManager_UiStateToggle(bool show)
|
||||||
|
@ -25,10 +25,10 @@ namespace NAK.Melons.FuckMetrics.HarmonyPatches
|
||||||
FuckMetrics.ApplyMetricsSettings(show);
|
FuckMetrics.ApplyMetricsSettings(show);
|
||||||
FuckMetrics.ApplyCoreUpdatesSettings(show);
|
FuckMetrics.ApplyCoreUpdatesSettings(show);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CohtmlViewPatches
|
public static class CohtmlViewPatches
|
||||||
{
|
{
|
||||||
private static CohtmlView _quickMenuView;
|
private static CohtmlView _quickMenuView;
|
||||||
private static CohtmlView _gameMenuView;
|
private static CohtmlView _gameMenuView;
|
||||||
private static Traverse _quickMenuOpenTraverse;
|
private static Traverse _quickMenuOpenTraverse;
|
||||||
|
@ -36,19 +36,19 @@ namespace NAK.Melons.FuckMetrics.HarmonyPatches
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(CVR_MenuManager), "Start")]
|
[HarmonyPatch(typeof(CVR_MenuManager), "Start")]
|
||||||
private static void Postfix_CVRMenuManager_Start(ref CohtmlView ___quickMenu)
|
private static void Postfix_CVRMenuManager_Start(ref CVR_MenuManager __instance, ref CohtmlView ___quickMenu)
|
||||||
{
|
{
|
||||||
_quickMenuView = ___quickMenu;
|
_quickMenuView = ___quickMenu;
|
||||||
_quickMenuOpenTraverse = Traverse.Create<CVR_MenuManager>().Field("_quickMenuOpen");
|
_quickMenuOpenTraverse = Traverse.Create(__instance).Field("_quickMenuOpen");
|
||||||
SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_quickMenuView, _quickMenuOpenTraverse), 15f, 6f, -1);
|
SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_quickMenuView, _quickMenuOpenTraverse), 15f, 6f, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(ViewManager), "Start")]
|
[HarmonyPatch(typeof(ViewManager), "Start")]
|
||||||
private static void Postfix_ViewManager_Start(ref CohtmlView ___gameMenuView)
|
private static void Postfix_ViewManager_Start(ref ViewManager __instance, ref CohtmlView ___gameMenuView)
|
||||||
{
|
{
|
||||||
_gameMenuView = ___gameMenuView;
|
_gameMenuView = ___gameMenuView;
|
||||||
_gameMenuOpenTraverse = Traverse.Create<ViewManager>().Field("_gameMenuOpen");
|
_gameMenuOpenTraverse = Traverse.Create(__instance).Field("_gameMenuOpen");
|
||||||
SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_gameMenuView, _gameMenuOpenTraverse), 12f, 6f, -1);
|
SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_gameMenuView, _gameMenuOpenTraverse), 12f, 6f, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,5 +61,4 @@ namespace NAK.Melons.FuckMetrics.HarmonyPatches
|
||||||
CVR_MenuManager.Instance.SendCoreUpdate();
|
CVR_MenuManager.Instance.SendCoreUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue