Skip to content

Commit

Permalink
Patch random name generator (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
pylixonly authored Feb 18, 2022
1 parent 081e6e2 commit d2e5d02
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions Reactor/Patches/FreeNamePatch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
Expand All @@ -10,6 +11,15 @@ namespace Reactor.Patches
{
public static class FreeNamePatch
{
[HarmonyPatch(typeof(AccountManager), nameof(AccountManager.CheckAndRegenerateName))]
internal static class ValidateRandomNamePatch
{
public static bool Prefix()
{
return false;
}
}

public static void Initialize()
{
SceneManager.add_sceneLoaded((Action<Scene, LoadSceneMode>) ((scene, _) =>
Expand Down Expand Up @@ -45,14 +55,16 @@ private static bool TryMoveObjects()
"JoinGameButton"
};

var offset = Vector3.up;
var gameObjects = toMove.Select(x => GameObject.Find("NormalMenu/" + x)).ToList();
if (gameObjects.Contains(null!)) return false;
var yStart = Vector3.up;
var yOffset = Vector3.down * 1.5f;

gameObjects.ForEach(x => {
x.transform.position = offset;
offset += Vector3.down * 1.5f;
});
var gameObjects = toMove.Select(x => GameObject.Find("NormalMenu/" + x)).ToList();
if (gameObjects.Any(x => x == null)) return false;

for (var i = 0; i < gameObjects.Count; i++)
{
gameObjects[i].transform.position = yStart + (yOffset * i);
}

return true;
}
Expand Down

0 comments on commit d2e5d02

Please sign in to comment.