/// <summary>
        /// DI for services used in GameServer types of launchers
        /// </summary>
        /// <param name="services"></param>
        public virtual void ConfigureServices(IServiceCollection services)
        {
            ConfigureCommonServices(services, LauncherHelpers.GetAssemblyName(ServerRole.GameServer));

            //container for room properties - it is passed to room controller
            services.AddScoped <IRoomPropertiesContainer, RoomPropertiesContainer>();
            //room manager - responsible for creating, updating and cleanuping rooms on game server
            services.AddSingleton <IRoomManager, RoomManager>();
            //game server itself
            services.AddSingleton <IApplication, GameApplication>();
            //stats provider - used for determine peer count on server
            services.AddSingleton <IStatisticsProvider, StatisticsProvider>();
            //API for low level components such as logger and config
            services.AddSingleton <IShamanComponents, ShamanComponents>();
            //api for managing high level operations on game server
            services.AddSingleton <IGameServerApi, GameServerApi>();
        }
Пример #2
0
        /// <summary>
        /// DI for services used in MatchMaker types of launchers
        /// </summary>
        /// <param name="services"></param>
        public virtual void ConfigureServices(IServiceCollection services)
        {
            ConfigureCommonServices(services, LauncherHelpers.GetAssemblyName(ServerRole.MatchMaker));

            //matchmaker - choose correct MM group for player
            services.AddSingleton <IMatchMaker, MatchMaker>();
            //MM server itself
            services.AddSingleton <IApplication, MmApplication>();
            //stats provider - used for determine peer count on server
            services.AddSingleton <IStatisticsProvider, StatisticsProvider>();
            //manager responsible for a number of matchmaking groups, running on MM
            services.AddSingleton <IMatchMakingGroupsManager, MatchMakingGroupManager>();
            //manages players collection on MM
            services.AddSingleton <IPlayersManager, PlayersManager>();
            //manages room collection for all game servers connected to MM
            services.AddSingleton <IRoomManager, RoomManager>();
            //provides some properties for creating rooms
            services.AddSingleton <IRoomPropertiesProvider, RoomPropertiesProvider>();
        }