Ejemplo n.º 1
0
        public static void MakeButtons(HudManager hm)
        {
            morphButton = new CustomButton(
                () =>
            {
                if (!isMorph)
                {
                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.mimicMorph, Hazel.SendOption.Reliable, -1);
                    writer.Write(PlayerControl.LocalPlayer.PlayerId);
                    writer.Write(MimicK.allPlayers.FirstOrDefault().PlayerId);
                    AmongUsClient.Instance.FinishRpcImmediately(writer);
                    RPCProcedure.mimicMorph(PlayerControl.LocalPlayer.PlayerId, MimicK.allPlayers.FirstOrDefault().PlayerId);
                }
                else
                {
                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.mimicResetMorph, Hazel.SendOption.Reliable, -1);
                    writer.Write(PlayerControl.LocalPlayer.PlayerId);
                    AmongUsClient.Instance.FinishRpcImmediately(writer);
                    RPCProcedure.mimicResetMorph(PlayerControl.LocalPlayer.PlayerId);
                }
            },
                () => { return(PlayerControl.LocalPlayer.isRole(RoleType.MimicA) && PlayerControl.LocalPlayer.isAlive() && MimicK.isAlive()); },
                () => { return(PlayerControl.LocalPlayer.CanMove); },
                () =>
            {
            },
                getMorphButtonSprite(),
                new Vector3(-1.8f, -0.06f, 0),
                hm,
                hm.UseButton,
                KeyCode.Q,
                false
                );
            morphButton.buttonText = "";

            adminButton = new CustomButton(
                () => {
                PlayerControl.LocalPlayer.NetTransform.Halt();
                Action <MapBehaviour> tmpAction = (MapBehaviour m) => { m.ShowCountOverlay(); };
                DestroyableSingleton <HudManager> .Instance.ShowMap(tmpAction);
                if (PlayerControl.LocalPlayer.AmOwner)
                {
                    PlayerControl.LocalPlayer.MyPhysics.inputHandler.enabled = true;
                    ConsoleJoystick.SetMode_Task();
                }
            },
                () => {
                return(PlayerControl.LocalPlayer.isRole(RoleType.MimicA) &&
                       PlayerControl.LocalPlayer.isAlive() &&
                       MimicK.isAlive());
            },
                () => { return(PlayerControl.LocalPlayer.CanMove); },
                () => {},
                EvilHacker.getButtonSprite(),
                new Vector3(0f, 1.0f, 0),
                hm,
                hm.KillButton,
                KeyCode.F,
                false);
            adminButton.buttonText = DestroyableSingleton <TranslationController> .Instance.GetString(StringNames.Admin);

            adminButton.MaxTimer = adminButton.Timer = 0;
        }