v0.2.4: corrected some quickslot errors
This commit is contained in:
parent
0ab5b8d18d
commit
0d78119ab7
|
@ -54,6 +54,10 @@ public class QuickSlot {
|
||||||
return getItem(slot) != null && getItem(slot).quantity() == 0;
|
return getItem(slot) != null && getItem(slot).quantity() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isNonePlaceholder(int slot){
|
||||||
|
return getItem(slot) != null && getItem(slot).quantity() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void clearItem(Item item){
|
public void clearItem(Item item){
|
||||||
if (contains(item))
|
if (contains(item))
|
||||||
clearSlot(getSlot(item));
|
clearSlot(getSlot(item));
|
||||||
|
|
|
@ -30,22 +30,19 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||||
|
|
||||||
//TODO: investigate targeting with multiple quickslots
|
|
||||||
public class QuickSlotButton extends Button implements WndBag.Listener {
|
public class QuickSlotButton extends Button implements WndBag.Listener {
|
||||||
|
|
||||||
private static final String TXT_SELECT_ITEM = "Select an item for the quickslot";
|
private static final String TXT_SELECT_ITEM = "Select an item for the quickslot";
|
||||||
|
|
||||||
private static QuickSlotButton[] instance = new QuickSlotButton[4];
|
private static QuickSlotButton[] instance = new QuickSlotButton[4];
|
||||||
private int slotNum;
|
private int slotNum;
|
||||||
|
|
||||||
private Item itemInSlot;
|
|
||||||
private ItemSlot slot;
|
private ItemSlot slot;
|
||||||
|
|
||||||
private static Image crossB;
|
private static Image crossB;
|
||||||
private static Image crossM;
|
private static Image crossM;
|
||||||
|
|
||||||
private static boolean targeting = false;
|
private static boolean targeting = false;
|
||||||
private Item lastItem = null;
|
|
||||||
private static Char lastTarget= null;
|
private static Char lastTarget= null;
|
||||||
|
|
||||||
public QuickSlotButton( int slotNum ) {
|
public QuickSlotButton( int slotNum ) {
|
||||||
|
@ -61,8 +58,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
|
||||||
super.destroy();
|
super.destroy();
|
||||||
|
|
||||||
instance = new QuickSlotButton[4];
|
instance = new QuickSlotButton[4];
|
||||||
|
|
||||||
lastItem = null;
|
|
||||||
lastTarget = null;
|
lastTarget = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +136,6 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
|
||||||
|
|
||||||
public void item( Item item ) {
|
public void item( Item item ) {
|
||||||
slot.item( item );
|
slot.item( item );
|
||||||
itemInSlot = item;
|
|
||||||
enableSlot();
|
enableSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,10 +149,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableSlot() {
|
private void enableSlot() {
|
||||||
slot.enable(
|
slot.enable(Dungeon.quickslot.isNonePlaceholder( slotNum ));
|
||||||
itemInSlot != null &&
|
|
||||||
itemInSlot.quantity() > 0 &&
|
|
||||||
(Dungeon.hero.belongings.backpack.contains( itemInSlot ) || itemInSlot.isEquipped( Dungeon.hero )));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void useTargeting() {
|
private void useTargeting() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user