void ShowItem(ItemFielInfo itemFielInfo) { CreatContainerBoxPoint.ClearChild(); SingleContainerBox creatItem = CreatObjectToNGUI.InstantiateObj(ContainerBoxPrefab, CreatContainerBoxPoint).GetComponent <SingleContainerBox>(); creatItem.Init(itemFielInfo, SingleContainerBoxType.HeroEquip); creatItem.SetDragComponentEnabel(CanDrag); MyItem = creatItem; }
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; }
/// <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(); } }
public void UpdateSelectStatus(SingleContainerBox selectBox) { HeroEquipContainerList.ApplyAllItem(P => P.SetSelectStatus(P.MyContainerBox != null && P.MyContainerBox == selectBox)); heroEquipMedicineSlot.SetSelectStatus(heroEquipMedicineSlot.MyContainerBox != null && heroEquipMedicineSlot.MyContainerBox == selectBox); }
public void UpdateSlotSelectStatus(SingleContainerBox selectContainerBox) { ContainerBoxList.ApplyAllItem(P => P.SetSelectStatusActive(P.MyContainerBox != null && selectContainerBox == P.MyContainerBox)); }
/// <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; } }