Exemple #1
0
        public async Task Start()
        {
            if (_gameState != GameState.WaitingForPlayers) // In case someone use the 'Start' command right when the game was about to be launched by itself
            {
                return;
            }
            _gameState = GameState.Running;
            if (HaveMultiplayerLobby())
            {
                // Setup for multiplayer:
                if (await _lobby.LoadNames(_chan as ITextChannel)) // We try to load the nickname of everyone in the lobby
                {
                    var msg = await _chan.SendMessageAsync(_lobby.GetReadyMessage(_guild));

                    var ids = _lobby.GetPlayersId();
                    foreach (var id in ids)
                    {
                        await Program.p.cm.ProgressAchievementAsync(Community.AchievementID.PlayWithFriends, ids.Count, null, msg, id);
                    }
                }
                else
                {
                    _gameState = GameState.Lost;
                    await _chan.SendMessageAsync(Sentences.LobbyLeftChannel(_guild));
                }
                if (_multiType == APreload.MultiplayerType.Elimination)
                {
                    await PostText(Sentences.AnnounceTurn(_guild, _lobby.GetTurnName()));
                }
            }
            await PostAsync();
        }
Exemple #2
0
 public async Task Start()
 {
     if (_gameState != GameState.WaitingForPlayers) // In case someone use the 'Start' command right when the game was about to be launched by itself
     {
         return;
     }
     _gameState = GameState.Running;
     if (HaveMultiplayerLobby())
     {
         // Setup for multiplayer:
         if (await _lobby.LoadNames(_chan)) // We try to load the nickname of everyone in the lobby
         {
             await _chan.SendMessageAsync(_lobby.GetReadyMessage(_chan.GuildId));
         }
         else
         {
             _gameState = GameState.Lost;
             await _chan.SendMessageAsync(Sentences.LobbyLeftChannel(_chan.GuildId));
         }
         if (_multiType == APreload.MultiplayerType.Elimination)
         {
             await PostText(Sentences.AnnounceTurn(_chan.GuildId, _lobby.GetTurnName()));
         }
     }
     await PostAsync();
 }