public void FillField(int x, int y) { //Suspend(); _fieldConfig.FieldFiller.FillField(this, x, y); Unsuspend(); FieldFilled?.Invoke(this, null); }
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); }
// Запуск события заполненного поля private void StartFieldEvent() { FieldFilled.Invoke(); }