public AT.Battle.Unequip BattleUnequip(EquipmentSlotType t) { AT.Battle.Unequip action = new AT.Battle.Unequip(InventoryView.instance.CurrentActor); (action.ActionOptions [0] as EquipmentSlotTypeOption).chosenChoice = new EquipmentSlotTypeChoice(t); return(action); }
//This happens before the drag end happens. public virtual void DroppedItem(OptButton opt) { if (currentlyDraggingSlot != null) { bool updated = false; NoDropReason reason = DropRestrictReasonItemSlot(currentlyDraggingSlot.CurrentItem, currentlyDraggingSlot); switch (reason) { case NoDropReason.CANT_UNEQUIP_TO_HERE: Debug.Log("shit, can unequip here ni"); break; case NoDropReason.NO_ACTION_LEFT_FOR_UNEQUIP: Debug.Log("No action left my friend."); break; case NoDropReason.NONE__CAN_ACTUALLY_DROP: Debug.Log("You can drop!"); if (currentlyDraggingSlot is EquipmentUISlot) //slot is an equipment slot { EquipmentUISlot sl = currentlyDraggingSlot as EquipmentUISlot; if (InventoryView.instance.IsBattleMode) { //actions need to be performed... if (CurrentItem == null) { AT.Battle.Unequip action = BattleUnequip(sl.slotType); action.Perform(); } else { AT.Battle.Equip action = BattleEquip(CurrentItem, sl.slotType); action.Perform(); } InventoryView.instance.RefreshUi(); } else { //The state can just be set. if (CurrentItem == null) { // AT.Battle.Unequip action = BattleUnequip (sl.slotType); // Debug.Log("here, will unequp"); SetInventoryItem(currentlyDraggingSlot.CurrentItem); currentlyDraggingSlot.SetInventoryItem(null); } else { InventoryItem swap = CurrentItem; InventoryView.instance.currentCharacter.Unequip( (currentlyDraggingSlot as EquipmentUISlot).slotType, currentlyDraggingSlot.CurrentItem as Equipment); SetInventoryItem(currentlyDraggingSlot.CurrentItem); currentlyDraggingSlot.SetInventoryItem(swap); } InventoryView.instance.RefreshCharacter(); } } else ///TODO: add case for if the slot is a ground slot (only valid in battle) { InventoryItem swap = CurrentItem; SetInventoryItem(currentlyDraggingSlot.CurrentItem); currentlyDraggingSlot.SetInventoryItem(swap); InventoryView.instance.RefreshCharacter(); } break; } } }