Example #1
0
        public override async Task ExecuteArmed(ServerBattle battle, Say e)
        {
            var  afkers  = battle.Users.Values.Where(x => !x.IsSpectator && x.LobbyUser.IsAway);
            var  unready = battle.Users.Values.Where(x => !x.IsSpectator && x.SyncStatus != SyncStatuses.Synced);
            bool wait    = false;

            if (afkers.Any())
            {
                wait = true;
                await battle.SayBattle("The following users are afk and will be spectated: " + afkers.Select(x => x.Name).StringJoin());
            }
            if (unready.Any())
            {
                wait = true;
                await battle.SayBattle("The following users are still downloading the map: " + unready.Select(x => x.Name).StringJoin());
            }
            if (wait)
            {
                await battle.SayBattle("Game starting in 10 seconds...");

                battle.BlockPolls(10);
                startTimer           = new Timer(10000);
                startTimer.Enabled   = true;
                startTimer.AutoReset = false;
                startTimer.Elapsed  += (t, s) => { StartGame(battle); };
            }
            else
            {
                await StartGame(battle);
            }
        }