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); } } }
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(); }
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); } } }