From 52946a48cd33a85c52c3d1ce2ae496f0c0353d2d Mon Sep 17 00:00:00 2001 From: Pandraghon Date: Sat, 27 Mar 2021 23:02:33 +0100 Subject: [PATCH] fix(version): prevent mod's version from overlapping with Reactor's --- BetterPolus/BetterPolusPlugin.cs | 8 ++++++++ BetterPolus/VersionShowerPatch.cs | 22 ---------------------- 2 files changed, 8 insertions(+), 22 deletions(-) delete mode 100644 BetterPolus/VersionShowerPatch.cs diff --git a/BetterPolus/BetterPolusPlugin.cs b/BetterPolus/BetterPolusPlugin.cs index 13b780a..730b59c 100644 --- a/BetterPolus/BetterPolusPlugin.cs +++ b/BetterPolus/BetterPolusPlugin.cs @@ -3,6 +3,7 @@ using BepInEx.IL2CPP; using BepInEx.Logging; using HarmonyLib; using Reactor; +using Reactor.Patches; namespace BetterPolus { @@ -22,6 +23,13 @@ namespace BetterPolus log = Log; log.LogMessage("BetterPolus Mod loaded"); + + ReactorVersionShower.TextUpdated += (text) => + { + int index = text.Text.LastIndexOf('\n'); + text.Text = text.Text.Insert(index == -1 ? text.Text.Length - 1 : index, + "\nLoaded [5E4CA6FF]BetterPolus v1.1.1-R []by Brybry"); + }; Harmony.PatchAll(); } diff --git a/BetterPolus/VersionShowerPatch.cs b/BetterPolus/VersionShowerPatch.cs deleted file mode 100644 index e4c5d86..0000000 --- a/BetterPolus/VersionShowerPatch.cs +++ /dev/null @@ -1,22 +0,0 @@ -using BepInEx.IL2CPP; -using HarmonyLib; -using UnityEngine; - -namespace BetterPolus -{ - [HarmonyPatch(typeof(VersionShower), nameof(VersionShower.Start))] - public class VersionShowerPatch - { - [HarmonyPostfix] - [HarmonyPatch] - [HarmonyPriority(Priority.First)] - public static void Postfix(VersionShower __instance) - { - var reactorVS = GameObject.Find("ReactorVersion"); - GameObject.Destroy(reactorVS); - - TextRenderer text = __instance.text; - text.Text += "\nLoaded [5E4CA6FF]BetterPolus v1.1.1-R []by Brybry"; - } - } -} \ No newline at end of file