01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: Start.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package tutorial.numberguess;
09:
10: import com.uwyn.rife.engine.Element;
11: import tutorial.numberguess.backend.Contest;
12:
13: /**
14: * This element starts a new game and activates the <code>started</code> exit
15: * when that's done. Nothing is displayed.
16: * <p>
17: * If a game is already active for the participant that uses this element,
18: * the game is replaced by the name one.
19: *
20: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
21: * @version $Revision: 3634 $
22: */
23: public class Start extends Element {
24: /**
25: * The element's entry point.
26: */
27: public void processElement() {
28: // if a game is already active, stop it
29: Contest.stopGame(getInput("gameid"));
30:
31: // start the new game and remember it's unique id
32: setOutput("gameid", Contest.startGame());
33:
34: // activate the started exit
35: exit("started");
36: }
37: }
|