Пример #1
0
        private void toolPrev_Click(object sender, EventArgs e)
        {
            if (Step >= OperateList.Count - 1)
            {
                MessageBox.Show("End");
                return;
            }

            Step++;

            Operate oper = OperateList[Step];

            switch (oper.Direct)
            {
            case LEFT: Soko.Left(); break;

            case RIGHT: Soko.Right(); break;

            case UP: Soko.Up(); break;

            case DOWN: Soko.Down(); break;

            default: break;
            }

            ReDraw();
        }
Пример #2
0
        private void frmMain_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Left)
            {
                if (Soko.Left())
                {
                    PlayMoveSound();
                    ReDraw(Soko.ManLocation);
                    CheckSuccess();
                }
            }
            if (e.KeyCode == Keys.Right)
            {
                if (Soko.Right())
                {
                    PlayMoveSound();
                    ReDraw(Soko.ManLocation);
                    CheckSuccess();
                }
            }
            if (e.KeyCode == Keys.Up)
            {
                if (Soko.Up())
                {
                    PlayMoveSound();
                    ReDraw(Soko.ManLocation);
                    CheckSuccess();
                }
            }
            if (e.KeyCode == Keys.Down)
            {
                if (Soko.Down())
                {
                    PlayMoveSound();
                    ReDraw(Soko.ManLocation);
                    CheckSuccess();
                }
            }

            if (e.KeyCode == Keys.Space)
            {
                this.toolGoBack_Click(null, null);
            }

            if (e.KeyCode == Keys.Escape)
            {
                this.toolResetMap_Click(null, null);
            }

            if (Soko.GetRoadStackCount() > 0)
            {
                this.toolGoBack.Enabled = true;
            }
        }