Exemple #1
0
 public static async Task RemovePlayer(SocketMessage message, SnakeOil game)
 {
     if (game == null)
     {
         await message.Channel.SendMessageAsync("You can't leave a game if there is no game");
     }
     else
     {
         game.RemovePlayer(message.Author);
         if (game.GetPlayerCount() < 3)
         {
             await message.Channel.SendMessageAsync("You left the game. Not enough players left to keep playing");
         }
         else
         {
             await message.Channel.SendMessageAsync("You left the game");
         }
     }
 }
Exemple #2
0
        public static async Task AddPlayer(SocketMessage message, SnakeOil game)
        {
            if (game == null)
            {
                await message.Channel.SendMessageAsync("There is no game going on in this channel.");
            }

            else
            {
                int i = game.AddPlayer(message.Author);
                if (i == 0)
                {
                    if (game.GetPlayerCount() < 3)
                    {
                        await message.Channel.SendMessageAsync($"The game currently has the following players {game.GetPlayerList()} \n \n you still need more players before you can start the game");
                    }
                    else
                    {
                        await message.Channel.SendMessageAsync($"The game currently has the following players {game.GetPlayerList()}");
                    }
                }
                else
                {
                    string answer = "";
                    switch (i)
                    {
                    case 1: answer = "You already joined the game. playing as 2 people is not allowed"; break;

                    case 2: answer = "You can't join because there are not enough words for that amount of players"; break;

                    default: answer = "Someone forgot to add an errorcode. so this game may now be broken :("; break;
                    }
                    await message.Channel.SendMessageAsync(answer);
                }
            }
        }