From 50ee7536679fa8622b206c63b26067d73efffc1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Fri, 15 Jun 2012 09:38:08 +0200 Subject: [PATCH] some refactoring --- src/de/ctdo/crashtest/game/TheGame.java | 39 ++++++++++++------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/de/ctdo/crashtest/game/TheGame.java b/src/de/ctdo/crashtest/game/TheGame.java index 76e74be..b177eed 100644 --- a/src/de/ctdo/crashtest/game/TheGame.java +++ b/src/de/ctdo/crashtest/game/TheGame.java @@ -29,23 +29,6 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent initGame(); } - private void initGame() { - guiControl.addListener(this); - ircClient.addListener(this); - machine.addListener(this); - - machine.reset(); - relaisboard.open(); - resetDomotics(); - } - - private void rate(int rating, String text) { - gamerRating += rating; - ircClient.say("rated: " + rating + " (" + gamerRating + ") " + text); - if(gamerRating > 5) gamerRating = 5; - if(gamerRating < 1) gamerRating = 1; - } - /** * Event listener for state change events from statemachine * @param newState the new game state from statemachine @@ -75,9 +58,6 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent mpdController.setVolume(50); mpdController.playSong("start", "mix"); - bunti.setPar56(0,0,0); - bunti.setLampel(false,false,false); - guiControl.showCountDown(false); break; case ENTERED_ROOM: @@ -281,6 +261,23 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent } } + private void initGame() { + guiControl.addListener(this); + ircClient.addListener(this); + machine.addListener(this); + + machine.reset(); + relaisboard.open(); + resetDomotics(); + } + + private void rate(int rating, String text) { + gamerRating += rating; + ircClient.say("rated: " + rating + " (" + gamerRating + ") " + text); + if(gamerRating > 5) gamerRating = 5; + if(gamerRating < 1) gamerRating = 1; + } + private void handleWallCommand(final String message) { if(System.currentTimeMillis() - lastHandleWall < 7000 ) { ircClient.say("not enough mana!"); @@ -448,6 +445,8 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent relaisboard.setRelais(6, true); // enable third green circle relaisboard.setRelais(2, false); // disable the lamp relaisboard.setRelais(3, false); // disable the oven + bunti.setPar56(0,0,0); + bunti.setLampel(false,false,false); mpdController.clearPlaylist(); }