From 7c9796cba1f9f066ea9a83411a38b3adb760923d Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sat, 31 May 2014 14:58:25 +0200 Subject: Display items in locations --- src/esieequest/ui/rich/UserInterface.java | 8 +++++++- src/esieequest/ui/web/WebInterface.java | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/esieequest/ui/rich/UserInterface.java b/src/esieequest/ui/rich/UserInterface.java index e8fbbc7..c743d68 100644 --- a/src/esieequest/ui/rich/UserInterface.java +++ b/src/esieequest/ui/rich/UserInterface.java @@ -600,7 +600,13 @@ abstract class UserInterface implements Viewable, ActionListener { @Override public void updateLocation(final Room room, final Direction direction, final Side side, final boolean canGoBack) { - this.setIllustration(room.name() + Text.FILENAME_SEPARATOR.toString() + direction.name()); + String locationImageName = room.name() + Text.FILENAME_SEPARATOR.toString() + + direction.name(); + if (side.getInventory().getSize() > 0) { + locationImageName += Text.FILENAME_SEPARATOR.toString() + + side.getInventory().getItem().name(); + } + this.setIllustration(locationImageName); this.backButton.setEnabled(canGoBack); this.forwardButton.setEnabled(side.hasDoor()); this.actionButton.setEnabled(side.hasCharacter() || (side.getInventory().getSize() > 0)); diff --git a/src/esieequest/ui/web/WebInterface.java b/src/esieequest/ui/web/WebInterface.java index c407d47..aa70317 100644 --- a/src/esieequest/ui/web/WebInterface.java +++ b/src/esieequest/ui/web/WebInterface.java @@ -399,7 +399,13 @@ class WebInterface extends Composite implements Viewable { @Override public void updateLocation(final Room room, final Direction direction, final Side side, final boolean canGoBack) { - this.setIllustration(room.name() + Text.FILENAME_SEPARATOR.toString() + direction.name()); + String locationImageName = room.name() + Text.FILENAME_SEPARATOR.toString() + + direction.name(); + if (side.getInventory().getSize() > 0) { + locationImageName += Text.FILENAME_SEPARATOR.toString() + + side.getInventory().getItem().name(); + } + this.setIllustration(locationImageName); this.backButton.setEnabled(canGoBack); this.forwardButton.setEnabled(side.hasDoor()); this.actionButton.setEnabled(side.hasCharacter() || (side.getInventory().getSize() > 0)); -- cgit v1.2.3