示例#1
0
        public WvsContainer(
            IApplicationLifetime appLifetime,
            ICacheClient cache,
            IMessageBus messageBus,
            ILockProvider lockProvider,
            IOptions <WvsContainerOptions> info,
            IDataContextFactory dataContextFactory,
            ITemplateManager templateManager,
            IScriptConversationManager conversationManager
            ) : base(appLifetime, cache, messageBus, info, dataContextFactory)
        {
            _token    = new CancellationTokenSource();
            _services = new List <IService>();

            Info.LoginServices
            .Select(o => new WvsLogin(
                        appLifetime,
                        cache,
                        messageBus,
                        new OptionsWrapper <LoginServiceInfo>(o),
                        dataContextFactory,
                        lockProvider,
                        templateManager
                        ))
            .ForEach(_services.Add);
            Info.GameServices
            .Select(o => new WvsGame(
                        appLifetime,
                        cache,
                        messageBus,
                        new OptionsWrapper <GameServiceInfo>(o),
                        dataContextFactory,
                        templateManager,
                        conversationManager
                        ))
            .ForEach(_services.Add);
            Info.ShopServices
            .Select(o => new WvsShop(
                        appLifetime,
                        cache,
                        messageBus,
                        new OptionsWrapper <ShopServiceInfo>(o),
                        dataContextFactory,
                        templateManager
                        ))
            .ForEach(_services.Add);
            Info.TradeServices
            .Select(o => new WvsTrade(
                        appLifetime,
                        cache,
                        messageBus,
                        new OptionsWrapper <TradeServiceInfo>(o),
                        dataContextFactory,
                        templateManager
                        ))
            .ForEach(_services.Add);
        }
示例#2
0
 public WvsGame(
     IApplicationLifetime appLifetime,
     ICacheClient cache,
     IMessageBus messageBus,
     IOptions <GameServiceInfo> info,
     IDataContextFactory dataContextFactory,
     ITemplateManager templateManager,
     IScriptConversationManager conversationManager
     ) : base(appLifetime, cache, messageBus, info, dataContextFactory)
 {
     TemplateManager     = templateManager;
     ConversationManager = conversationManager;
     FieldManager        = new FieldManager(TemplateManager);
     CommandRegistry     = new GameCommandRegistry(
         new Parser(settings =>
     {
         settings.CaseSensitive             = false;
         settings.CaseInsensitiveEnumValues = true;
     })
         );
 }