public UpdateViewEvent(Dictionary<PlayerIdEnum, Dictionary<GameInfoTypeEnum, String>> GameInfo, Dictionary<PlayerIdEnum, List<Tile>> HeldCharacters, List<Cell> BoardCells, PlayerIdEnum CurrentPlayer) { this._GameInfo = GameInfo; this._HeldCharacters = HeldCharacters; this._BoardCells = BoardCells; this._CurrentPlayer = CurrentPlayer; }
public Tuple<bool, bool> GetPlayerInfo(PlayerIdEnum PlayerId) { bool ShouldAddPlayer; bool IsComputer; ShouldAddPlayerDictionary.TryGetValue(PlayerId, out ShouldAddPlayer); IsComputerPlayer.TryGetValue(PlayerId, out IsComputer); return new Tuple<bool, bool>(ShouldAddPlayer, IsComputer); }
public static String GetStringByPlayerIdEnum(PlayerIdEnum playerIdEnum) { switch (playerIdEnum) { case PlayerIdEnum.FIRST_PLAYER: return FIRST_PLAYER; case PlayerIdEnum.SECOND_PLAYER: return SECOND_PLAYER; case PlayerIdEnum.THIRD_PLAYER: return THIRD_PLAYER; case PlayerIdEnum.FOURTH_PLAYER: return FOURTH_PLAYER; } return ""; }
public void UpdateForm(UpdateViewEvent UpdateViewEvent) { foreach (Cell boardCell in UpdateViewEvent.BoardCells) { Coordinates coordinates = new Coordinates(boardCell.GetXColumnCoordinate(), boardCell.GetYRowCoordinate()); CellValues.Remove(coordinates); CellValues.Add(coordinates, boardCell); if (boardCell.GetTile() != null) { boardGridView[boardCell.GetXColumnCoordinate(), boardCell.GetYRowCoordinate()].Value = boardCell.GetTile().GetLetter().ToString().ToUpper(); } else { boardGridView[boardCell.GetXColumnCoordinate(), boardCell.GetYRowCoordinate()].Value = ""; } } for (int i = 0; i < 7; ++i) { FirstHeldCharactersDataGrid[i, FIRST_INDEX].Value = ""; SecondHeldCharactersDataGrid[i, FIRST_INDEX].Value = ""; FirstHeldCharactersDataGrid[i +8, FIRST_INDEX].Value = ""; SecondHeldCharactersDataGrid[i+8, FIRST_INDEX].Value = ""; } _GameInfo.Clear(); _GameInfo = UpdateViewEvent.GameInfo; heldCharacters = UpdateViewEvent.HeldCharacters; _CurrentPlayer = UpdateViewEvent.CurrentPlayer; AddAllHeldCharacters(); InitFormHelper.UpdateGameInfoBoard(GameInfoDataGrid, _GameInfo); UpdateHeldCharactersLabels(); Invalidate(); Update(); }