Exemple #1
0
 public void RunOnce()
 {
     launchEvent.WaitOne();
     currentSession.Run();
     currentSession = new SessionImpl(gameId, Constants.SessionDuration);
     launchEvent.Reset();
     Interlocked.Exchange(ref gameRunning, 0);
 }
Exemple #2
0
        public SessionManager(Guid id, int port)
        {
            gameId         = id;
            gameRunning    = 0;
            rpcPort        = port;
            controller     = new SessionController(this);
            currentSession = new SessionImpl(gameId, Constants.SessionDuration);
            launchEvent    = new ManualResetEvent(false);

            GrpcEnvironment.Initialize();
            rpcServer = new Server();
            rpcServer.AddServiceDefinition(Controller.BindService(controller));
            rpcServer.AddListeningPort("localhost", rpcPort);
            rpcServer.Start();
        }