Search in sources :

Example 6 with Component

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

the class WndCatalogus method updateList.

private void updateList() {
    txtTitle.text(Utils.format(TXT_TITLE, showPotions ? TXT_POTIONS : TXT_SCROLLS));
    txtTitle.measure();
    txtTitle.x = PixelScene.align(PixelScene.uiCamera, (width - txtTitle.width()) / 2);
    items.clear();
    Component content = list.content();
    content.clear();
    list.scrollTo(0, 0);
    float pos = 0;
    for (Class<? extends Item> itemClass : showPotions ? Potion.getKnown() : Scroll.getKnown()) {
        CatalogusListItem item = new CatalogusListItem(itemClass);
        item.setRect(0, pos, width, ITEM_HEIGHT);
        content.add(item);
        items.add(item);
        pos += item.height();
    }
    for (Class<? extends Item> itemClass : showPotions ? Potion.getUnknown() : Scroll.getUnknown()) {
        CatalogusListItem item = new CatalogusListItem(itemClass);
        item.setRect(0, pos, width, ITEM_HEIGHT);
        content.add(item);
        items.add(item);
        pos += item.height();
    }
    content.setSize(width, pos);
}
Also used : CatalogusListItem(com.watabou.pixeldungeon.ui.CatalogusListItem) Component(com.watabou.noosa.ui.Component)

Aggregations

Component (com.watabou.noosa.ui.Component)6 NinePatch (com.watabou.noosa.NinePatch)3 Text (com.watabou.noosa.Text)3 Archs (com.watabou.pixeldungeon.ui.Archs)2 ScrollPane (com.watabou.pixeldungeon.ui.ScrollPane)2 Ankh (com.shatteredpixel.shatteredpixeldungeon.items.Ankh)1 DewVial (com.shatteredpixel.shatteredpixeldungeon.items.DewVial)1 Honeypot (com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)1 Stylus (com.shatteredpixel.shatteredpixeldungeon.items.Stylus)1 Torch (com.shatteredpixel.shatteredpixeldungeon.items.Torch)1 PlateArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor)1 CloakOfShadows (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows)1 DriedRose (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose)1 EtherealChains (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.EtherealChains)1 HornOfPlenty (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty)1 TalismanOfForesight (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight)1 TimekeepersHourglass (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass)1 UnstableSpellbook (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook)1 Blandfruit (com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit)1 Food (com.shatteredpixel.shatteredpixeldungeon.items.food.Food)1