public static NetworkServiceImpl Build(EngineServiceInternal engineServiceInternal, Protocol protocol)
        {
            ServiceRegistry.Current.RegisterService <ClientProtocolInstancesCache>(new ClientProtocolInstancesCacheImpl());
            ServiceRegistry.Current.RegisterService <ClientNetworkInstancesCache>(new ClientNetworkInstancesCacheImpl());
            ComponentAndEventRegistrator componentAndEventRegistrator = new ComponentAndEventRegistrator(engineServiceInternal, protocol);
            SharedEntityRegistry         service = new SharedEntityRegistryImpl(engineServiceInternal);

            ServiceRegistry.Current.RegisterService <SharedEntityRegistry>(service);
            CommandsCodecImpl impl = new CommandsCodecImpl(TemplateRegistry);

            impl.Init(protocol);
            ServiceRegistry.Current.RegisterService <CommandsCodec>(impl);
            return(Build(engineServiceInternal, protocol, componentAndEventRegistrator, service, impl));
        }
        public static NetworkServiceImpl Build(EngineServiceInternal engineServiceInternal, Protocol protocol, ComponentAndEventRegistrator componentAndEventRegistrator, SharedEntityRegistry entityRegistry, CommandsCodec commandsCodec)
        {
            NetworkServiceImpl networkService = new NetworkServiceImpl(new ProtocolAdapterImpl(protocol, commandsCodec), new TcpSocketImpl());
            CommandsSender     sender1        = new CommandsSender(engineServiceInternal, networkService, componentAndEventRegistrator, entityRegistry);

            return(networkService);
        }
Example #3
0
        public CommandsSender(EngineService engineService, NetworkService networkService, ComponentAndEventRegistrator componentAndEventRegistrator, SharedEntityRegistry entityRegistry)
        {
            this.networkService   = networkService;
            this.entityRegistry   = entityRegistry;
            this.commandCollector = new CommandCollector();
            this.logger           = LoggerProvider.GetLogger(this);
            EventCommandCollector     eventListener     = new EventCommandCollector(this.commandCollector, componentAndEventRegistrator, entityRegistry);
            ComponentCommandCollector componentListener = new ComponentCommandCollector(this.commandCollector, componentAndEventRegistrator, entityRegistry);

            engineService.AddFlowListener(this);
            engineService.AddComponentListener(componentListener);
            engineService.AddEventListener(eventListener);
        }
 public ComponentCommandCollector(CommandCollector commandCollector, ComponentAndEventRegistrator componentAndEventRegistrator, SharedEntityRegistry entityRegistry) : base(commandCollector)
 {
     this.componentAndEventRegistrator = componentAndEventRegistrator;
     this.entityRegistry = entityRegistry;
 }