Turn Timer hat ein Interface
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@107 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
614d0935be
commit
e3e0e301a3
4 changed files with 23 additions and 3 deletions
13
src/jrummikub/control/ITurnTimer.java
Normal file
13
src/jrummikub/control/ITurnTimer.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package jrummikub.control;
|
||||
|
||||
import jrummikub.util.IEvent;
|
||||
|
||||
public interface ITurnTimer {
|
||||
|
||||
public abstract void startTimer();
|
||||
|
||||
public abstract void stopTimer();
|
||||
|
||||
public abstract IEvent getTimeRunOutEvent();
|
||||
|
||||
}
|
|
@ -10,7 +10,7 @@ import jrummikub.view.IView;
|
|||
public class TurnControl {
|
||||
private Hand hand;
|
||||
private ITable table;
|
||||
private TurnTimer timer;
|
||||
private ITurnTimer timer;
|
||||
private IView view;
|
||||
private Event endOfTurnEvent = new Event();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import jrummikub.util.Event;
|
|||
import jrummikub.util.IEvent;
|
||||
import jrummikub.view.IView;
|
||||
|
||||
public class TurnTimer implements ActionListener {
|
||||
public class TurnTimer implements ActionListener, ITurnTimer {
|
||||
private IView view;
|
||||
private int timeLeft = 60;
|
||||
private Timer timer;
|
||||
|
@ -23,14 +23,19 @@ public class TurnTimer implements ActionListener {
|
|||
view.getPlayerPanel().setTimeLeft(timeLeft);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void startTimer() {
|
||||
timer.start();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stopTimer() {
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
timeLeft--;
|
||||
|
@ -41,6 +46,7 @@ public class TurnTimer implements ActionListener {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent getTimeRunOutEvent() {
|
||||
return timeRunOutEvent;
|
||||
}
|
||||
|
|
Reference in a new issue