Exemple #1
0
        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);
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
        /// <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;
        }
Exemple #4
0
        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;
        }
Exemple #5
0
 internal GameStateEngine(IHostedGameState state, bool isLocal)
 {
     State = (HostedGameState)state;
     IsLocal = isLocal;
     ApiKey = ConfigurationManager.AppSettings["SiteApiKey"];
 }