Exemplo n.º 1
0
        public GameApplication(string applicationId, LoadBalancer <IncomingGameServerPeer> loadBalancer)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("Creating application: appId={0}", applicationId);
            }

            this.ApplicationId     = applicationId;
            this.LoadBalancer      = loadBalancer;
            this.PlayerOnlineCache = new PlayerCache();
            this.LobbyFactory      = new LobbyFactory(this);
        }
Exemplo n.º 2
0
        public GameApplication(string applicationId, LoadBalancer<IncomingGameServerPeer> loadBalancer)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("Creating application: appId={0}", applicationId);
            }

            this.ApplicationId = applicationId;
            this.LoadBalancer = loadBalancer;
            this.PlayerOnlineCache = new PlayerCache();
            this.LobbyFactory = new LobbyFactory(this);        
        }
Exemplo n.º 3
0
        protected GameApplication(PoolFiber fiber, PoolFiber playerCacheFiber,
                                  string applicationId, string version, LoadBalancer <GameServerContext> loadBalancer)
        {
            if (log.IsInfoEnabled)
            {
                log.InfoFormat("Creating application: appId={0}/{1}", applicationId, version);
            }

            this.forceGameToRemove = MasterServerSettings.Default.PersistentGameExpiryMinute == 0;

            this.ApplicationId     = applicationId;
            this.LoadBalancer      = loadBalancer;
            this.Version           = version;
            this.PlayerOnlineCache = new PlayerCache(playerCacheFiber);
            this.LobbyFactory      = new LobbyFactory(this);
            this.LobbyFactory.Initialize();
            this.LobbyStatsPublisher = new LobbyStatsPublisher(
                this.LobbyFactory,
                MasterServerSettings.Default.LobbyStatsPublishInterval,
                MasterServerSettings.Default.LobbyStatsLimit);

            this.fiber = fiber;
            this.fiber.Start();

            if (MasterServerSettings.Default.PersistentGameExpiryMinute != 0)
            {
                var checkTime = MasterServerSettings.Default.GameExpiryCheckPeriod * 60000;
                this.expiryCheckDisposable = this.fiber.Schedule(this.CheckExpiredGames, checkTime);
            }

            this.UpdatePluginTraits();
            PluginSettings.ConfigUpdated += () =>
            {
                this.fiber.Enqueue(() => this.UpdatePluginTraits());
            };

            if (!this.ConnectToRedis())
            {
                return;
            }

            this.PopulateGameListFromRedis();
        }
Exemplo n.º 4
0
        public GameApplication(string applicationId, string version, LoadBalancer<IncomingGameServerPeer> loadBalancer)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("Creating application: appId={0}", applicationId);
            }

            this.ApplicationId = applicationId;
            this.LoadBalancer = loadBalancer;
            this.Version = version;
            this.PlayerOnlineCache = new PlayerCache();
            this.LobbyFactory = new LobbyFactory(this);
            this.LobbyFactory.Initialize();
            this.LobbyStatsPublisher = new LobbyStatsPublisher(
                this.LobbyFactory,
                MasterServerSettings.Default.LobbyStatsPublishInterval,
                MasterServerSettings.Default.LobbyStatsLimit);

            this.fiber = new PoolFiber();
            this.fiber.Start();

            if (MasterServerSettings.Default.PersistentGameExpiryMinute != 0)
            {
                var checkTime = MasterServerSettings.Default.GameExpiryCheckPeriod * 60000;
                this.expiryCheckDisposable = this.fiber.Schedule(this.CheckExpiredGames, checkTime);
            }

            this.SetupTokenCreator();

            this.UpdatePluginTraits();

            if (!this.ConnectToRedis())
            {
                return;
            }

            this.PopulateGameListFromRedis();
        }
Exemplo n.º 5
0
        public GameApplication(string applicationId, string version, LoadBalancer <IncomingGameServerPeer> loadBalancer)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("Creating application: appId={0}", applicationId);
            }

            this.ApplicationId     = applicationId;
            this.LoadBalancer      = loadBalancer;
            this.Version           = version;
            this.PlayerOnlineCache = new PlayerCache();
            this.LobbyFactory      = new LobbyFactory(this);
            this.LobbyFactory.Initialize();
            this.LobbyStatsPublisher = new LobbyStatsPublisher(
                this.LobbyFactory,
                MasterServerSettings.Default.LobbyStatsPublishInterval,
                MasterServerSettings.Default.LobbyStatsLimit);

            this.fiber = new PoolFiber();
            this.fiber.Start();

            if (MasterServerSettings.Default.PersistentGameExpiryMinute != 0)
            {
                var checkTime = MasterServerSettings.Default.GameExpiryCheckPeriod * 60000;
                this.expiryCheckDisposable = this.fiber.Schedule(this.CheckExpiredGames, checkTime);
            }

            this.SetupTokenCreator();

            this.UpdatePluginTraits();

            if (!this.ConnectToRedis())
            {
                return;
            }

            this.PopulateGameListFromRedis();
        }