Magic_Ling_Pixel_Dungeon/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndChooseWay.java

85 lines
2.8 KiB
Java
Raw Normal View History

2014-07-27 13:39:07 +00:00
/*
* Pixel Dungeon
2015-06-12 20:44:04 +00:00
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
2016-05-08 23:54:12 +00:00
* Copyright (C) 2014-2016 Evan Debenham
2014-07-27 13:39:07 +00:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
2014-07-27 13:39:07 +00:00
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
2014-07-27 13:39:07 +00:00
public class WndChooseWay extends Window {
private static final int WIDTH = 120;
private static final int BTN_HEIGHT = 18;
private static final float GAP = 2;
public WndChooseWay( final TomeOfMastery tome, final HeroSubClass way1, final HeroSubClass way2 ) {
super();
2014-07-27 13:39:07 +00:00
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( tome.image(), null ) );
titlebar.label( tome.name() );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
RenderedTextMultiline hl = PixelScene.renderMultiline( 6 );
2015-12-31 19:52:11 +00:00
hl.text( way1.desc() + "\n\n" + way2.desc() + "\n\n" + Messages.get(this, "message"), WIDTH );
hl.setPos( titlebar.left(), titlebar.bottom() + GAP );
add( hl );
2014-07-27 13:39:07 +00:00
RedButton btnWay1 = new RedButton( way1.title().toUpperCase() ) {
2014-07-27 13:39:07 +00:00
@Override
protected void onClick() {
hide();
tome.choose( way1 );
}
};
btnWay1.setRect( 0, hl.bottom() + GAP, (WIDTH - GAP) / 2, BTN_HEIGHT );
2014-07-27 13:39:07 +00:00
add( btnWay1 );
RedButton btnWay2 = new RedButton( way2.title().toUpperCase() ) {
2014-07-27 13:39:07 +00:00
@Override
protected void onClick() {
hide();
tome.choose( way2 );
}
};
btnWay2.setRect( btnWay1.right() + GAP, btnWay1.top(), btnWay1.width(), BTN_HEIGHT );
add( btnWay2 );
2015-12-31 19:52:11 +00:00
RedButton btnCancel = new RedButton( Messages.get(this, "cancel") ) {
2014-07-27 13:39:07 +00:00
@Override
protected void onClick() {
hide();
}
};
btnCancel.setRect( 0, btnWay2.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnCancel );
resize( WIDTH, (int)btnCancel.bottom() );
}
}