public void RemoveSingedComponents()
        {
            int max = mDeletdComponents.Count;

            for (int i = 0; i < max; i++)
            {
                int id = mDeletdComponents[i];
                IShipDockComponent target = mMapper.Get(id);

                int index = mIDMapper.Values.IndexOf(id);

                id = mIDMapper.Keys[index];
                mIDMapper.Remove(id);

                if (index >= 0)
                {
                    mIDMapper.Remove(id);
                }
                List <IShipDockComponent> updateList = target.IsSceneUpdate ? mUpdateByScene : mUpdateByTicks;
                updateList.Remove(target);
                mMapper.Remove(target, out int statu);

                target.Dispose();
            }
            if (max > 0)
            {
                mDeletdComponents.Clear();
            }
        }
Esempio n. 2
0
        private void RemoveComponentAndClear(ref IShipDockComponent target, int aid)
        {
            RemoveNameFromIDMapper(aid);

            int        compIndex  = mComponents.IndexOf(target);
            List <int> updateList = target.IsSceneUpdate ? mUpdateByScene : mUpdateByTicks;

            updateList.Remove(compIndex);
            mMapper.Remove(target, out int statu);

            mComponents.Remove(target);
        }
Esempio n. 3
0
        public void RemoveResolver <InterfaceT>(string resolverName, out int statu)
        {
            statu = 0;
            bool hasRef = mResolverIDMapper.ContainsKey(ref resolverName, out int id);

            if (hasRef)
            {
                IResolverHandler handler = mResolvers.Remove(id);
                handler.Dispose();
                mResolverIDMapper.Remove(resolverName, out statu);
            }
            else
            {
                statu = 1;
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 释放实体
 /// </summary>
 protected virtual void FreeEntitas(int mid, ref IShipDockEntitas entitas, out int statu)
 {
     entitas.RemoveComponent(this);//此处在实体无需销毁时可能为重复操作
     mEntitas.Remove(entitas, out statu);
     mEntitasIDs.Remove(mid);
 }