public FourthStageData(ILobby lobby, string playerToken) { Stage = lobby.Stage; var players = lobby.Players; var currentPlayer = players.SingleOrDefault(player => player.Token.Equals(playerToken)); currentPlayer.Ready = true; MainCard = lobby.Players.SingleOrDefault(player => player.Token.Equals(lobby.MainPlayer)).Card; DonePlayers = new List <string>(); VoteResult = lobby.VoteResults; foreach (var player in players) { if (player.Ready) { DonePlayers.Add(player.Token); } } lobby.TryGoToNextStageAsync(); }
public FirstStageData(ILobby lobby, string playerToken) { Stage = lobby.Stage; DonePlayers = new List <string>(); var players = lobby.Players; var currentPlayer = players.SingleOrDefault(player => player.Token.Equals(playerToken)); if (!currentPlayer.Token.Equals(lobby.MainPlayer)) { currentPlayer.Ready = true; } Cards = players.SingleOrDefault(player => player.Token.Equals(playerToken)).Cards; Scores = lobby.Scores; foreach (var lobbyPlayer in lobby.Players) { if (lobbyPlayer.Ready) { DonePlayers.Add(lobbyPlayer.Token); } } MainPlayerToken = lobby.MainPlayer; AmountOfCards = lobby.AmountOfCards; lobby.TryGoToNextStageAsync(); }