diff --git a/HideTips/HideTips.cs b/HideTips/HideTips.cs index 0b53b95..1e2349a 100644 --- a/HideTips/HideTips.cs +++ b/HideTips/HideTips.cs @@ -18,6 +18,8 @@ public class HideTips : BaseUnityPlugin private static bool _skipPrologue = true; private static bool _hideMenuDemo = false; + private static Harmony _patch; + private void Awake() { _cfgEnabled = Config.Bind("General", "Enabled", _cfgEnabled, "enable/disable this plugin").Value; @@ -31,10 +33,16 @@ public class HideTips : BaseUnityPlugin Harmony.CreateAndPatchAll(typeof(HideTips)); if (_hideMenuDemo) { - Harmony.CreateAndPatchAll(typeof(HideMenuDemo)); + _patch = Harmony.CreateAndPatchAll(typeof(HideMenuDemo)); } } + private void OnDestroy() + { + _patch?.UnpatchSelf(); + _patch = null; + } + [HarmonyPostfix] [HarmonyPatch(typeof(UIBuildMenu), "_OnCreate")] private static void ClearRandReminderTips(UIBuildMenu __instance) @@ -93,7 +101,7 @@ public class HideTips : BaseUnityPlugin [HarmonyPatch] class HideMenuDemo { - [HarmonyPrefix] + [HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPatch(typeof(DSPGame), "StartDemoGame", typeof(int))] private static bool DSPGame_OnStartDemoGame_Prefix() { @@ -129,7 +137,7 @@ class HideMenuDemo return false; } - [HarmonyPrefix] + [HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPatch(typeof(VFPreload), "IsMenuDemoLoaded")] private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result) { @@ -137,7 +145,7 @@ class HideMenuDemo return false; } - [HarmonyPrefix] + [HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPatch(typeof(DSPGame), "LateUpdate")] [HarmonyPatch(typeof(GameMain), "LateUpdate")] [HarmonyPatch(typeof(GameMain), "FixedUpdate")] @@ -148,8 +156,7 @@ class HideMenuDemo return !DSPGame.IsMenuDemo; } - [HarmonyPrefix] - [HarmonyPriority(Priority.Last)] + [HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPatch(typeof(GameMain), "Begin")] private static bool GameMain_Begin_Prefix() { diff --git a/HideTips/README.md b/HideTips/README.md index df90c4e..7523af1 100644 --- a/HideTips/README.md +++ b/HideTips/README.md @@ -3,23 +3,29 @@ #### Hide/Disable various tutorial tips/messages #### 隐藏/屏蔽各种引导提示/消息 -## Updates - +## Changelog * 1.0.2 - * Add option to disable title screen demo scene loading - + + Add option to disable title screen demo scene loading * 1.0.1 - * Hide 3 more random tutorial tips popup from bottom-right panel + + Hide 3 more random tutorial tips popup from bottom-right panel +* 1.0.0 + + Initial release ## Usage - * Tips/messages that can be hidden: random-reminder, tutorial, achievement/milestone card. * Skip prologue for new game. * Disable title screen demo scene loading. * Each type of tips/messages is configurable individually. -## 使用说明 +## 更新日志 +* 1.0.2 + + 增加选项以关闭标题画面的演示场景加载 +* 1.0.1 + + 可屏蔽右下面板的3种随机提醒 +* 1.0.0 + + 初始版本 +## 使用说明 * 可以屏蔽的消息:随机提醒,教程,成就/里程碑卡片。 * 跳过新游戏引导动画。 * 关闭标题画面的演示场景加载。