/// <summary> /// 将物品从本页的一个槽移动到另一个槽上 /// </summary> void MoveItemToNewSlot(ContainerBoxSlot_V2 fromSlot, ContainerBoxSlot_V2 toSlot) { SendChangeItemPlaceToServer(fromSlot, toSlot); var toSlotData = toSlot.MyContainerBoxSlotData; var fromSlotData = fromSlot.MyContainerBoxSlotData; var chachePlace = toSlotData.CurrentPlace; toSlotData.CurrentPlace = fromSlotData.CurrentPlace; fromSlotData.CurrentPlace = chachePlace; toSlot.Init(fromSlotData, this); fromSlot.Init(toSlotData, this); }
/// <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; } }