Пример #1
0
 public void SendNotification()
 {
     foreach (LobbyPlayerInfo playerInfo in TeamInfo.TeamPlayerInfo)
     {
         if (!playerInfo.IsNPCBot)
         {
             LobbyServerConnection player        = LobbyServer.GetPlayerByAccountId(playerInfo.AccountId);
             LobbyTeamInfo         teamInfoClone = TeamInfo.Clone();
             foreach (LobbyPlayerInfo pi in teamInfoClone.TeamPlayerInfo)
             {
                 if (pi.PlayerId == playerInfo.PlayerId)
                 {
                     pi.ControllingPlayerId = 0;
                 }
             }
             LobbyPlayerInfo playerInfoClone = playerInfo.Clone();
             playerInfoClone.ControllingPlayerId = 0;
             //Log.Print(LogType.Debug, $"Sending notification to {Players[i]}");
             GameInfoNotification gameInfoNotification = new GameInfoNotification()
             {
                 GameInfo   = GameInfo,
                 PlayerInfo = playerInfoClone,
                 TeamInfo   = teamInfoClone
             };
             _ = player.SendMessage(gameInfoNotification);
         }
     }
 }
Пример #2
0
        private void StartGame(PendingGame game)
        {
            game.GameInfo.GameServerProcessCode = "LobbyQueueManager.StartGame";
            foreach (LobbyPlayerInfo playerInfo in game.TeamInfo.TeamPlayerInfo)
            {
                if (!playerInfo.IsNPCBot)
                {
                    LobbyServerConnection      player          = LobbyServer.GetPlayerByAccountId(playerInfo.AccountId);
                    GameAssignmentNotification assNotification = new GameAssignmentNotification
                    {
                        GameInfo          = game.GameInfo,
                        GameResult        = GameResult.NoResult,
                        GameplayOverrides = DummyLobbyData.CreateLobbyGameplayOverrides(),
                        PlayerInfo        = player.GetLobbyPlayerInfo().Clone(),
                        Reconnection      = false,
                        Observer          = false
                    };
                    assNotification.PlayerInfo.ControllingPlayerId = 0;
                    player.SendMessage(assNotification);;
                }
            }
            game.GameStatus = GameStatus.Launching; // Put in wait state until game server starts
            game.SendNotification();

            new Task(() => {
                //GameManagerHolder.CreateGameManager(game.GameInfo, game.TeamInfo, game.PlayerSessionTokens); // Launch new game
                game.GameStatus = GameStatus.Launched; // Put in wait state until game server starts
                game.SendNotification();

                PendingGames.Remove(game);
            }).Start();
        }
Пример #3
0
 public PendingGame(LobbyGameInfo gameInfo, LobbyTeamInfo teamInfo)
 {
     GameInfo            = gameInfo;
     TeamInfo            = teamInfo;
     PlayerSessionTokens = new List <long>();
     foreach (LobbyPlayerInfo playerInfo in TeamInfo.TeamPlayerInfo)
     {
         if (!playerInfo.IsNPCBot)
         {
             LobbyServerConnection player = LobbyServer.GetPlayerByAccountId(playerInfo.AccountId);
             PlayerSessionTokens.Add(player.SessionToken);
         }
     }
 }