예제 #1
0
 public static void SetContext(IHostedGameState state, bool isLocal)
 {
     lock (SingletonLocker)
     {
         if (current == null)
             current = new GameStateEngine(state, isLocal);
     }
 }
예제 #2
0
 public static void SetContext(IHostedGameState state, bool isLocal)
 {
     lock (SingletonLocker)
     {
         if (current == null)
         {
             current = new GameStateEngine(state, isLocal);
         }
     }
 }
예제 #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()
            };

            return(ret);
        }
예제 #4
0
 public HostedGameEngine(IHostedGameState state)
 {
     State = (HostedGameState)state;
 }
예제 #5
0
 internal GameStateEngine(IHostedGameState state, bool isLocal)
 {
     State = (HostedGameState)state;
     IsLocal = isLocal;
 }
예제 #6
0
 internal GameStateEngine(IHostedGameState state, bool isLocal)
 {
     State   = (HostedGameState)state;
     IsLocal = isLocal;
     ApiKey  = ConfigurationManager.AppSettings["SiteApiKey"];
 }
예제 #7
0
 public HostedGameEngine(IHostedGameState state)
 {
     State = (HostedGameState)state;
 }
예제 #8
0
 public static HostedGameEngine Engine(this IHostedGameState state)
 {
     return(new HostedGameEngine(state));
 }
예제 #9
0
 internal GameStateEngine(IHostedGameState state, bool isLocal)
 {
     State = (HostedGameState)state;
     IsLocal = isLocal;
     ApiKey = ConfigurationManager.AppSettings["SiteApiKey"];
 }
예제 #10
0
 internal GameStateEngine(IHostedGameState state, bool isLocal)
 {
     State   = (HostedGameState)state;
     IsLocal = isLocal;
 }