void UpdateViewAfterDrop() { //InventoryItemData last_invt_data = inventory_owner.GetInventoryData(inventory_slot_id); InventoryItemData last_invt_data = inventory_owner[inventory_slot_id]; if (last_invt_data != null && last_invt_data.count > 0) { SetItem(last_invt_data); } else { Empty(); } }
EMessageChainOperation DropResponse_ToDifferent() { if (inventory_data != null && inventory_data.item_id != last_drag_item.inventory_data.item_id) { InventoryItemData source = last_drag_item.inventory_data.Duplicate(); InventoryItemData target = inventory_data.Duplicate(); //一定是全拿出来的,不然就错了!!! last_drag_item.inventory_owner.TakeOutFormSlot(last_drag_item.inventory_slot_id, source.count); last_drag_item.inventory_owner.PutIntoSlot(last_drag_item.inventory_slot_id, target.item_id, target.count); inventory_owner.TakeOutFormSlot(inventory_slot_id, target.count); inventory_owner.PutIntoSlot(inventory_slot_id, source.item_id, source.count); UpdateViewAfterDrop(); last_drag_item.UpdateViewAfterDrop(); return(EMessageChainOperation.ReturnSuccess); } return(EMessageChainOperation.Continue); }
void Empty() { inventory_data = null; item_image.color = C_EMPTY_COLOR; item_count.text = ""; }