Beispiel #1
0
        private void ProcessSessionBegin(SessionBeginNotificationPacket obj)
        {
            // This form should not be enabled whilst a game is running
            //Enabled = false;

            var args = obj.SecureToken + " " + obj.RemoteEndpoint + " " + obj.SessionID;

            Process.Start("BlastersGame.exe", args);
        }
Beispiel #2
0
        private void Handler(SessionBeginNotificationPacket sessionBeginNotificationPacket)
        {
            var args = sessionBeginNotificationPacket.SecureToken + " " + sessionBeginNotificationPacket.RemoteEndpoint + " " + sessionBeginNotificationPacket.SessionID;

            var proc = Process.Start("BlastersGame.exe", args);

            proc.Exited += proc_Exited;


            FlowController.WebControl.Enabled = false;
        }
Beispiel #3
0
        private void CheckCompletion(GameSession gameSession)
        {
            if (!gameSession.IsFull || gameSession.InProgress)
            {
                return;
            }

            // We wait, and then tell everyone it's OK to enter again

            //Sessions.Remove(gameSession);

            gameSession.InProgress = true;

            // We generate a secure token for each user
            foreach (var cUser in gameSession.Users)
            {
                cUser.SecureToken = Guid.NewGuid();
                //TODO: Take this parameter from the client
                // We should also validate it's even legal as it comes from the client
                cUser.SessionConfig = new UserSessionConfig("FemaleSheet1");
            }

#if DEBUG_MOCK
            foreach (var cUser in gameSession.Users)
            {
                cUser.SecureToken = Guid.Empty;
            }
#endif

            var appServerService = (AppServerService)ServiceContainer.GetService(typeof(AppServerService));
            var server           = appServerService.GetAvailableServer();

            // Notify the app server
            var appServerNotifyPacket = new NotifySessionBeginAppServerPacket(gameSession);
            ClientNetworkManager.Instance.SendPacket(appServerNotifyPacket, server.Connection);

            var endpointInfo = server.Connection.RemoteEndpoint.ToString();

            //endpointInfo = "99.235.224.52:7798";

            // We generate a secure token for each user
            foreach (var cUser in gameSession.Users)
            {
                var packet = new SessionBeginNotificationPacket(cUser.SecureToken, endpointInfo,
                                                                gameSession.SessionID);
                ClientNetworkManager.Instance.SendPacket(packet, cUser.Connection);
            }


            Logger.Instance.Log(Level.Info, "The match " + gameSession + " is now underway.");
            Logger.Instance.Log(Level.Info, "The simulation is being completed on: " + server.Name);
        }