Search in sources :

Example 1 with SparseArray

use of com.watabou.utils.SparseArray in project pixel-dungeon by watabou.

the class BuffIndicator method layout.

@Override
protected void layout() {
    clear();
    SparseArray<Image> newIcons = new SparseArray<Image>();
    for (Buff buff : ch.buffs()) {
        int icon = buff.icon();
        if (icon != NONE) {
            Image img = new Image(texture);
            img.frame(film.get(icon));
            img.x = x + members.size() * (SIZE + 2);
            img.y = y;
            add(img);
            newIcons.put(icon, img);
        }
    }
    for (Integer key : icons.keyArray()) {
        if (newIcons.get(key) == null) {
            Image icon = icons.get(key);
            icon.origin.set(SIZE / 2);
            add(icon);
            add(new AlphaTweener(icon, 0, 0.6f) {

                @Override
                protected void updateValues(float progress) {
                    super.updateValues(progress);
                    image.scale.set(1 + 5 * progress);
                }

                ;
            });
        }
    }
    icons = newIcons;
}
Also used : SparseArray(com.watabou.utils.SparseArray) AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener) Image(com.watabou.noosa.Image) Buff(com.watabou.pixeldungeon.actors.buffs.Buff)

Aggregations

Image (com.watabou.noosa.Image)1 AlphaTweener (com.watabou.noosa.tweeners.AlphaTweener)1 Buff (com.watabou.pixeldungeon.actors.buffs.Buff)1 SparseArray (com.watabou.utils.SparseArray)1