Ejemplo n.º 1
0
 /// <summary>
 /// 检测世界交换物体的缓存
 /// </summary>
 private void CheckWorldItemCaches(ref IShipDockEntitas target)
 {
     if (WorldComp.IsDataValid(ref target))
     {
         mWorldItem = WorldComp.GetEntitasData(ref target);
         if (ShouldAddToWorldItems())
         {
             mWorldItemMapper.Put(mWorldItem.worldItemID, mWorldItem);
             AfterWorldItemCached(ref target);
         }
     }
 }
Ejemplo n.º 2
0
        public static void Init <T>(int componentName, WorldInteracter item, EntitasComponentable entitas, GameObject gameObject, IWorldIntercatable target = default) where T : WorldComponent
        {
            T comp = entitas.GetComponentByName <T>(componentName);

            item             = comp.GetEntitasData(ref entitas);
            item.worldItemID = gameObject.GetInstanceID();
            if (target != default)
            {
                item.Add(target.WorldItemHandler);
                item.WorldItemDispose = target.WorldItemDispose;
            }
        }
Ejemplo n.º 3
0
        public override int DropEntitas(IShipDockEntitas target, int entitasID)
        {
            mWorldItem = WorldComp.GetEntitasData(ref target);

            if ((mWorldItem != default) && (mWorldItem.worldItemID != int.MaxValue))
            {
                if (mWorldItemMapper.ContainsKey(mWorldItem.worldItemID))
                {
                    DropWorldItem(ref target);
                }
            }

            return(base.DropEntitas(target, entitasID));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 检测世界交换物体的事件
 /// </summary>
 private void CheckWorldEvents()
 {
     if (mWorldEventNotices.Count > 0)
     {
         mItemNotice = mWorldEventNotices.Dequeue();
         if (mEventItems.Count > 0)
         {
             mEventItem = mEventItems.Dequeue();
             if (IsEventItemValid())
             {
                 mEventItem.Dispatch(mItemNotice);//派发世界物体消息
                 mItemNotice.ToPool();
             }
         }
     }
 }
Ejemplo n.º 5
0
 private bool IsWorldItemValid(ref WorldInteracter item)
 {
     return((item != default) && !item.isDroped);
 }