public static ISystem CreateSystem(this Pools pools, IReactiveSystem system)
 {
     throw new EntitasException(
               "pools.CreateSystem(" + system + ") can not infer which pool to use to create a ReactiveSystem!",
               "pools.CreateSystem(system) only supports IInitializeSystem, IExecuteSystem, ICleanupSystem, ITearDownSystem and IEntityCollectorSystem."
               );
 }
Exemple #2
0
        public virtual bool ShutDown()
        {
            m_IShutDownSystems.Exect_ReverseOrder((IShutDownSystem sys) =>
            {
                sys.ShutDown();
            });

            //清理Sys
            m_IExecuteSystems.Exect_Order((IExecuteSystem sys) =>
            {
                IReactiveSystem irs = sys as IReactiveSystem;
                if (irs != null)
                {
                    irs.Deactivate();
                    irs.Clear();
                }
            });


            m_IInitializeSystems.Systems.Clear();
            m_IExecuteSystems.Systems.Clear();
            m_IShutDownSystems.Systems.Clear();


            return(true);
        }
Exemple #3
0
 public ReactiveSystemDto(IReactiveSystem reactiveSystem)
 {
     if (reactiveSystem == null)
     {
         throw new Exception("System Is Null");
     }
     _currentSystem = reactiveSystem;
     _entityHashSet = new HashSet <Entity>();
 }
Exemple #4
0
 public static void Unsubscribe(IReactiveSystem system)
 {
     if (system == null)
     {
         throw new ArgumentNullException();
     }
     if (reactiveSystems.Contains(system))
     {
         reactiveSystems.Remove(system);
     }
 }
Exemple #5
0
        public void Init()
        {
            mWorldContext = new WorldContextFactory().CreateNewWorldInstance();

            mSystemManager = new SystemManager(mWorldContext);

            mRegisterViewsSystem = new RegisterViewSystem(mWorldContext);

            mSystemManager.RegisterSystem(mRegisterViewsSystem);

            mSystemManager.Init();
        }
Exemple #6
0
        public static void Subscribe(IReactiveSystem system)
        {
            if (system == null)
            {
                throw new ArgumentNullException();
            }

            if (!reactiveSystems.Contains(system))
            {
                reactiveSystems.Add(system);
            }
            else
            {
                Console.Write("System is already subscribed");
            }
        }
Exemple #7
0
        public virtual bool Initialize()
        {
            //激活响应Sys
            m_IExecuteSystems.Exect_Order((IExecuteSystem sys) =>
            {
                IReactiveSystem irs = sys as IReactiveSystem;
                if (irs != null)
                {
                    irs.Activate();
                }
            });


            m_IInitializeSystems.Exect_ReverseOrder((IInitializeSystem sys) =>
            {
                sys.Initialize();
            });
            return(true);
        }
Exemple #8
0
 /// Recommended way to create systems in general: pool.CreateSystem<RenderPositionSystem>();
 public ReactiveSystem(Pool pool, IReactiveSystem subSystem) :
     this(pool, subSystem, new [] { subSystem.trigger })
 {
 }
Exemple #9
0
 /// Recommended way to create systems in general:
 /// pool.CreateSystem(new MySystem());
 public ReactiveSystem(Pool pool, IReactiveSystem subSystem) : this(
         subSystem, createEntityCollector(pool, new [] { subSystem.trigger })
         )
 {
 }
 public ReactiveSystem(Pool pool, IReactiveSystem subSystem)
     : this(pool, subSystem, new [] { subSystem.trigger }, new [] { subSystem.eventType })
 {
 }
 public ReactiveSystem(Pool pool, IReactiveSystem subSystem)
 {
     _subsystem = subSystem;
     _observer = new GroupObserver(pool.GetGroup(subSystem.GetTriggeringMatcher()), subSystem.GetEventType());
 }
Exemple #12
0
        /// <summary>
        /// The method registers a given reactive system within the manager. Please DON'T use this method use Register
        /// method instead.
        /// </summary>
        /// <param name="system">A reference to IReactiveSystem implementation</param>
        /// <returns>An identifier of a system within the manager</returns>

        public SystemId RegisterSystem(IReactiveSystem system)
        {
            return(_registerSystem(system, mActiveReactiveSystems, (byte)E_SYSTEM_TYPE.ST_REACTIVE));
        }
 /// Recommended way to create systems in general: pool.CreateSystem<RenderPositionSystem>();
 public ReactiveSystem(Pool pool, IReactiveSystem subSystem)
     : this(subSystem, createGroupObserver(pool, new [] { subSystem.trigger }))
 {
 }
Exemple #14
0
 /// Recommended way to create systems in general: pool.CreateSystem(new MySystem());
 public ReactiveSystem(Pool pool, IReactiveSystem subSystem) :
     this(subSystem, createGroupObserver(pool, new [] { subSystem.trigger }))
 {
 }
 public ReactiveSystem(Pool pool, IReactiveSystem subSystem)
 {
     _subsystem = subSystem;
     _observer  = new GroupObserver(pool.GetGroup(subSystem.GetTriggeringMatcher()), subSystem.GetEventType());
 }
 public ReactiveSystem(Pool pool, IReactiveSystem subSystem)
 {
     _subsystem = subSystem;
     _observer = new GroupObserver(pool.GetGroup(subSystem.trigger), subSystem.eventType);
 }
Exemple #17
0
 public ReactiveSystem(Pool pool, IReactiveSystem subSystem)
 {
     _subsystem = subSystem;
     _observer  = new GroupObserver(pool.GetGroup(subSystem.trigger), subSystem.eventType);
     _buffer    = new List <Entity>();
 }
 /// Recommended way to create systems in general: pool.CreateSystem(new MySystem());
 public ReactiveSystem(Pool <T> pool, IReactiveSystem <T> subSystem) :
     this(subSystem, CreateGroupObserver(pool, new[] { subSystem.Trigger }))
 {
 }