use of com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoCell in project shattered-pixel-dungeon-gdx by 00-Evan.
the class GameScene method examineCell.
public static void examineCell(Integer cell) {
if (cell == null || cell < 0 || cell > Dungeon.level.length() || (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell])) {
return;
}
ArrayList<String> names = new ArrayList<>();
final ArrayList<Object> objects = new ArrayList<>();
if (cell == Dungeon.hero.pos) {
objects.add(Dungeon.hero);
names.add(Dungeon.hero.className().toUpperCase(Locale.ENGLISH));
} else {
if (Dungeon.level.heroFOV[cell]) {
Mob mob = (Mob) Actor.findChar(cell);
if (mob != null) {
objects.add(mob);
names.add(Messages.titleCase(mob.name));
}
}
}
Heap heap = Dungeon.level.heaps.get(cell);
if (heap != null && heap.seen) {
objects.add(heap);
names.add(Messages.titleCase(heap.toString()));
}
Plant plant = Dungeon.level.plants.get(cell);
if (plant != null) {
objects.add(plant);
names.add(Messages.titleCase(plant.plantName));
}
Trap trap = Dungeon.level.traps.get(cell);
if (trap != null && trap.visible) {
objects.add(trap);
names.add(Messages.titleCase(trap.name));
}
if (objects.isEmpty()) {
GameScene.show(new WndInfoCell(cell));
} else if (objects.size() == 1) {
examineObject(objects.get(0));
} else {
GameScene.show(new WndOptions(Messages.get(GameScene.class, "choose_examine"), Messages.get(GameScene.class, "multiple_examine"), names.toArray(new String[names.size()])) {
@Override
protected void onSelect(int index) {
examineObject(objects.get(index));
}
});
}
}
Aggregations