Implemented end of turn event handling, tested

git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@112 72836036-5685-4462-b002-a69064685172
This commit is contained in:
Jannis Harder 2011-05-04 18:47:12 +02:00
parent 3cd6dee363
commit ac08bc112f
2 changed files with 25 additions and 3 deletions

View file

@ -5,6 +5,7 @@ import jrummikub.model.IHand;
import jrummikub.model.ITable;
import jrummikub.util.Event;
import jrummikub.util.IEvent;
import jrummikub.util.IListener;
import jrummikub.view.IView;
public class TurnControl {
@ -19,6 +20,7 @@ public class TurnControl {
this.hand = hand;
this.table = table;
this.view = view;
setup();
}
/** Test only constructor **/
@ -28,6 +30,20 @@ public class TurnControl {
this.table = table;
this.view = view;
this.timer = testTimer;
setup();
}
private void setup() {
IListener endOfTurnListener = new IListener() {
@Override
public void handle() {
endOfTurn();
}
};
timer.getTimeRunOutEvent().add(endOfTurnListener);
view.getPlayerPanel().getEndTurnEvent().add(endOfTurnListener);
}
private void sortByValue() {
@ -38,6 +54,11 @@ public class TurnControl {
}
private void endOfTurn() {
timer.stopTimer();
endOfTurnEvent.emit();
}
public IEvent getEndOfTurnEvent() {
return endOfTurnEvent;
}