From bf54f0fe13964f41bcd4cfd9450b98e952bafaf2 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Tue, 20 May 2014 16:45:07 +0200 Subject: Add the possibility to skip Scene-s --- src/esieequest/view/web/WebInterface.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/esieequest/view/web/WebInterface.java b/src/esieequest/view/web/WebInterface.java index a85fc78..d417d24 100644 --- a/src/esieequest/view/web/WebInterface.java +++ b/src/esieequest/view/web/WebInterface.java @@ -87,6 +87,7 @@ class WebInterface extends Composite implements Viewable { Button leftButton; private Audio audio; + private Timer timer; /** * The web user interface binder interface. @@ -196,6 +197,9 @@ class WebInterface extends Composite implements Viewable { case KeyCodes.KEY_PAGEUP: WebInterface.this.actionButton.click(); break; + case KeyCodes.KEY_ESCAPE: + WebInterface.this.skipScene(); + break; default: WebInterface.this.inputField.setFocus(true); break; @@ -315,6 +319,16 @@ class WebInterface extends Composite implements Viewable { + WebInterface.ILLUSTRATION_EXT); } + /** + * Skips the currently player Scene. + */ + private void skipScene() { + if (this.timer.isRunning()) { + this.timer.cancel(); + this.timer.run(); + } + } + /** * Opens the inventory (switches to the inventory tab). */ @@ -415,13 +429,13 @@ class WebInterface extends Composite implements Viewable { this.setIllustration(scene.name()); this.playAudio(scene.name()); - new Timer() { + this.timer = new Timer() { @Override public void run() { scene.getCallback().call(); } - }.schedule(scene.getDuration()); - + }; + this.timer.schedule(scene.getDuration()); } } -- cgit v1.2.3