コード例 #1
0
ファイル: HomeController.cs プロジェクト: aqeelmozumder/triqa
        public JsonResult SendActiveCode([FromBody] ActiveGames activegames)
        {
            //activegames is a  new model class that is stored in the model folder

            GameData.Active_games.Add(activegames.Activegames.ToString());

            return(Json(new { GameData.Active_games }));
        }
コード例 #2
0
 public void MatchMaker()
 {
     _isActive = true;
     while (_isActive)
     {
         if (MatchmakingQueue.Count > 0)
         {
             Players.Add(new TempPlayer(this, Players.Count));
             MatchmakingQueue.Add(Players[Players.Count - 1]);
             ActiveGames.Add(new GameHandler(MatchmakingQueue[0], MatchmakingQueue[1], ActiveGames.Count + 1));
             MatchmakingQueue.RemoveAt(0);
             MatchmakingQueue.RemoveAt(0);
         }
     }
 }
コード例 #3
0
        public Guid?QueueForGame(Guid playerId)
        {
            var gameId = Queue.QueueForGame(playerId);

            // if game is found but is not started yet, start a game
            if (gameId != null)
            {
                if (!ActiveGames.ContainsKey(gameId.Value))
                {
                    var players = Queue.GetPlayerForGame(gameId.Value);
                    GameBLL.StartGame(gameId.Value, players[0], players[1]);
                    ActiveGames[gameId.Value] = new BoardGameState <TFigure>(gameId.Value, players[0], new TRules());
                }
            }
            return(gameId);
        }
コード例 #4
0
 public BattleShipHub(UnitOfWork unitOfWork, ActiveGames activeGames)
 {
     _unitOfWork  = unitOfWork;
     _activeGames = activeGames;
 }
コード例 #5
0
ファイル: HomeController.cs プロジェクト: aqeelmozumder/triqa
 public JsonResult GetActiveCode([FromBody] ActiveGames activegames)
 {
     return(Json(new { GameData.Active_games }));
 }
コード例 #6
0
 public GameHub(ActiveGames gameSessions)
 {
     _gameSessions = gameSessions;
 }