コード例 #1
0
 private void frmScores_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (btnAdd.Enabled)
     {
         HighScoreList.add(new HighScores(txtName.Text, curScore, coinsAdded, difficulty));
     }
     GTools.saveHighScores(GTools.saveFile);
 }
コード例 #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     HighScoreList.add(new HighScores(txtName.Text, curScore, coinsAdded, difficulty));
     txtName.Enabled = false;
     btnAdd.Enabled  = false;
     dgvInit();
     this.Close();
 }
コード例 #3
0
        private void checkForLose()
        {
            List <Point> mergedList = new List <Point>();

            mergedList = RedGhost.core().Union(BlueGhost.core()).Union(PinkGhost.core()).Union(YellowGhost.core()).ToList();

            List <Point> commonPoints = Pacman.core().Intersect(mergedList.Select(u => u)).ToList();

            if (((commonPoints.Count != 0 && !Bonus)))
            {
                State = GameState.GAMEWAIT;
                parentForm.playSound(Properties.Resources.Pacman_Dies);
                AIFlagInit();
                AIClockCounter = 0;
                Bonus          = false;
                WaitSomeTime(1500);
                while (wait)
                {
                }
                wait = true;
                lives--;
                sendMsg();
                board.addPacmanToPanel(lives, pnlInfo);
                RedGhost.reset(stage);
                BlueGhost.reset(stage);
                PinkGhost.reset(stage);
                YellowGhost.reset(stage);
                if (lives <= 0)
                {
                    WaitSomeTime(1000);
                    while (wait)
                    {
                    }
                    wait = true;
                    if (score > HighScoreList.min() || HighScoreList.hsList.Count < 10)
                    {
                        parentForm.AddHighScore(score, coins, switchDifficulty());
                    }
                }
                else
                {
                    Pacman.reset(stage); SetGameRun(1500);
                }
            }
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: Mihqas/PacmanWinForms
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (lstvDifficulty.SelectedItems.Count > 0)
            {
                difficulty = lstvDifficulty.SelectedItems[0].Index;
            }
            if (lstvAlgorithm.SelectedItems.Count > 0)
            {
                algorith = lstvAlgorithm.SelectedItems[0].Index;
            }
            pacmanDelay = (int)nmrPacmanDelay.Value;
            ghostDelay  = (int)nmrGhostDelay.Value;
            this.Hide();
            frmPacmanGame form = new frmPacmanGame(this, difficulty, algorith, pacmanDelay, ghostDelay, HighScoreList.max());

            form.StartPosition = FormStartPosition.CenterScreen;
            form.Height        = Screen.PrimaryScreen.Bounds.Height;
            form.Show();
        }