private void SimulatedGame_SessionEnded(SimulatedGameSession session, SessionEndStatistics e) { _removeQueue.Add(session); // Kill any event handler session.SessionEnded -= SimulatedGame_SessionEnded; // Alert the lobby server the match has ended var packet = new SessionEndedLobbyPacket(session.Session.SessionID, e); LobbyServerNetworkManager.Instance.SendPacket(packet); Logger.Instance.Log(Level.Info, "Session " + session.Session.SessionID + ":" + " Completed a simulation job on this application server."); // Remove from the router table and notify game is over foreach (var user in session.Session.Users) { if (user.Connection != null) { _routingTable.Remove(user.Connection); } else { return; } // Send the packet var userPacket = new SessionEndedLobbyPacket(session.Session.SessionID, e); ClientNetworkManager.Instance.SendPacket(userPacket, user.Connection); } }
private void ProccessIncomingSession(NotifySessionBeginAppServerPacket obj) { var simulatedGame = new SimulatedGameSession(obj.Session); ActiveGameSessions.Add(simulatedGame); _routingTable.Remove(obj.Sender); // Log the event that this session begun Logger.Instance.Log(Level.Info, "Session " + simulatedGame.Session.SessionID + ":" + " Started a simulation job on this application server."); simulatedGame.SessionEnded += SimulatedGame_SessionEnded; }