fix(version): prevent mod's version from overlapping with Reactor's

This commit is contained in:
Pandraghon committed 2021-03-27 23:02:33 +01:00
1 parent 72cb487a83
commit 52946a48cd
2 files changed
+8 -22

No files matched your search

+8
View File
@@ -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();
}
-22
View File
@@ -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";
}
}
}