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);
        }
示例#2
0
 public SystemRegistry(TemplateRegistry templateRegistry, EngineServiceInternal engineService)
 {
     this.templateRegistry      = templateRegistry;
     this.engineService         = engineService;
     this.registeredSystemTypes = new HashSet <Type>();
     this.nodeRegistrator       = new NodeRegistrator();
 }
示例#3
0
 public DelayedEventTask(Event e, ICollection <Entity> entities, EngineServiceInternal engine, double timeToExecute)
 {
     this.e             = e;
     this.entities      = new HashSet <Entity>(entities);
     this.engine        = engine;
     this.timeToExecute = timeToExecute;
 }
示例#4
0
        private void FixedUpdate()
        {
            FixedUpdateEvent.Instance.DeltaTime = Time.fixedDeltaTime;
            Flow flow = EngineServiceInternal.GetFlow();

            flow.TryInvoke(FixedUpdateEvent.Instance, typeof(FixedUpdateEventFireHandler));
            flow.TryInvoke(FixedUpdateEvent.Instance, typeof(FixedUpdateEventCompleteHandler));
        }
示例#5
0
 public PeriodicEventTask(Event e, EngineServiceInternal engineService, ICollection <Entity> contextEntities, float timeInSec)
 {
     this.e               = e;
     this.engineService   = engineService;
     this.contextEntities = new HashSet <Entity>(contextEntities);
     this.timeInSec       = timeInSec;
     this.NewPeriod();
 }
示例#6
0
        public static void SendEventIntoEngine(EngineServiceInternal engineServiceInternal, Event e)
        {
            IEnumerator <Entity> enumerator = engineServiceInternal.EntityRegistry.GetAllEntities().GetEnumerator();

            while (enumerator.MoveNext())
            {
                Flow.Current.SendEvent(e, enumerator.Current);
            }
        }
 private void SendAfterFixedUpdateEventIfNeed()
 {
     if (this.sendAfterFixedUpdateEvent)
     {
         InternalPreciseTime.AfterFixedUpdate();
         Flow flow = EngineServiceInternal.GetFlow();
         Invoke();
         this.sendAfterFixedUpdateEvent = false;
     }
 }
示例#8
0
 public Flow(EngineServiceInternal engineService)
 {
     Current                         = this;
     this.engineService              = engineService;
     this.NodeCollector              = engineService.NodeCollector;
     this.EntityRegistry             = engineService.EntityRegistry;
     this.eventMaker                 = engineService.EventMaker;
     this.handlerResolver            = new HandlerResolver();
     this.nodeChangedHandlerResolver = new NodeChangedHandlerResolver();
     this.broadcastHandlerResolver   = new BroadcastHandlerResolver(engineService.BroadcastEventHandlerCollector);
 }
        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));
        }
示例#10
0
 public EntityImpl(EngineServiceInternal engineService, long id, string name, Optional <Platform.Kernel.ECS.ClientEntitySystem.Impl.TemplateAccessor> templateAccessor)
 {
     this.engineService          = engineService;
     this.id                     = id;
     this.Name                   = name;
     this.nodeCache              = engineService.NodeCache;
     this.TemplateAccessor       = templateAccessor;
     this.storage                = new EntityComponentStorage(this, engineService.ComponentBitIdRegistry);
     this.nodeProvider           = new NodeProvider(this);
     this.nodeDescriptionStorage = new Platform.Kernel.ECS.ClientEntitySystem.Impl.NodeDescriptionStorage();
     this.hashCode               = this.calcHashCode();
     this.nodeAddedEventMaker    = new NodeChangedEventMaker(NodeAddedEvent.Instance, typeof(NodeAddedFireHandler), typeof(NodeAddedCompleteHandler), engineService.HandlerCollector);
     this.nodeRemoveEventMaker   = new NodeChangedEventMaker(NodeRemoveEvent.Instance, typeof(NodeRemovedFireHandler), typeof(NodeRemovedCompleteHandler), engineService.HandlerCollector);
     this.Init();
     this.UpdateNodes(NodeDescriptionRegistry.GetNodeDescriptionsWithNotComponentsOnly());
 }
示例#11
0
        private void Update()
        {
            float deltaTime = Time.deltaTime;

            TimeUpdateEvent.Instance.DeltaTime  = deltaTime;
            EarlyUpdateEvent.Instance.DeltaTime = deltaTime;
            UpdateEvent.Instance.DeltaTime      = deltaTime;
            Flow flow = EngineServiceInternal.GetFlow();

            flow.TryInvoke(TimeUpdateEvent.Instance, typeof(TimeUpdateFireHandler));
            flow.TryInvoke(TimeUpdateEvent.Instance, typeof(TimeUpdateCompleteHandler));
            flow.TryInvoke(EarlyUpdateEvent.Instance, typeof(EarlyUpdateFireHandler));
            flow.TryInvoke(EarlyUpdateEvent.Instance, typeof(EarlyUpdateCompleteHandler));
            flow.TryInvoke(UpdateEvent.Instance, typeof(UpdateEventFireHandler));
            flow.TryInvoke(UpdateEvent.Instance, typeof(UpdateEventCompleteHandler));
            EngineServiceInternal.GetFlow();
            EngineServiceInternal.DelayedEventManager.Update((double)Time.time);
        }
示例#12
0
 public EntityYamlConverter(EngineServiceInternal engine)
 {
     this.engine = engine;
 }
示例#13
0
 public NodeCache(EngineServiceInternal engineService)
 {
 }
示例#14
0
 public DelayedEventManager(EngineServiceInternal engine)
 {
     this.engineService = engine;
 }
示例#15
0
 public void Init(TemplateRegistry templateRegistry, DelayedEventManager delayedEventManager, EngineServiceInternal engineService, NodeRegistrator nodeRegistrator)
 {
     base.Init(templateRegistry, delayedEventManager);
     this.Log = LoggerProvider.GetLogger(this);
 }
示例#16
0
 public EntityTestImpl(EngineServiceInternal engineService, long id, string name, Optional <TemplateAccessor> templateAccessor) : base(engineService, id, name, templateAccessor)
 {
 }
示例#17
0
 public EntityTestImpl(EngineServiceInternal engineService, long id, string name) : base(engineService, id, name)
 {
 }
示例#18
0
 public EntityImpl(EngineServiceInternal engineService, long id, string name) : this(engineService, id, name, Optional <Platform.Kernel.ECS.ClientEntitySystem.Impl.TemplateAccessor> .empty())
 {
 }
示例#19
0
 public SharedEntityRegistryImpl(EngineServiceInternal engineService)
 {
     this.engineService = engineService;
 }
示例#20
0
 public EntityBuilder(EngineServiceInternal engineServiceInternal, EntityRegistry entityRegistry, TemplateRegistry templateRegistry)
 {
     this.engineServiceInternal = engineServiceInternal;
     this.entityRegistry        = entityRegistry;
     this.templateRegistry      = templateRegistry;
 }