Beispiel #1
0
        public bool Undo()
        {
            if (PlaytimeLine.Count <= 0)
            {
                return(false);
            }
            playInfo oldPoint = PlaytimeLine.Pop();
            Button   btn      = Matrix[oldPoint.Point.Y][oldPoint.Point.X];

            btn.BackgroundImage = null;
            btn.Enabled         = true;
            xoaSinhNuocDi();
            if (!(PlaytimeLine.Count <= 0))
            {
                oldPoint = PlaytimeLine.Peek();
            }
            timViTri();
            return(true);
        }
Beispiel #2
0
        public void timViTri()  //tim vi tri quan ma, sau khi undo
        {
            playInfo oldPoint = PlaytimeLine.Peek();
            int      i        = 0;

            while (i < 8)
            {
                int ty = oldPoint.Point.X + dy[i];
                int tx = oldPoint.Point.Y + dx[i];
                if ((ty >= 0 && ty < N && tx >= 0 && tx < N && banCo[ty, tx] == 0) && (Matrix[tx][ty].BackgroundImage != quanMa))
                {
                    if (!(Matrix[tx][ty].BackgroundImage == quanMa_dadi))
                    {
                        Matrix[tx][ty].BackgroundImage = quanMa;
                        Matrix[tx][ty].Enabled         = true;
                    }
                }
                i++;
            }
        }