Пример #1
0
 /// <summary>
 /// Checks the game object to see if both players have provided an answer. If they have, we start the logic to determine who won then store their stats.
 /// </summary>
 /// <param name="game"></param>
 /// <returns></returns>
 private static RpsGameObject IsWinner(RpsGameObject game)
 {
     if (game.PTwo.Choice != null && game.POne.Choice != null)
     {
         var save     = new StatJsonController();
         var populate = new PopulateStatObject();
         var winner   = DetermineWinner(game);
         winner.RemoveGame();
         save.SaveStatsJson(populate.SetPlayerStats(winner));
         return(winner);
     }
     return(game);
 }
Пример #2
0
        public async Task GetPlayerStats()
        {
            IUser user        = Context.User;
            var   read        = new StatJsonController();
            var   playerStats = read.ReadStatsJson(user.Id);

            if (playerStats == null)
            {
                await Context.User.SendMessageAsync("You've not played a game yet. Challenge someone!");
            }
            else
            {
                await Context.User.SendMessageAsync(null, false, PlayerStatsMessageEmbed.RpsPlayerStats(playerStats, user).Build());
            }
        }