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 ProcessSessionEnded(SessionEndedLobbyPacket obj) { var gameSession = new GameSession(); // Find the item for (int index = 0; index < Sessions.Count; index++) { gameSession = Sessions[index]; if (gameSession.SessionID == obj.SessionID) { gameSession.InProgress = false; break; } } Logger.Instance.Log(Level.Info, "The match " + gameSession + " has completed a round. "); Logger.Instance.Log(Level.Info, "The winner was " + obj.SessionStatistics.Winner.Name + "; lasting " + obj.SessionStatistics.MatchDuration + "s."); Thread.Sleep(1500); // See if we should play again gameSession.InProgress = false; CheckCompletion(gameSession); }
private void Instance_ClientDisconnected(SessionEndedLobbyPacket obj) { Process.GetCurrentProcess().Kill(); }
private void Handler(SessionEndedLobbyPacket sessionEndedLobbyPacket) { //MessageBox.Show("The winner was " + sessionEndedLobbyPacket.SessionStatistics.Winner); }