/// <summary> /// Create new Game Session /// </summary> /// <returns></returns> public static GameMatch NewMatch(string gameId) { GameMatch newMatch; if (_RunningGames.TryGetValue(gameId, out newMatch) == true) { throw new InvalidOperationException("Game ID is not Unique"); } newMatch = new GameMatch() { GameId = gameId, }; _RunningGames.Add(gameId, newMatch); var hub = GlobalHost.ConnectionManager.GetHubContext <FailHub>(); hub.Clients.All.NewMatchCreated(GameMatch.AllOpenMatch().ToList()); return(newMatch); }
/// <summary> /// List all match that user can join /// </summary> /// <returns></returns> public List <GameMatch> ListMatch() { return(GameMatch.AllOpenMatch().ToList()); }