v1.0.1: added info buttons to the scroll of enchantment window
This commit is contained in:
parent
51ff3c8948
commit
83ba5dc931
|
@ -37,9 +37,12 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTitledMessage;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
public class ScrollOfEnchantment extends ExoticScroll {
|
||||
|
@ -113,6 +116,19 @@ public class ScrollOfEnchantment extends ExoticScroll {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasInfo(int index) {
|
||||
return index < 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInfo( int index ) {
|
||||
GameScene.show(new WndTitledMessage(
|
||||
Icons.get(Icons.INFO),
|
||||
Messages.titleCase(enchants[index].name()),
|
||||
enchants[index].desc()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//do nothing, reader has to cancel
|
||||
|
@ -150,6 +166,19 @@ public class ScrollOfEnchantment extends ExoticScroll {
|
|||
Talent.onUpgradeScrollUsed( Dungeon.hero );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasInfo(int index) {
|
||||
return index < 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInfo( int index ) {
|
||||
GameScene.show(new WndTitledMessage(
|
||||
Icons.get(Icons.INFO),
|
||||
Messages.titleCase(glyphs[index].name()),
|
||||
glyphs[index].desc()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
|
@ -91,9 +93,22 @@ public class WndOptions extends Window {
|
|||
}
|
||||
};
|
||||
btn.enable(enabled(i));
|
||||
btn.setRect( 0, pos, width, BUTTON_HEIGHT );
|
||||
add( btn );
|
||||
|
||||
if (!hasInfo(i)) {
|
||||
btn.setRect(0, pos, width, BUTTON_HEIGHT);
|
||||
} else {
|
||||
btn.setRect(0, pos, width - BUTTON_HEIGHT, BUTTON_HEIGHT);
|
||||
IconButton info = new IconButton(Icons.get(Icons.INFO)){
|
||||
@Override
|
||||
protected void onClick() {
|
||||
onInfo( index );
|
||||
}
|
||||
};
|
||||
info.setRect(width-BUTTON_HEIGHT, pos, BUTTON_HEIGHT, BUTTON_HEIGHT);
|
||||
add(info);
|
||||
}
|
||||
|
||||
pos += BUTTON_HEIGHT + MARGIN;
|
||||
}
|
||||
|
||||
|
@ -105,4 +120,10 @@ public class WndOptions extends Window {
|
|||
}
|
||||
|
||||
protected void onSelect( int index ) {}
|
||||
|
||||
protected boolean hasInfo( int index) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void onInfo( int index ) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user