mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
Hide menu buttons
This commit is contained in:
1 parent
422bd63df1
commit
da01abb7c4
1 file changed
+16
@@ -7,6 +7,7 @@ namespace BetterAmongUs.Patches;
|
||||
internal class MainMenuPatch
|
||||
{
|
||||
private static List<PassiveButton> buttons = [];
|
||||
private static List<GameObject> buttonsObj = [];
|
||||
private static PassiveButton template;
|
||||
private static PassiveButton creditsButton;
|
||||
private static PassiveButton gitHubButton;
|
||||
@@ -53,6 +54,7 @@ internal class MainMenuPatch
|
||||
if (template == null) return;
|
||||
|
||||
buttons.Clear();
|
||||
buttonsObj.Clear();
|
||||
|
||||
string creditsTextTitle = "<size=150%><color=#0dff00><b>-=Mod Credits=-</b></color></size>\n";
|
||||
string creditsText = "<size=75%>◆ <color=#0088ff>Head Developer</color>: <b>D1GQ</b></size>";
|
||||
@@ -91,10 +93,24 @@ internal class MainMenuPatch
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(MainMenuManager.LateUpdate))]
|
||||
[HarmonyPostfix]
|
||||
public static void LateUpdate_Postfix(MainMenuManager __instance)
|
||||
{
|
||||
bool Flag = __instance?.screenTint?.GetComponent<SpriteRenderer>() != null
|
||||
&& !__instance.screenTint.GetComponent<SpriteRenderer>().enabled;
|
||||
|
||||
foreach (var item in buttonsObj)
|
||||
{
|
||||
item.SetActive(Flag);
|
||||
}
|
||||
}
|
||||
|
||||
public static PassiveButton CreateButton(string name, Color32 normalColor, Color32 hoverColor, Action action, string label, Vector2? scale = null)
|
||||
{
|
||||
var button = UnityEngine.Object.Instantiate(template);
|
||||
buttons.Add(button);
|
||||
buttonsObj.Add(button.gameObject);
|
||||
button.name = name;
|
||||
UnityEngine.Object.Destroy(button.GetComponent<AspectPosition>());
|
||||
|
||||
|
||||
Reference in new issue
Block a user