public void StartGame() { Score = 0; UpdateScore(); var generatedCells = GenerateCells(); FillCells(generatedCells); _switchedCellPair = null; _cameraController.FitCameraSize(Rows, Columns); }
public CellPair[] GetCellPairs() { CellPair[] matrix = new CellPair[Size * Size]; ForEachCell((i, j, cell1) => { ForEachCell((x, y, cell2) => { int idx = cell1.ID * Size + cell2.ID; matrix[idx] = new CellPair() { PickupCell = cell1, DropoffCell = cell2, }; }); }); return(matrix); }
private void OnSwitchEnd(CellPair switchedCells) { var matchedCells = _cellManager.CheckCellsOnMatch(switchedCells.FirstCell, switchedCells.SecondCell); if (matchedCells.Length == 0) { switchedCells.Switch(); } else { CollectMatchedCells(matchedCells); } switchedCells.OnSwitchEnd -= OnSwitchEnd; _switchedCellPair = null; }
public void SetFreezePanes(int row, int col) { if (_headWriter.CurrentSection > StreamsheetParser.StreamSheetSection.SheetViews) { throw new FatalException(); } if (_stagedSheetView == null) { _stagedSheetView = new CT_SheetView(); } _stagedSheetView.Pane = new CT_Pane(); _stagedSheetView.Pane = new CT_Pane(); _stagedSheetView.Pane.State_Attr = ST_PaneState.frozen; _stagedSheetView.Pane.XSplit_Attr = col; _stagedSheetView.Pane.YSplit_Attr = row; _stagedSheetView.Pane.TopLeftCell_Attr = CellPair.Name(row, col); }
public ICellModel getCell(int col) { if (col >= 0 && col <= 16383) { ICellModel cellModel = default(ICellModel); if (this.CellsMap.TryGetValue(col, out cellModel)) { return(cellModel); } CT_Cell cT_Cell = new CT_Cell(); cT_Cell.R_Attr = CellPair.Name(this.RowNumber, col); cellModel = new XMLCellModel(this._worksheetModel, this._manager, cT_Cell); this.CellsMap.Add(col, cellModel); return(cellModel); } throw new FatalException(); }
public ICellModel getCell(int col) { if (col < 0 || col > 16383) { throw new FatalException(); } if (CellsMap.TryGetValue(col, out ICellModel value)) { return(value); } CT_Cell cT_Cell = new CT_Cell(); cT_Cell.R_Attr = CellPair.Name(RowNumber, col); value = new XMLCellModel(_worksheetModel, _manager, cT_Cell); CellsMap.Add(col, value); return(value); }
public static FreeShape createCorrShape(IXShape roomA, IXShape roomB, int corrWidth) { CellPair pair = roomA.shortestCellPair(roomB); List <Cell> line = GetLine(pair.cell1, pair.cell2); FreeShape corrAtoB = new FreeShape(); foreach (Cell each in line) { List <Cell> vCells = DrawCircle(each, corrWidth); //To avoid cell overlapping between rooms with corridor foreach (Cell vEach in vCells) { if (!roomA.hasCellAbsValue(vEach, XTile.FLOOR) && !roomB.hasCellAbsValue(vEach, XTile.FLOOR)) { corrAtoB.add(vEach); } } } return(corrAtoB); }
private void SwitchCells(Cell firstCell, Cell secondCell) { if (_switchedCellPair != null) { return; } CellPair switchedCells = new CellPair(firstCell, secondCell); if (switchedCells.IsNeighbors == false) { return; } switchedCells.OnSwitchEnd += OnSwitchEnd; bool isSwitchPass = switchedCells.Switch(); if (isSwitchPass) { _switchedCellPair = switchedCells; } }
public void MergeCells(int firstRow, int firstCol, int rowCount, int colCount) { AdvanceStreamsheetTo(StreamsheetParser.StreamSheetSection.MergeCells, head: false); CT_MergeCell cT_MergeCell = new CT_MergeCell(); cT_MergeCell._ref_Attr = string.Format(CultureInfo.InvariantCulture, "{0}:{1}", CellPair.Name(firstRow, firstCol), CellPair.Name(firstRow + rowCount - 1, firstCol + colCount - 1)); _tailWriter.WriteMergedCell(cT_MergeCell); }