Esempio n. 1
0
        public void Visit(GameboardHandler handler)
        {
            Field examinedField = handler.Gameboard.GetFieldAtPosition(showAtPos);

            if (examinedField != null)
            {
                if (examinedField.HasFlag || examinedField.ShowNumber)
                {
                    return;
                }
                else if (examinedField.HasMine)
                {
                    examinedField.ShowNumber = true;
                    return;
                }
                else if (examinedField.Minenumber > 0)
                {
                    examinedField.ShowNumber = true;
                }
                else
                {
                    examinedField.ShowNumber = true;

                    Position originPosition = new Position(examinedField.Position.Left - 1, examinedField.Position.Top - 1);
                    for (int y = 0; y < 3; y++)
                    {
                        for (int x = 0; x < 3; x++)
                        {
                            DiscoverFieldCommand gamecommand = new DiscoverFieldCommand(originPosition.Left + x, originPosition.Top + y);
                            gamecommand.Visit(handler);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 public void Visit(GameboardHandler handler)
 {
     if (this.moveToPos.Left >= 0 && this.moveToPos.Top >= 0)
     {
         if (this.moveToPos.Left < handler.Gameboard.Width && this.moveToPos.Top < handler.Gameboard.Height)
         {
             handler.Cursor.Position = this.moveToPos;
         }
     }
 }
 public void Visit(GameboardHandler handler)
 {
     if (handler.IsCheatModeOn)
     {
         handler.IsCheatModeOn = false;
     }
     else if (!handler.IsCheatModeOn)
     {
         handler.IsCheatModeOn = true;
     }
 }
Esempio n. 4
0
        public void Visit(GameboardHandler handler)
        {
            Field examinedField = handler.Gameboard.GetFieldAtPosition(flagOnPos);

            if (!examinedField.ShowNumber)
            {
                if (examinedField.HasFlag)
                {
                    examinedField.HasFlag = false;
                }
                else
                {
                    examinedField.HasFlag = true;
                }
            }
        }