public static void Postfix(CreateOptionsPicker __instance) { List <SpriteRenderer> maxPlayerButtons = __instance.MaxPlayerButtons.ToList(); if (maxPlayerButtons == null || maxPlayerButtons.Count <= 2) { return; } additionalButtons = new List <SpriteRenderer>(); for (int i = 1; i < 6; i++) { SpriteRenderer nextButton = Object.Instantiate(maxPlayerButtons.Last(), maxPlayerButtons.Last().transform.parent); additionalButtons.Add(nextButton); nextButton.enabled = false; nextButton.gameObject.name = "1" + i; TMPro.TMP_Text text = nextButton.gameObject.GetComponentInChildren <TMPro.TMP_Text>(); text.text = "1" + i; text.color = Helpers.isCustomServer() ? Color.white : Palette.EGHCBLDNCGP; nextButton.transform.position = nextButton.transform.position + new Vector3(i * (maxPlayerButtons[1].transform.position.x - maxPlayerButtons[0].transform.position.x), 0, 0); var passiveButton = nextButton.GetComponent <PassiveButton>(); passiveButton.OnClick.RemoveAllListeners(); void onClick() { bool isCustom = Helpers.isCustomServer(); foreach (SpriteRenderer renderer in additionalButtons) { if (renderer != null && renderer.gameObject != null) { renderer.enabled = false; renderer.gameObject.GetComponentInChildren <TMPro.TMP_Text>().color = isCustom ? Color.white : Palette.EGHCBLDNCGP; } } if (!isCustom) { return; } nextButton.enabled = true; byte value = byte.Parse(nextButton.name); var targetOptions = __instance.GetTargetOptions(); if (value <= targetOptions.DIGMGCJMGDB) { targetOptions.DIGMGCJMGDB = value - 1; __instance.SetImpostorButtons(targetOptions.DIGMGCJMGDB); } __instance.SetMaxPlayersButtons(value); } passiveButton.OnClick.AddListener((UnityEngine.Events.UnityAction)onClick); } }
public static bool Prefix(PlayerTab __instance) { if (!Helpers.isCustomServer()) { return(true); } PlayerControl.SetPlayerMaterialColors(PlayerControl.LocalPlayer.PPMOEEPBHJO.IMMNCAGJJJC, __instance.DemoImage); for (int i = 0; i < Palette.AEDCMKGJKAG.Length; i++) { __instance.HDGKLGFNEIB.Add(i); } return(false); }
public static bool Prefix(PlayerTab __instance) { if (!Helpers.isCustomServer()) { return(true); } PlayerControl.SetPlayerMaterialColors(PlayerControl.LocalPlayer.Data.ColorId, __instance.DemoImage); for (int i = 0; i < Palette.PlayerColors.Length; i++) { __instance.AvailableColors.Add(i); } return(false); }
public static bool Prefix(PlayerControl __instance, byte CKNNKEMNHAK) { if (!Helpers.isCustomServer()) { return(true); } MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetUncheckedColor, Hazel.SendOption.Reliable, -1); writer.Write(CKNNKEMNHAK); writer.Write(__instance.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.setUncheckedColor(CKNNKEMNHAK, __instance.PlayerId); return(false); }
public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] byte bodyColor) { if (!Helpers.isCustomServer() || Palette.PlayerColors.Count >= PlayerControl.AllPlayerControls.Count) { return(true); } MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetUncheckedColor, Hazel.SendOption.Reliable, -1); writer.Write(bodyColor); writer.Write(__instance.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.setUncheckedColor(bodyColor, __instance.PlayerId); return(false); }