Example #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     Memo.TimerTick();
     label2.Text = "Время: " + Memo.GetTime();
 }
Example #2
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Up)
            {
                if (!Memo.GetInvert())
                {
                    Movement.Check_Up();
                }
                else
                {
                    Movement.Check_Down();
                }
            }
            else if (e.KeyData == Keys.Down)
            {
                if (!Memo.GetInvert())
                {
                    Movement.Check_Down();
                }
                else
                {
                    Movement.Check_Up();
                }
            }
            else if (e.KeyData == Keys.Left)
            {
                if (!Memo.GetInvert())
                {
                    Movement.Check_Left();
                }
                else
                {
                    Movement.Check_right();
                }
            }
            else if (e.KeyData == Keys.Right)
            {
                if (!Memo.GetInvert())
                {
                    Movement.Check_right();
                }
                else
                {
                    Movement.Check_Left();
                }
            }

            label1.Text = "Ходы: " + Memo.GetTurns();

            MyLine();

            if (checkstate())
            {
                timer1.Stop();
                if (MessageBox.Show("Победа!!!\nСделано ходов: " + Memo.GetTurns() + "\nВремя: " + Memo.GetTime(),
                                    "Victory", MessageBoxButtons.RetryCancel) == DialogResult.Retry)
                {
                    Memo.randMem();
                    MyLine();
                    Memo.ResetTime();
                    Memo.ResetTurns();
                    label2.Text = "Время: " + Memo.GetTime();
                    label1.Text = "Ходы: " + Memo.GetTurns();
                    timer1.Start();
                }
                else
                {
                    Application.Exit();
                }
            }
        }
Example #3
0
 public Form1()
 {
     Memo.randMem();
     InitializeComponent();
 }