コード例 #1
0
        private void статистикаF4ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form3 subForm = new Form3(this);

            subForm.ShowDialog();
        }
コード例 #2
0
        private void game_over(int x, int y)
        {
            int l = 0;

            if (rows == 9 && columns == 9 && numberMines == 10)
            {
                l = 1;
            }
            else if (rows == 16 && columns == 16 && numberMines == 40)
            {
                l = 2;
            }
            else if (rows == 16 && columns == 30 && numberMines == 99)
            {
                l = 3;
            }
            else
            {
                l = 0;
            }
            int t;

            go = 1;
            tt = 0;
            timer1.Stop();
            TextReader tr1  = new StreamReader("played" + l.ToString() + ".txt");
            int        num1 = Convert.ToInt32(tr1.ReadLine());
            int        num2 = Convert.ToInt32(tr1.ReadLine());

            tr1.Close();
            if (x == 0 && y == 0)
            {
                TextWriter tw = new StreamWriter("played" + l.ToString() + ".txt");
                tw.WriteLine((num1 + 1).ToString());
                tw.WriteLine(num2.ToString());
                tw.Close();
            }
            else
            {
                TextWriter tw = new StreamWriter("played" + l.ToString() + ".txt");
                tw.WriteLine(num1.ToString());
                tw.WriteLine((num2 + 1).ToString());
                tw.Close();
            }
            for (int i = 1; i <= rows; i++)
            {
                for (int j = 1; j <= columns; j++)
                {
                    if (a[i, j] == -1)
                    {
                        if (i == x && j == y)
                        {
                            b[i, j].ForeColor = System.Drawing.Color.Red;
                        }
                        t = (i - 1) * columns + j; b[i, j].Text = "☼"; this.Controls.RemoveByKey("b" + t.ToString()); this.Controls.Add(b[i, j]);
                    }
                }
            }
            if (brn == numberMines)
            {
                if (l != 0)
                {
                    TextReader tr = new StreamReader("highscores" + l.ToString() + ".txt");
                    tr.ReadLine();
                    tr.ReadLine();
                    tr.ReadLine();
                    tr.ReadLine();
                    tr.ReadLine();
                    tr.ReadLine();
                    tr.ReadLine();
                    tr.ReadLine();
                    tr.ReadLine();
                    string s = tr.ReadLine();
                    tr.Close();
                    if (Convert.ToInt32(s) > Convert.ToInt32(label1.Text))
                    {
                        write = l; Form3 subForm = new Form3(this); subForm.ShowDialog();
                    }
                }
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: ddakev/MineSweeper
 private void game_over(int x, int y)
 {
     int l = 0;
     if (rows == 9 && columns == 9 && numberMines == 10) { l = 1; }
     else if (rows == 16 && columns == 16 && numberMines == 40) { l = 2; }
     else if (rows == 16 && columns == 30 && numberMines == 99) { l = 3; }
     else l = 0;
     int t;
     go = 1;
     tt = 0;
     timer1.Stop();
     TextReader tr1 = new StreamReader("played" + l.ToString() + ".txt");
     int num1 = Convert.ToInt32(tr1.ReadLine());
     int num2 = Convert.ToInt32(tr1.ReadLine());
     tr1.Close();
     if (x == 0 && y == 0)
     {
         TextWriter tw = new StreamWriter("played" + l.ToString() + ".txt");
         tw.WriteLine((num1 + 1).ToString());
         tw.WriteLine(num2.ToString());
         tw.Close();
     }
     else
     {
         TextWriter tw = new StreamWriter("played" + l.ToString() + ".txt");
         tw.WriteLine(num1.ToString());
         tw.WriteLine((num2 + 1).ToString());
         tw.Close();
     }
     for (int i = 1; i <= rows; i++)
     {
         for (int j = 1; j <= columns; j++)
         {
             if (a[i, j] == -1) { if (i == x && j == y) b[i, j].ForeColor = System.Drawing.Color.Red; t = (i - 1) * columns + j; b[i, j].Text = "☼"; this.Controls.RemoveByKey("b" + t.ToString()); this.Controls.Add(b[i, j]); }
         }
     }
     if (brn == numberMines)
     {
         if (l != 0)
         {
             TextReader tr = new StreamReader("highscores" + l.ToString() + ".txt");
             tr.ReadLine();
             tr.ReadLine();
             tr.ReadLine();
             tr.ReadLine();
             tr.ReadLine();
             tr.ReadLine();
             tr.ReadLine();
             tr.ReadLine();
             tr.ReadLine();
             string s = tr.ReadLine();
             tr.Close();
             if (Convert.ToInt32(s) > Convert.ToInt32(label1.Text)) { write = l; Form3 subForm = new Form3(this); subForm.ShowDialog(); }
         }
     }
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: ddakev/MineSweeper
 private void статистикаF4ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form3 subForm = new Form3(this);
     subForm.ShowDialog();
 }
コード例 #5
0
ファイル: Form1.cs プロジェクト: ddakev/MineSweeper
 public void f_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F2) new_game();
     else if (e.KeyCode == Keys.Escape) this.Close();
     else if (e.KeyCode == Keys.F3) { Form2 subForm = new Form2(this); subForm.ShowDialog(); }
     else if (e.KeyCode == Keys.F4) { Form3 subForm = new Form3(this); subForm.ShowDialog(); }
     else if (e.KeyCode == Keys.F1) { Form4 subForm = new Form4(this); subForm.ShowDialog(); }
 }