Exemplo n.º 1
0
        public void OnBanchoMatchChangeTeam(BanchoMatchChangeTeamArgs args)
        {
            var slot = args.pr.JoinedRoom?.GetSlotByUserId(args.pr.User.Id);

            if (slot == null)
            {
                return;
            }

            switch (slot.Team)
            {
            case MultiSlotTeam.Blue:
                slot.Team = MultiSlotTeam.Red;
                break;

            case MultiSlotTeam.Red:
                slot.Team = MultiSlotTeam.Blue;
                break;

            case MultiSlotTeam.NoTeam:
                slot.Team = new Random().Next(1) == 1 ? MultiSlotTeam.Red : MultiSlotTeam.Blue;
                break;

            default:
                slot.Team = MultiSlotTeam.NoTeam;
                break;
            }

            args.pr.JoinedRoom.Update();
        }
Exemplo n.º 2
0
        public void OnBanchoMatchChangeTeam(BanchoMatchChangeTeamArgs args)
        {
            var slot = args.Pr.ActiveMatch?.GetSlotByUserId(args.Pr.User.Id);

            if (slot == null)
            {
                return;
            }

            slot.Team = slot.Team switch
            {
                MultiSlotTeam.Blue => MultiSlotTeam.Red,
                MultiSlotTeam.Red => MultiSlotTeam.Blue,
                MultiSlotTeam.NoTeam => new Random().Next(1) == 1 ? MultiSlotTeam.Red : MultiSlotTeam.Blue,
                _ => MultiSlotTeam.NoTeam,
            };

            args.Pr.ActiveMatch.Update();
        }