public boolean contains( Item item ) { for (Item i : items) { if (i == item) { return true; } else if (i instanceof Bag && ((Bag)i).contains( item )) { return true; } } return false; }
public boolean contains( Item item ) { for (Item i : items) { if (i == item) { return true; } else if (i instanceof Bag && ((Bag)i).contains( item )) { return true; } } return false; }
public static WndBag lastBag( Listener listener, Mode mode, String title ) { if (mode == lastMode && lastBag != null && Dungeon.hero.belongings.backpack.contains( lastBag )) { return new WndBag( lastBag, listener, mode, title ); } else { return new WndBag( Dungeon.hero.belongings.backpack, listener, mode, title ); } }
public static WndBag lastBag( Listener listener, Mode mode, String title ) { if (mode == lastMode && lastBag != null && Dungeon.hero.belongings.backpack.contains( lastBag )) { return new WndBag( lastBag, listener, mode, title ); } else { return new WndBag( Dungeon.hero.belongings.backpack, listener, mode, title ); } }
public void execute( Hero hero, String action ) { curUser = hero; curItem = this; Combo combo = hero.buff(Combo.class); if (combo != null) combo.detach(); if (action.equals( AC_DROP )) { if (hero.belongings.backpack.contains(this) || isEquipped(hero)) { doDrop(hero); } } else if (action.equals( AC_THROW )) { if (hero.belongings.backpack.contains(this) || isEquipped(hero)) { doThrow(hero); } } }
public void execute( Hero hero, String action ) { curUser = hero; curItem = this; Combo combo = hero.buff(Combo.class); if (combo != null) combo.detach(); if (action.equals( AC_DROP )) { if (hero.belongings.backpack.contains(this) || isEquipped(hero)) { doDrop(hero); } } else if (action.equals( AC_THROW )) { if (hero.belongings.backpack.contains(this) || isEquipped(hero)) { doThrow(hero); } } }
public final Item detachAll( Bag container ) { Dungeon.quickslot.clearItem( this ); updateQuickslot(); for (Item item : container.items) { if (item == this) { container.items.remove(this); item.onDetach(); return this; } else if (item instanceof Bag) { Bag bag = (Bag)item; if (bag.contains( this )) { return detachAll( bag ); } } } return this; }
public final Item detachAll( Bag container ) { Dungeon.quickslot.clearItem( this ); updateQuickslot(); for (Item item : container.items) { if (item == this) { container.items.remove(this); item.onDetach(); return this; } else if (item instanceof Bag) { Bag bag = (Bag)item; if (bag.contains( this )) { return detachAll( bag ); } } } return this; }
@Override protected void onClick() { if (!lastBag.contains(item) && !item.isEquipped(Dungeon.hero)){ hide(); } else if (listener != null) { hide(); listener.onSelect( item ); } else { Game.scene().addToFront(new WndItem( WndBag.this, item ) ); } }
@Override protected void onClick() { if (!lastBag.contains(item) && !item.isEquipped(Dungeon.hero)){ hide(); } else if (listener != null) { hide(); listener.onSelect( item ); } else { if (NoosaInputProcessor.modifier) { onLongClick(); } else { Game.scene().addToFront(new WndItem( WndBag.this, item ) ); } } }