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;
}
Aggregations