v0.3.5: game now prompts the player when there are multiple things to examine
This commit is contained in:
parent
0dae8acee7
commit
7301217975
|
@ -15,6 +15,8 @@ scenes.gamescene.water=You hear water splashing around you.
|
||||||
scenes.gamescene.grass=The smell of vegetation is thick in the air.
|
scenes.gamescene.grass=The smell of vegetation is thick in the air.
|
||||||
scenes.gamescene.dark=You can hear enemies moving in the darkness...
|
scenes.gamescene.dark=You can hear enemies moving in the darkness...
|
||||||
scenes.gamescene.secrets=The atmosphere hints that this floor hides many secrets.
|
scenes.gamescene.secrets=The atmosphere hints that this floor hides many secrets.
|
||||||
|
scenes.gamescene.choose_examine=Choose Examine
|
||||||
|
scenes.gamescene.multiple_examine=There are multiple things of interest here, which one do you want to examine?
|
||||||
scenes.gamescene.dont_know=You don't know what is there.
|
scenes.gamescene.dont_know=You don't know what is there.
|
||||||
|
|
||||||
scenes.interlevelscene$mode.descend=Descending...
|
scenes.interlevelscene$mode.descend=Descending...
|
||||||
|
|
|
@ -82,6 +82,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoMob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoPlant;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoPlant;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoTrap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem;
|
||||||
import com.watabou.noosa.Camera;
|
import com.watabou.noosa.Camera;
|
||||||
|
@ -97,6 +98,7 @@ import com.watabou.utils.Random;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class GameScene extends PixelScene {
|
public class GameScene extends PixelScene {
|
||||||
|
|
||||||
|
@ -764,42 +766,73 @@ public class GameScene extends PixelScene {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cell == Dungeon.hero.pos) {
|
ArrayList<String> names = new ArrayList<>();
|
||||||
GameScene.show( new WndHero() );
|
final ArrayList<Object> objects = new ArrayList<>();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Dungeon.visible[cell]) {
|
if (cell == Dungeon.hero.pos) {
|
||||||
Mob mob = (Mob) Actor.findChar(cell);
|
objects.add(Dungeon.hero);
|
||||||
if (mob != null) {
|
names.add(Dungeon.hero.className().toUpperCase(Locale.ENGLISH));
|
||||||
GameScene.show(new WndInfoMob(mob));
|
} else {
|
||||||
return;
|
if (Dungeon.visible[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);
|
Heap heap = Dungeon.level.heaps.get(cell);
|
||||||
if (heap != null && heap.seen) {
|
if (heap != null) {
|
||||||
|
objects.add(heap);
|
||||||
|
names.add(Messages.titleCase( heap.peek().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) {
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void examineObject(Object o){
|
||||||
|
if (o == Dungeon.hero){
|
||||||
|
GameScene.show( new WndHero() );
|
||||||
|
} else if ( o instanceof Mob ){
|
||||||
|
GameScene.show(new WndInfoMob((Mob) o));
|
||||||
|
} else if ( o instanceof Heap ){
|
||||||
|
Heap heap = (Heap)o;
|
||||||
if (heap.type == Heap.Type.FOR_SALE && heap.size() == 1 && heap.peek().price() > 0) {
|
if (heap.type == Heap.Type.FOR_SALE && heap.size() == 1 && heap.peek().price() > 0) {
|
||||||
GameScene.show(new WndTradeItem(heap, false));
|
GameScene.show(new WndTradeItem(heap, false));
|
||||||
} else {
|
} else {
|
||||||
GameScene.show(new WndInfoItem(heap));
|
GameScene.show(new WndInfoItem(heap));
|
||||||
}
|
}
|
||||||
return;
|
} else if ( o instanceof Plant ){
|
||||||
|
GameScene.show( new WndInfoPlant((Plant) o) );
|
||||||
|
} else if ( o instanceof Trap ){
|
||||||
|
GameScene.show( new WndInfoTrap((Trap) o));
|
||||||
|
} else {
|
||||||
|
GameScene.show( new WndMessage( Messages.get(GameScene.class, "dont_know") ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
Plant plant = Dungeon.level.plants.get( cell );
|
|
||||||
if (plant != null) {
|
|
||||||
GameScene.show( new WndInfoPlant( plant ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Trap trap = Dungeon.level.traps.get( cell );
|
|
||||||
if (trap != null && trap.visible) {
|
|
||||||
GameScene.show( new WndInfoTrap( trap ));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GameScene.show( new WndInfoCell( cell ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user