Search in sources :

Example 16 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class WndHeroSpells method addSpell.

private float addSpell(String spellName, final Hero hero, float yPos, int i) {
    final Spell spell = SpellFactory.getSpellByName(spellName);
    if (spell == null || spell.level() > hero.magicLvl()) {
        return yPos;
    }
    int xPos = 0;
    if (i % 2 == 0) {
        xPos = width - 48 - MARGIN * 2;
    }
    Text txtName;
    txtName = PixelScene.createText(spell.name(), GuiProperties.titleFontSize());
    txtName.measure();
    txtName.x = xPos;
    txtName.y = yPos;
    add(txtName);
    Image icon = spell.image();
    icon.frame(spell.film.get(spell.imageIndex));
    icon.y = txtName.bottom();
    icon.x = xPos;
    add(icon);
    SimpleButton btnCast = new SimpleButton(Icons.get(Icons.BTN_TARGET)) {

        protected void onClick() {
            hide();
            spell.cast(hero);
        }
    };
    btnCast.setRect(icon.x + icon.width() + MARGIN, icon.y, 16, 15);
    add(btnCast);
    SimpleButton btnInfo = new SimpleButton(Icons.get(Icons.BTN_QUESTION)) {

        protected void onClick() {
            hide();
            GameScene.show(new WndSpellInfo(hero, spell));
        }
    };
    btnInfo.setRect(icon.x + icon.width() + MARGIN, btnCast.bottom() + MARGIN, 16, 15);
    add(btnInfo);
    Text txtCost;
    txtCost = PixelScene.createText(Game.getVar(R.string.Mana_Cost) + spell.spellCost(), GuiProperties.titleFontSize());
    txtCost.measure();
    txtCost.x = xPos;
    txtCost.y = icon.bottom();
    add(txtCost);
    if (xPos == 0) {
        return yPos;
    }
    return txtCost.bottom() + MARGIN;
}
Also used : SimpleButton(com.watabou.pixeldungeon.ui.SimpleButton) Text(com.watabou.noosa.Text) Image(com.watabou.noosa.Image) Spell(com.nyrds.pixeldungeon.mechanics.spells.Spell)

Example 17 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class WndTradeItem method createDescription.

private float createDescription(Item item, boolean forSale) {
    // Title
    IconTitle titlebar = new IconTitle();
    titlebar.icon(new ItemSprite(item));
    titlebar.label(forSale ? Utils.format(TXT_SALE, item.toString(), price(item)) : Utils.capitalize(item.toString()));
    titlebar.setRect(0, 0, WIDTH, 0);
    add(titlebar);
    // Upgraded / degraded
    if (item.levelKnown && item.level() > 0) {
        titlebar.color(ItemSlot.UPGRADED);
    } else if (item.levelKnown && item.level() < 0) {
        titlebar.color(ItemSlot.DEGRADED);
    }
    // Description
    Text info = PixelScene.createMultiline(item.info(), GuiProperties.regularFontSize());
    info.maxWidth(WIDTH);
    info.measure();
    info.x = titlebar.left();
    info.y = titlebar.bottom() + GAP;
    add(info);
    return info.y + info.height();
}
Also used : Text(com.watabou.noosa.Text) ItemSprite(com.watabou.pixeldungeon.sprites.ItemSprite)

Example 18 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class GenericInfo method makeInfo.

public static void makeInfo(Window parent, Image icon, String title, int titleColor, String desc) {
    IconTitle titlebar = new IconTitle();
    titlebar.icon(icon);
    titlebar.label(Utils.capitalize(title), titleColor);
    titlebar.setRect(0, 0, WIDTH, 0);
    parent.add(titlebar);
    Text txtInfo = PixelScene.createMultiline(desc, GuiProperties.regularFontSize());
    txtInfo.maxWidth(WIDTH);
    txtInfo.measure();
    txtInfo.setPos(0, 0);
    int wndHeight = (int) Math.min((titlebar.bottom() + txtInfo.height() + 3 * GAP), MAX_HEIGHT);
    parent.resize(WIDTH, wndHeight);
    int scroolZoneHeight = (int) (wndHeight - titlebar.bottom() - GAP * 2);
    ScrollPane list = new ScrollPane(new Component());
    parent.add(list);
    list.setRect(0, titlebar.height() + GAP, WIDTH, scroolZoneHeight);
    Component content = list.content();
    content.clear();
    content.add(txtInfo);
    content.setSize(txtInfo.width(), txtInfo.height());
}
Also used : ScrollPane(com.watabou.pixeldungeon.ui.ScrollPane) Text(com.watabou.noosa.Text) Component(com.watabou.noosa.ui.Component) IconTitle(com.watabou.pixeldungeon.windows.IconTitle)

Aggregations

Text (com.watabou.noosa.Text)18 Archs (com.watabou.pixeldungeon.ui.Archs)6 RedButton (com.watabou.pixeldungeon.ui.RedButton)5 Image (com.watabou.noosa.Image)4 ExitButton (com.watabou.pixeldungeon.ui.ExitButton)4 ScrollPane (com.watabou.pixeldungeon.ui.ScrollPane)4 NinePatch (com.watabou.noosa.NinePatch)3 Component (com.watabou.noosa.ui.Component)3 Intent (android.content.Intent)2 Touch (com.watabou.input.Touchscreen.Touch)2 SystemText (com.watabou.noosa.SystemText)2 TouchArea (com.watabou.noosa.TouchArea)2 Flare (com.watabou.pixeldungeon.effects.Flare)2 ItemSprite (com.watabou.pixeldungeon.sprites.ItemSprite)2 Spell (com.nyrds.pixeldungeon.mechanics.spells.Spell)1 BitmapText (com.watabou.noosa.BitmapText)1 Visual (com.watabou.noosa.Visual)1 BadgesList (com.watabou.pixeldungeon.ui.BadgesList)1 ChangelogButton (com.watabou.pixeldungeon.ui.ChangelogButton)1 DonateButton (com.watabou.pixeldungeon.ui.DonateButton)1