示例#1
0
        public static void Main(string[] args)
        {
            SessionDetails.LoadFromFile();

            while (true)
            {
                Console.Clear();
                var menuOptions = new List <string>
                {
                    "New Game",
                    "Stats"
                };

                Console.WriteLine("Welcome to the Tandem Trivia Training app!");
                var userResponse = Util.ReadAnswer(menuOptions);

                if (!userResponse.HasValue)
                {
                    return;
                }
                else if (userResponse.Value == 1)
                {
                    TriviaGame.RunGame();
                }
                else if (userResponse.Value == 2)
                {
                    Statistics.DisplayStats();
                }
            }
        }
示例#2
0
 private static void UpdateSessionDetails(List <Player> players)
 {
     foreach (var player in players)
     {
         SessionDetails.DetailsByUser.TryAdd(player.Name, new List <UserSessionDetails>());
         SessionDetails.DetailsByUser[player.Name].Add(new UserSessionDetails {
             Time = DateTime.Now, Score = player.Score
         });
     }
     SessionDetails.SaveToFile();
 }