public DataMessage(Messages.Data data) : base(data.playerId) { Tasks = data.TaskFields?.Select(q => new GameObjects.TaskField(q)).ToArray(); Goals = data.GoalFields?.Select(q => new GameObjects.GoalField(q)).ToArray(); GameFinished = data.gameFinished; PlayerGUID = data.playerGuid; PlayerLocation = data.PlayerLocation != null ? new GameObjects.Location(data.PlayerLocation) : null; Pieces = data.Pieces?.Select(q => new GameObjects.Piece(q)).ToArray(); }
public GameMessage(Game game) : base(game) { Players = game.Players?.Select(q => new GameObjects.Player(q)).ToArray(); Board = new GameObjects.GameBoard((int)game.Board.width, (int)game.Board.tasksHeight, (int)game.Board.goalsHeight); PlayerLocation = new GameObjects.Location(game.PlayerLocation); }