예제 #1
0
        void ShowItem(ItemFielInfo itemFielInfo)
        {
            CreatContainerBoxPoint.ClearChild();
            SingleContainerBox creatItem = CreatObjectToNGUI.InstantiateObj(ContainerBoxPrefab, CreatContainerBoxPoint).GetComponent <SingleContainerBox>();

            creatItem.Init(itemFielInfo, SingleContainerBoxType.HeroEquip);
            creatItem.SetDragComponentEnabel(CanDrag);
            MyItem = creatItem;
        }
예제 #2
0
 public virtual void Show(ItemFielInfo itemFielInfo)
 {
     this.itemFielInfo = itemFielInfo;
     if (singleContainerBox == null)
     {
         singleContainerBox = CreatObjectToNGUI.InstantiateObj(SingelContainerBoxPrefab, CreatContainerBoxPoint).GetComponent <SingleContainerBox>();
         singleContainerBox.collider.enabled = false;
     }
     singleContainerBox.Init(itemFielInfo, SingleContainerBoxType.HeroEquip);
     transform.localPosition = Vector3.zero;
 }
예제 #3
0
        /// <summary>
        /// 移除某个拖拽的物件
        /// </summary>
        /// <param name="dragComponent"></param>
        public void RemoveItem(DragComponent dragComponent)
        {
            SingleContainerBox   DragItem  = dragComponent as SingleContainerBox;
            HeroEquiptBoxSlot_V2 ClearSlot = HeroEquipContainerList.FirstOrDefault(P => P.MyItem == dragComponent);

            if (ClearSlot == null)
            {
                if (heroEquipMedicineSlot.MyItem == dragComponent)
                {
                    heroEquipMedicineSlot.ClearUpItem();
                }
            }
            if (ClearSlot != null)
            {
                ClearSlot.ClearUpItem();
            }
        }
예제 #4
0
 public void UpdateSelectStatus(SingleContainerBox selectBox)
 {
     HeroEquipContainerList.ApplyAllItem(P => P.SetSelectStatus(P.MyContainerBox != null && P.MyContainerBox == selectBox));
     heroEquipMedicineSlot.SetSelectStatus(heroEquipMedicineSlot.MyContainerBox != null && heroEquipMedicineSlot.MyContainerBox == selectBox);
 }
예제 #5
0
 public void UpdateSlotSelectStatus(SingleContainerBox selectContainerBox)
 {
     ContainerBoxList.ApplyAllItem(P => P.SetSelectStatusActive(P.MyContainerBox != null && selectContainerBox == P.MyContainerBox));
 }
예제 #6
0
        /// <summary>
        /// 拖拽物体到我这里的某个槽上
        /// </summary>
        public void OnDragComponentToSlot(ContainerBoxSlot_V2 targetContainerBoxSlot, SingleContainerBox DragItem)
        {
            switch (DragItem.singleContainerBoxType)
            {
            case SingleContainerBoxType.HeroEquip:
                HeroEquiptItemListManager.RemoveItem(DragItem);
                var slotData = targetContainerBoxSlot.MyContainerBoxSlotData;
                slotData.itemfileInfo = DragItem.itemFielInfo;
                targetContainerBoxSlot.Init(slotData, this);
                SendUnloadEquipItemsToSever(DragItem.itemFielInfo, targetContainerBoxSlot);
                break;

            case SingleContainerBoxType.Container:
                var fromSlot = ContainerBoxList.First(P => P.MyContainerBox == DragItem as SingleContainerBox);
                MoveItemToNewSlot(fromSlot, targetContainerBoxSlot);
                break;
            }
        }