/// <summary> /// Create a new cell with its CellUI. /// </summary> public Cell() { m_IsEmpty = true; m_IsRed = false; m_IsYellow = false; m_CellUI = new CellUI(); }
private void showAttackRange(int x, int y) { _currentFSType = FSType.Attack; for (int i = -4; i < 5; i++) { if (i != 0 && x + i >= 0 && x + i < AppConstants.CellRowCount) { PlayerController p = getPlayerByXY(x + i, y); if (p != null && p.tag.Equals(_currentPlayer.tag)) { continue; } CellUI cell = activeCell(); cell.SetData(x + i, y, StateType.Normal, GetPositionByIndex(x + i, y)); } } for (int j = -4; j < 5; j++) { if (j != 0 && y + j >= 0 && y + j < AppConstants.CellColumnCount) { PlayerController p = getPlayerByXY(x, y + j); if (p != null && p.tag.Equals(_currentPlayer.tag)) { continue; } CellUI cell = activeCell(); cell.SetData(x, y + j, StateType.Normal, GetPositionByIndex(x, y + j)); } } }
private void _structGridView_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) { if (_structGridView.SelectedRows.Count > 0) { StructCell cell = (StructCell)_structGridView.SelectedRows[0].DataBoundItem; CellUI ui = CellUIRegistry.GetUI(cell); if (ui != null) { ui.ContextMenuStripNeeded(e); } else { e.ContextMenuStrip = contextMenuStrip1; } } }
private CellUI activeCell() { CellUI cell = null; if (_unusingList.Count > 0) { cell = _unusingList[0]; cell.gameObject.SetActive(true); _unusingList.RemoveAt(0); _usingList.Add(cell); } else { cell = Instantiate(cellPrefab).GetComponent <CellUI>(); cell.transform.SetParent(parent); cell.onClickCallback = this.cellClick; _usingList.Add(cell); } return(cell); }
private void showWakableRange(int x, int y) { _currentFSType = FSType.Walk; int xP = 0; int yP = 0; for (int i = -4; i < 5; i++) { for (int j = -4; j < 5; j++) { if (i + j > 4 || i + j < -4 || i - j > 4 || i - j < -4) { continue; } xP = x + i; yP = y + j; if (xP < 0 || xP >= AppConstants.CellRowCount || yP < 0 || yP >= AppConstants.CellColumnCount) { continue; } else if (xP == x && yP == y) { continue; } else if (getPlayerByXY(xP, yP) != null) { continue; } else { CellUI cell = activeCell(); cell.SetData(xP, yP, StateType.Normal, GetPositionByIndex(xP, yP)); } } } }