コード例 #1
0
        private void StartGameButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(PlayerNameTextBox.Text))
            {
                Player     player = new Player(PlayerNameTextBox.Text);
                TriviaMenu game   = new TriviaMenu(player, this);

                Hide();
            }
        }
コード例 #2
0
        public TriviaMenu(Player player, PlayerCreation creator)
        {
            InitializeComponent();
            Instance = this;

            this.player          = player;
            this.creator         = creator;
            PlayerNameLabel.Text = player.Name;
            ScoreLabel.Text      = "Score: " + player.Score.ToString();

            Show();

            for (int i = 100; i <= 1000; i += 100)
            {
                if (i != 700 && i != 900)
                {
                    difficulties.Add((Difficulty)i, AddSpacesBeforeCapitalLetters(((Difficulty)i).ToString()));
                    DifficultyComboBox.Items.Add(difficulties.Values.ElementAt(difficulties.Count - 1));
                }
            }

            DifficultyComboBox.SelectedIndex = 0;
            NewQuestion();
        }
コード例 #3
0
 public void Reset(TriviaMenu game)
 {
     game.Close();
     PlayerNameTextBox.Text = string.Empty;
     Show();
 }