コード例 #1
0
ファイル: ModeProfile.cs プロジェクト: DurisDTU/QuizRacer-1.0
        public void ProfilePage(Player player)
        {
            qD.GameDisplayMode(player.Name, "This is your profile, what do you want to do?", "Show stats", "Change username", "Change Password", "Reset stats", "Go back");

            //await answer input
            char answer = char.ToLower(Console.ReadKey().KeyChar);

            if (qS.IsValidAnswerMultiple(answer))
            {
                switch (answer)
                {
                case 'a':
                    ShowStats(player);
                    break;

                case 'b':
                    ChangeUsername(player);
                    break;

                case 'c':
                    ChangePassword(player);
                    break;

                case 'd':
                    ResetStats(player);
                    break;

                case 'x':
                    break;
                }
            }
        }
コード例 #2
0
        public void ChangeDifficulty(Player player, GameSettings gS)
        {
            qD.GameDisplayMode(" ", "What difficulty do you want for the questions", "Easy", "Medium", "Hard", "Any", "Cancel");

            char answer = char.ToLower(Console.ReadKey().KeyChar);

            switch (answer)
            {
            case 'a':
                gS.difficulty = "easy";
                GameSettings(player, gS);
                break;

            case 'b':
                gS.difficulty = "medium";
                GameSettings(player, gS);
                break;

            case 'c':
                gS.difficulty = "hard";
                GameSettings(player, gS);
                break;

            case 'd':
                gS.difficulty = "any";
                GameSettings(player, gS);
                break;

            case 'x':
                GameSettings(player, gS);
                break;
            }
        }
コード例 #3
0
        static void Main()
        {
            QuestionSeperater qS     = new QuestionSeperater();
            QuestionDisplay   qD     = new QuestionDisplay();
            ModeProfile       profil = new ModeProfile();
            ModeGameSettings  mgs    = new ModeGameSettings();

            Boolean menuMode = true;
            Boolean gameOn   = false;
            char    answer;

            qD.displayStart(15, "Please enter you name.");
            String username = Console.ReadLine();

            //Creates a player object
            Player player = new Player
            {
                Name = username
            };

            //creates a player in the database with username
            Player.GetPlayerStats(player);

            //Creates the default game settings
            GameSettings gS = new GameSettings(10, "any", "any");


            qD.displayStart(8, "Welcome");
            Thread.Sleep(1500);

            while (menuMode)
            {
                qD.GameDisplayMode(player.Name, "What do you want to do?", "Play solo.", "Find match", "Go to Profile", "Edit game settings", "Press X to exit");

                //await answer input
                answer = char.ToLower(Console.ReadKey().KeyChar);

                if (qS.IsValidAnswerMultiple(answer))
                {
                    switch (answer)
                    {
                    case 'a':
                        ModeSolo.SoloGame(player, gS);
                        qD.gameDisplayMultiple(player.Name, player.Score, "Thanks for playing! Here are your stats:",
                                               "Correct answers: " + player.CorrectAnswers,
                                               "Total answered questions: " + player.AnsweredQuestions,
                                               "Highscore: " + player.Highscore,
                                               ""
                                               );
                        Thread.Sleep(2000);
                        player.Score = 0;
                        break;

                    case 'b':
                        ModeMulti.MultiplayerGame(player, gS);
                        qD.gameDisplayMultiple(player.Name, player.Score, "Thanks for playing! Here are your stats:",
                                               "Correct answers: " + player.CorrectAnswers,
                                               "Total answered questions: " + player.AnsweredQuestions,
                                               "Highscore: " + player.Highscore,
                                               "Won Games: " + player.WonGames
                                               );
                        Thread.Sleep(2000);
                        player.Score = 0;
                        break;

                    case 'c':
                        profil.ProfilePage(player);
                        break;

                    case 'd':
                        mgs.GameSettings(player, gS);
                        break;

                    case 'x':
                        menuMode = false;
                        break;
                    }
                }

                while (gameOn)
                {
                    gameOn = false;
                }
            }
        }