Ejemplo n.º 1
0
 public void FillField(int x, int y)
 {
     //Suspend();
     _fieldConfig.FieldFiller.FillField(this, x, y);
     Unsuspend();
     FieldFilled?.Invoke(this, null);
 }
Ejemplo n.º 2
0
        public static bool HandleClosesCells()
        {
            bool found = false;

            for (int i = 0; i < fieldSize; i++)
            {
                for (int j = 0; j < fieldSize; j++)
                {
                    if (vertDashes[i, j] != null && horDashes[i, j] != null &&
                        vertDashes[i + 1, j] != null && horDashes[i, j + 1] != null)
                    {
                        double halfLinesSpace = linesSpace / 2;
                        Cell   cell           = new Cell();
                        cell.Owner  = currentPlayer;
                        cell.Center = new Point(i * linesSpace + halfLinesSpace, j * linesSpace + halfLinesSpace);
                        bool dontCreate = false;
                        foreach (var c in cells)
                        {
                            if (c.IsEqualsLocation(cell))
                            {
                                dontCreate = true;
                            }
                        }
                        if (dontCreate)
                        {
                            continue;
                        }

                        found = true;
                        fieldGrid.Children.Add(cell.GetSignImage(linesSpace, linesWidth));
                        cells.Add(cell);

                        ScoreChanged?.Invoke(currentPlayer);

                        if (cells.Count == cellsCount)
                        {
                            FieldFilled?.Invoke();
                        }
                    }
                }
            }
            return(found);
        }
Ejemplo n.º 3
0
 // Запуск события заполненного поля
 private void StartFieldEvent()
 {
     FieldFilled.Invoke();
 }