示例#1
0
 protected void Add([NotNull] IInitSystem system)
 {
     if (system == null)
     {
         throw new ArgumentNullException(nameof(system));
     }
     GetOrCreateListAndAdd(ref _initSystems, system);
 }
示例#2
0
        /// <summary>
        /// 删除系统
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public Observer RemoveSystem <T>()
        {
            IInitSystem initSystem = null;

            foreach (IInitSystem item in _systemInitList)
            {
                if (item.GetType() == typeof(T))
                {
                    initSystem = item;
                    break;
                }
            }
            if (initSystem != null)
            {
                _systemInitList.Remove(initSystem);
            }
            //ISystem reactiveSystem = null;
            int index = -1;

            for (int i = 0; i < _systemReactiveDic.Count; i++)
            {
                if (_systemReactiveDic[i].CurrentSystem.GetType() == typeof(T))
                {
                    index = i;
                    break;
                }
            }
            if (index > 0)
            {
                _systemReactiveDic.RemoveAt(index);
            }
            IExecuteSystem executeSystem = null;

            foreach (IExecuteSystem item in _systemExecuteList)
            {
                if (item.GetType() == typeof(T))
                {
                    executeSystem = item;
                    break;
                }
            }
            if (executeSystem != null)
            {
                _systemExecuteList.Remove(executeSystem);
            }
            return(this);
        }
示例#3
0
 protected virtual void AddInitSystem(IInitSystem system)
 {
     _normalSystemMgr.AddInitSystem(system);
 }
示例#4
0
        /// <summary>
        /// The method register specialized system type which is IInitSystem. The systems of this type
        /// is executed only once at start of an application. Please DON'T use this method use Register
        /// method instead.
        /// </summary>
        /// <param name="system">A reference to ISystem implementation</param>
        /// <returns>An identifier of a system within the manager</returns>

        public SystemId RegisterSystem(IInitSystem system)
        {
            return(_registerSystem(system, mActiveInitSystems, (byte)E_SYSTEM_TYPE.ST_INIT));
        }
示例#5
0
 public void AddInitSystem(IInitSystem system)
 {
     _initSystems.Add(system);
 }