Beispiel #1
0
        private int _playerScore = 0;                         //Zusätliches Attribut

        public frmField()
        {
            InitializeComponent();

            _scoreListPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "scorelist.txt");

            _optionsForm   = new frmOptions();
            _editScoreForm = new frmEditScore(_scoreListPath);
            _scoreListForm = new frmScoreList(_scoreListPath);

            _boxList    = new List <Button>();
            _boxRatings = new Dictionary <Color, int>();

            _scoreListForm.RefreshScore();

            _optionsForm.VisibleChanged += BtnHideOptions_Click;
            SetupPlayField();
        }
Beispiel #2
0
        /// <summary>
        /// Stopped das Game und gibt bei negativem Punktestand
        /// 'Game Over!' aus. Bei positivem Punktestand wird
        /// eine Fanfare abgespielt und das Formular zur Eintragung
        /// geöffnet.
        /// </summary>
        public void StopGame()
        {
            tmrGame.Stop();
            if (_playerScore < 0)
            {
                ShowGameOverBox();
            }
            else
            {
                if (_playerScore > _scoreListForm.GetCurrentHighScore())
                {
                    using (SoundPlayer sp = new SoundPlayer(Properties.Resources.trumpet))
                    {
                        sp.Play();
                    }
                }

                _editScoreForm.SetScore(txtScore.Text);
                _editScoreForm.ShowDialog();
                _scoreListForm.RefreshScore();
            }

            _boxList[_lastFlippedButtonIndex].BackColor = _boxColor;
        }
Beispiel #3
0
 private void BtnScoreList_Click(object sender, EventArgs e)
 {
     _scoreList.RefreshScore();
     _scoreList.Show();
 }
Beispiel #4
0
 public void BtnScoreList_Click(object sender, EventArgs e)
 {
     _scoreList.RefreshScore();
     _scoreList.ShowDialog();
 }