Search in sources :

Example 1 with CatalogusListItem

use of com.watabou.pixeldungeon.ui.CatalogusListItem 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)1 CatalogusListItem (com.watabou.pixeldungeon.ui.CatalogusListItem)1