v0.2.4: tweaked bag window, now auto-opens containers of all types

This commit is contained in:
Evan Debenham
2015-02-18 14:35:38 -05:00
parent f0500e8eea
commit 5e9cdf87d5
2 changed files with 21 additions and 9 deletions
@@ -22,6 +22,10 @@ import java.util.ArrayList;
import com.shatteredpixel.shatteredpixeldungeon.*;
import com.shatteredpixel.shatteredpixeldungeon.items.Honeypot;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.ui.LootIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.ResumeIndicator;
@@ -635,9 +639,17 @@ public class GameScene extends PixelScene {
public static WndBag selectItem( WndBag.Listener listener, WndBag.Mode mode, String title ) {
cancelCellSelector();
WndBag wnd = mode == Mode.SEED ?
WndBag.seedPouch( listener, mode, title ) :
WndBag.lastBag( listener, mode, title );
WndBag wnd =
mode == Mode.SEED ?
WndBag.getBag( SeedPouch.class, listener, mode, title ) :
mode == Mode.SCROLL ?
WndBag.getBag( ScrollHolder.class, listener, mode, title ) :
mode == Mode.POTION ?
WndBag.getBag( PotionBandolier.class, listener, mode, title ) :
mode == Mode.WAND ?
WndBag.getBag( WandHolster.class, listener, mode, title ) :
WndBag.lastBag( listener, mode, title );
scene.add( wnd );
return wnd;
@@ -153,12 +153,12 @@ public class WndBag extends WndTabbed {
}
}
public static WndBag seedPouch( Listener listener, Mode mode, String title ) {
SeedPouch pouch = Dungeon.hero.belongings.getItem( SeedPouch.class );
return pouch != null ?
new WndBag( pouch, listener, mode, title ) :
new WndBag( Dungeon.hero.belongings.backpack, listener, mode, title );
public static WndBag getBag( Class<? extends Bag> bagClass, Listener listener, Mode mode, String title ) {
Bag bag = Dungeon.hero.belongings.getItem( bagClass );
return bag != null ?
new WndBag( bag, listener, mode, title ) :
lastBag( listener, mode, title );
}
protected void placeItems( Bag container ) {