public static IHostedGameState ToHostedGameState(this HostedGameSASModel model, EnumHostedGameStatus status = EnumHostedGameStatus.Unknown) { var ret = new HostedGameState { GameId = model.GameId, GameName = model.GameName, GameVersion = model.GameVersion, HasPassword = model.HasPassword, HostUserName = model.HostUserName, Id = model.Id, Name = model.Name, Password = model.Password, HostUri = model.HostUri, Status = status, TwoSidedTable = model.TwoSidedTable, CurrentTurnPlayer = 0, Players = new List <HostedGamePlayer>() }; return(ret); }
/// <summary> /// Gets rid of sensitive data the user doesn't need to have. /// </summary> /// <param name="state">Game state</param> /// <returns>Censored Game State</returns> public static IHostedGameState ForUser(this IHostedGameState state) { var ret = new HostedGameState { GameId = state.GameId, GameName = state.GameName, GameVersion = state.GameVersion, HasPassword = state.HasPassword, HostUserName = state.HostUserName, Id = state.Id, Name = state.Name, Password = null, HostUri = state.HostUri, Status = state.Status, TwoSidedTable = state.TwoSidedTable, CurrentTurnPlayer = state.CurrentTurnPlayer, Players = state.Players.Select(x => x.ForUser()).ToList() }; return(ret); }
/// <summary> /// Gets rid of sensitive data the user doesn't need to have. /// </summary> /// <param name="state">Game state</param> /// <returns>Censored Game State</returns> public static IHostedGameState ForUser(this IHostedGameState state) { var ret = new HostedGameState { GameId = state.GameId, GameName = state.GameName, GameVersion = state.GameVersion, HasPassword = state.HasPassword, HostUserName = state.HostUserName, Id = state.Id, Name = state.Name, Password = null, HostUri = state.HostUri, Status = state.Status, TwoSidedTable = state.TwoSidedTable, CurrentTurnPlayer = state.CurrentTurnPlayer, Players = state.Players.Select(x=>x.ForUser()).ToList(), Spectators = state.Spectators, GameIconUrl = state.GameIconUrl, HostUserIconUrl = state.HostUserIconUrl }; return ret; }
public static IHostedGameState ToHostedGameState(this HostedGameSASModel model, EnumHostedGameStatus status = EnumHostedGameStatus.Unknown) { var ret = new HostedGameState { GameId = model.GameId, GameName = model.GameName, GameVersion = model.GameVersion, HasPassword = model.HasPassword, HostUserName = model.HostUserName, Id = model.Id, Name = model.Name, Password = model.Password, HostUri = model.HostUri, Status = status, TwoSidedTable = model.TwoSidedTable, CurrentTurnPlayer = 0, Players = new List<HostedGamePlayer>(), Spectators = model.Spectators, HostUserIconUrl = model.HostUserIconUrl, GameIconUrl = model.GameIconUrl }; return ret; }
internal GameStateEngine(IHostedGameState state, bool isLocal) { State = (HostedGameState)state; IsLocal = isLocal; ApiKey = ConfigurationManager.AppSettings["SiteApiKey"]; }