public GridCell Setup_RequiresGrid(NavdiGrid grid, twin cellPos) { base.Setup(); this.grid = grid; this.SetCellPos(cellPos); // this.SetValue(0); return(this); }
public AuthorState_EditPalette() : base() { Add(paletteGrid = new NavdiGrid(new GridOptions( name: "authorstate_editpalette_grid", entityBank: xxi.authorCellBank, size_cellsInGrid: xxi.options.size_palette, size_pixelsPerCell: xxi.options.size_gridScreen / xxi.options.size_palette ))); Add(cursors = new Ents <AuthorCursor>(1)); }
void PasteCol(ushort[] edgeData, int col, NavdiGrid grid) { if (col < 0) { col = grid.options.size_cellsInGrid.x + col; } for (int y = 0; y < edgeData.Length; y++) { grid.GetCell(col, y).SetValue(edgeData[y]); } }
void PasteRow(ushort[] edgeData, int row, NavdiGrid grid) { if (row < 0) { row = grid.options.size_cellsInGrid.y + row; } for (int x = 0; x < edgeData.Length; x++) { grid.GetCell(x, row).SetValue(edgeData[x]); } }
public AuthorState_Edit() : base() { Add(editGrid = new NavdiGrid(new GridOptions( name: "authorstate_edit_grid", entityBank: xxi.authorCellBank, size_cellsInGrid: new twin(xxi.options.size_gridScreen / xxi.options.size_pixelsInCell), size_pixelsPerCell: new twin(xxi.options.size_pixelsInCell) ))); cursorPositions = null; Add(cursors = new Ents <AuthorCursor>()); }
public void SaveRoom(NavdiGrid grid) { this.currentRoomGridString = grid.ExportString("" + options.separator_grid_cells); File.CreateFolderIfDoesNotExist( File.CombinedPath(Application.streamingAssetsPath, roomsFolderName) ); File.WriteFile( File.CombinedPath(Application.streamingAssetsPath, roomsFolderName, this.GetRoomCoordString(this.currentRoomCoord)), this.currentRoomGridString ); }
//// PUBLIC: 'CURRENT ROOM' functions public void SetRoomCoord(twin roomCoord, NavdiGrid grid) { if (grid != null) { SaveRoom(grid); } this.currentRoomCoord = roomCoord; if (grid != null) { LoadRoom(grid); } }
ushort[] CopyCol(int col, NavdiGrid grid) { if (col < 0) { col = grid.options.size_cellsInGrid.x + col; } ushort[] edge = new ushort[grid.options.size_cellsInGrid.y]; for (int y = 0; y < edge.Length; y++) { edge[y] = grid.GetCell(col, y).value; } return(edge); }
ushort[] CopyRow(int row, NavdiGrid grid) { if (row < 0) { row = grid.options.size_cellsInGrid.y + row; } ushort[] edge = new ushort[grid.options.size_cellsInGrid.x]; for (int x = 0; x < edge.Length; x++) { edge[x] = grid.GetCell(x, row).value; } return(edge); }
void PasteGridsEdge(ushort[] edgeData, twin dirEdge, NavdiGrid grid) { if ((dirEdge.x == 0) == (dirEdge.y == 0)) { return; } bool pasteColumn = (dirEdge.x != 0); if (pasteColumn) { PasteCol(edgeData, dirEdge.x < 0?0:-1, grid); } else { PasteRow(edgeData, dirEdge.y < 0?0:-1, grid); } }
public void LoadRoom(NavdiGrid grid) { File.CreateFolderIfDoesNotExist( File.CombinedPath(Application.streamingAssetsPath, roomsFolderName) ); string levelPath = File.CombinedPath(Application.streamingAssetsPath, roomsFolderName, this.GetRoomCoordString(this.currentRoomCoord)); if (File.DoesFileExist(levelPath)) { this.currentRoomGridString = File.ReadFile(levelPath); grid.ImportString(this.currentRoomGridString, options.separator_grid_cells); } else { grid.DoEach((cell) => { cell.SetValue(0); }); } }
//// COPY/PASTE FUNCTIONS ushort[] CopyGridsEdge(twin dirEdge, NavdiGrid grid) { if ((dirEdge.x == 0) == (dirEdge.y == 0)) { return(null); } bool copyColumn = (dirEdge.x != 0); ushort[] edge; if (copyColumn) { edge = CopyCol(dirEdge.x < 0?0:-1, grid); } else { edge = CopyRow(dirEdge.y < 0?0:-1, grid); } return(edge); }