public void UpdateUI(TTBoard board) { for (int row = 0; row < board.Height; row++) { for (int col = 0; col < board.Width; col++) { slotUIs[row, col].UpdateUI(board.GetCardAt(row, col)); } } }
public void ApplyRuleOnMove(TTBoard board, int movedPlayerId, int indexOfRow, int indexOfColumn) { TTCard movedCard = board.GetCardAt(indexOfRow, indexOfColumn); foreach (Direction direction in System.Enum.GetValues(typeof(Direction))) { TTCard adjacentCard = board.GetCardAt(indexOfRow, indexOfColumn, direction); if (adjacentCard != null && (adjacentCard.belongPlayerId != movedPlayerId)) { int movedCardRank = movedCard.GetRankOf(direction); int adjacentCardRank = adjacentCard.GetOppositeRankOf(direction); bool canTurnCard = CompareRank(movedCardRank, adjacentCardRank) > 0; if (canTurnCard) { adjacentCard.belongPlayerId = movedPlayerId; } } } }