public static void SetContext(IHostedGameState state, bool isLocal) { lock (SingletonLocker) { if (current == null) current = new GameStateEngine(state, isLocal); } }
public static void SetContext(IHostedGameState state, bool isLocal) { lock (SingletonLocker) { if (current == null) { current = new GameStateEngine(state, isLocal); } } }
/// <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); }
public HostedGameEngine(IHostedGameState state) { State = (HostedGameState)state; }
internal GameStateEngine(IHostedGameState state, bool isLocal) { State = (HostedGameState)state; IsLocal = isLocal; }
internal GameStateEngine(IHostedGameState state, bool isLocal) { State = (HostedGameState)state; IsLocal = isLocal; ApiKey = ConfigurationManager.AppSettings["SiteApiKey"]; }
public static HostedGameEngine Engine(this IHostedGameState state) { return(new HostedGameEngine(state)); }