some refactoring

This commit is contained in:
Lucas Pleß 2012-06-15 09:38:08 +02:00
parent da3aef9704
commit 50ee753667
1 changed files with 19 additions and 20 deletions

View File

@ -29,23 +29,6 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
initGame(); 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 * Event listener for state change events from statemachine
* @param newState the new game state 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.setVolume(50);
mpdController.playSong("start", "mix"); mpdController.playSong("start", "mix");
bunti.setPar56(0,0,0);
bunti.setLampel(false,false,false);
guiControl.showCountDown(false); guiControl.showCountDown(false);
break; break;
case ENTERED_ROOM: 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) { private void handleWallCommand(final String message) {
if(System.currentTimeMillis() - lastHandleWall < 7000 ) { if(System.currentTimeMillis() - lastHandleWall < 7000 ) {
ircClient.say("not enough mana!"); 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(6, true); // enable third green circle
relaisboard.setRelais(2, false); // disable the lamp relaisboard.setRelais(2, false); // disable the lamp
relaisboard.setRelais(3, false); // disable the oven relaisboard.setRelais(3, false); // disable the oven
bunti.setPar56(0,0,0);
bunti.setLampel(false,false,false);
mpdController.clearPlaylist(); mpdController.clearPlaylist();
} }