From 17755aa69db1e06cec27df70a33944e7a8efd6c5 Mon Sep 17 00:00:00 2001 From: js6pak Date: Mon, 10 May 2021 19:29:45 +0200 Subject: [PATCH] Allow to change name always --- Reactor/Patches/BetterGuestPatch.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Reactor/Patches/BetterGuestPatch.cs b/Reactor/Patches/BetterGuestPatch.cs index e326b4e..f6b3615 100644 --- a/Reactor/Patches/BetterGuestPatch.cs +++ b/Reactor/Patches/BetterGuestPatch.cs @@ -1,5 +1,6 @@ using HarmonyLib; using InnerNet; +using UnityEngine; namespace Reactor.Patches { @@ -14,5 +15,25 @@ namespace Reactor.Patches return false; } } + + [HarmonyPatch(typeof(AccountTab), nameof(AccountTab.Open))] + public static class EditNamePatch + { + public static void Prefix(AccountTab __instance) + { + Fix(__instance, __instance.guestMode); + Fix(__instance, __instance.offlineMode); + } + + private static void Fix(AccountTab __instance, GameObject mode) + { + var randomizeName = mode.transform.Find("RandomizeName").gameObject; + if (!randomizeName.active) + return; + + randomizeName.active = false; + Object.Instantiate(__instance.loggedInMode.editNameButton, mode.transform); + } + } } }