示例#1
0
        public override void Play()
        {
            string[] dialogContent =
            {
                "Hey Toi !",
                "Je ne t'ai jamais vu ici. . .",
                "Tu es un aventurier ??",
                "Dis moi, quel-est ton nom ?"
            };

            Point dialogPoint  = new Point((int)(Console.WindowWidth * 0.4), (int)(Console.WindowHeight * 0.5));
            Point dialogPoint2 = new Point((int)(Console.WindowWidth * 0.6), (int)(Console.WindowHeight * 0.7));

            Dialog dialog = new Dialog(dialogPoint, dialogPoint2);

            dialog.AddSentences(dialogContent);
            dialog.Display();

            // Here prompting the player name
            Point     promptPoint = new Point((int)(Console.WindowWidth * 0.6), (int)(Console.WindowHeight * 0.5));
            PromptBox namePrompt  = new PromptBox(12, promptPoint, ':');
            string    playerName;

            bool sure = false;

            do
            {
                playerName = namePrompt.Prompt();
                namePrompt.Clear();
                dialog = new Dialog(dialogPoint, dialogPoint2);
                dialog.AddSentence(playerName + ", c'est vraiment ton nom ?");
                dialog.Display();

                TwoChoicesPromptBox nameChoiceSure = new TwoChoicesPromptBox(promptPoint);
                sure = nameChoiceSure.Prompt();
            } while (!sure);

            // Here the player name is definitely chosen
            Stats.Player.Name = playerName;

            dialog = new Dialog(dialogPoint, dialogPoint2);

            dialog.AddSentence("Eh bien " + playerName + " ravi de te rencontrer !");

            string secondSentence = (playerName.ToLower() == "tyrex")
                ? "Figure-toi que c'est mon nom aussi :)"
                : "Moi c'est Tyrex, mais je n'aime pas spécialement parler . . .";

            dialog.AddSentence(secondSentence);

            dialog.AddSentence("Mais laisse-moi te montrer un endroit génial !");
            dialog.Display();

            Stats.Player.ProgressLevel++;
        }