Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Submid Draw Command
 /// </summary>
 /// <param name="gameId"></param>
 public void SubmitVote(string gameId, int index)
 {
     GameMatch.ById(gameId).SubmitVote(index);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Submid Draw Command
 /// </summary>
 /// <param name="gameId"></param>
 public void SubmitDrawCommand(string gameId, dynamic command)
 {
     GameMatch.ById(gameId).SubmitDrawCommand(command, this.Context);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// List all match that user can join
 /// </summary>
 /// <returns></returns>
 public List <GameMatch> ListMatch()
 {
     return(GameMatch.AllOpenMatch().ToList());
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Join Game
 /// </summary>
 /// <param name="gameId"></param>
 /// <param name="playername"></param>
 /// <returns>True if player is the last player in the team - cannot draw only vote</returns>
 public void JoinMatch(string gameId, int team, dynamic playerInfo)
 {
     GameMatch.ById(gameId).Join(team, playerInfo, this.Context);
 }
Ejemplo n.º 6
0
        public string CreateMatch(string gameName)
        {
            var newMatch = GameMatch.NewMatch(gameName);

            return(newMatch.GameId);
        }