示例#1
0
        public SessionHandler(
            ILogger <SessionHandler> logger,
            IOptions <GameOptions> gameOptions,
            IOptions <DevelopmentOptions> devOptions,
            AccountService accountService,
            CharacterService characterService)
        {
            _accountService   = accountService;
            _characterService = characterService;
            _logger           = logger;
            _devOptions       = devOptions.Value;

            AltAsync.OnPlayerConnect    += (player, reason) => OnPlayerConnect(player as ServerPlayer, reason);
            AltAsync.OnPlayerDisconnect += (player, reason) => OnPlayerDisconnect(player as ServerPlayer, reason);
            Alt.OnPlayerDead            += (player, killer, weapon) => OnPlayerDead(player as ServerPlayer, killer, weapon);
            AltAsync.OnClient <ServerPlayer, string>("Login:Authenticate", OnLoginAuthenticateAsync);
            AltAsync.OnClient <ServerPlayer, int>("Session:RequestCharacterSpawn", OnRequestCharacterSpawnAsync);
            AltAsync.OnClient <ServerPlayer, string>("Session:CreateNewCharacter", OnCreateNewCharacterAsync);
            Alt.OnClient <ServerPlayer, Vector3>("RequestTeleport", OnRequestTeleport);

            SpawnPoint = new Vector3(
                gameOptions.Value.SpawnPointX,
                gameOptions.Value.SpawnPointY,
                gameOptions.Value.SpawnPointZ);
        }
        public Database(
            IDbContextFactory <DatabaseContext> dbContextFactory,
            IOptions <DevelopmentOptions> devOptions,
            ILogger <Database> logger)
        {
            Logger = logger;

            _dbContextFactory = dbContextFactory;
            _devOptions       = devOptions.Value;
        }
示例#3
0
        private static IServiceCollection ConfigureSettings(this IServiceCollection services, IConfiguration configuration, bool isDevelopment)
        {
            services.Configure <ApplicationManagerOptions>(configuration.GetSection("ApplicationManager"));
            services.Configure <OpenIdOptions>(configuration.GetSection("OpenId"));
            services.Configure <EmailOptions>(configuration.GetSection("EmailSettings"));

            IConfigurationSection developmentSettingsSection = configuration.GetSection("DevelopmentSettings");

            services.Configure <DevelopmentOptions>(developmentSettingsSection);
            DevelopmentOptions options = developmentSettingsSection.Get <DevelopmentOptions>();

            if (isDevelopment)
            {
                _isDevelopment = options.UseDevelopmentSettings;
            }
            return(services);
        }
        public ServiceConfigurationBuilder(IConfiguration configuration, IHostEnvironment hostEnvironment)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (hostEnvironment == null)
            {
                throw new ArgumentNullException(nameof(hostEnvironment));
            }

            var applicationDomain = new ApplicationHost(AppDomain.CurrentDomain, hostEnvironment);

            this.ApplicationDomain = applicationDomain;

            var fileCertificateResolver  = new FileCertificateResolver(applicationDomain);
            var storeCertificateResolver = new StoreCertificateResolver();

            this.CertificateResolver = new CertificateResolver(fileCertificateResolver, storeCertificateResolver);

            this.Configuration = configuration;

            var data = new DataOptions();

            configuration.GetSection(ConfigurationKeys.DataPath).Bind(data);
            this.Data = data;

            var development = new DevelopmentOptions();

            configuration.GetSection(ConfigurationKeys.DevelopmentPath).Bind(development);
            this.Development = development;

            this.FeatureManager  = new ConfigurationFeatureManager(configuration);
            this.HostEnvironment = hostEnvironment;
            this.InstanceFactory = new InstanceFactory();
        }
示例#5
0
 public DevelopmentUser(DevelopmentOptions options)
 {
     _options = options;
 }