time variable names corrected from "Last" to "Left"
This commit is contained in:
parent
58a8028bd5
commit
1c99fe4956
|
@ -7,7 +7,7 @@ public interface IStatemachine {
|
||||||
void setNewState(Statemachine.state newState);
|
void setNewState(Statemachine.state newState);
|
||||||
int getStateChangeCounter();
|
int getStateChangeCounter();
|
||||||
void handleInput(char input);
|
void handleInput(char input);
|
||||||
int getTimerSecondsLast();
|
int getTimerSecondsLeft();
|
||||||
int getTimerSeconds();
|
int getTimerSeconds();
|
||||||
void startTimer(int seconds);
|
void startTimer(int seconds);
|
||||||
void stopTimer();
|
void stopTimer();
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class Statemachine implements IStatemachine {
|
||||||
private long lastHandleInput;
|
private long lastHandleInput;
|
||||||
private int stateChangeCounter;
|
private int stateChangeCounter;
|
||||||
private state currentState;
|
private state currentState;
|
||||||
private int timertSecondsLast;
|
private int timertSecondsLeft;
|
||||||
private int timertSeconds;
|
private int timertSeconds;
|
||||||
|
|
||||||
public Statemachine() {
|
public Statemachine() {
|
||||||
|
@ -91,8 +91,8 @@ public class Statemachine implements IStatemachine {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTimerSecondsLast() {
|
public int getTimerSecondsLeft() {
|
||||||
return timertSecondsLast / 10;
|
return timertSecondsLeft / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,7 +102,7 @@ public class Statemachine implements IStatemachine {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startTimer(int seconds) {
|
public void startTimer(int seconds) {
|
||||||
timertSecondsLast = seconds*10;
|
timertSecondsLeft = seconds*10;
|
||||||
timertSeconds = seconds*10;
|
timertSeconds = seconds*10;
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class Statemachine implements IStatemachine {
|
||||||
@Override
|
@Override
|
||||||
public void stopTimer() {
|
public void stopTimer() {
|
||||||
if(timer != null) timer.cancel();
|
if(timer != null) timer.cancel();
|
||||||
timertSecondsLast = 0;
|
timertSecondsLeft = 0;
|
||||||
timertSeconds = 0;
|
timertSeconds = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public class Statemachine implements IStatemachine {
|
||||||
|
|
||||||
private void onTimerTick() {
|
private void onTimerTick() {
|
||||||
for(StatemachineListener listener: statemachineListenerList) {
|
for(StatemachineListener listener: statemachineListenerList) {
|
||||||
listener.timerTick(timertSecondsLast);
|
listener.timerTick(timertSecondsLeft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,11 +225,11 @@ public class Statemachine implements IStatemachine {
|
||||||
TimerTask timerTask = new TimerTask() {
|
TimerTask timerTask = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
timertSecondsLast--;
|
timertSecondsLeft--;
|
||||||
|
|
||||||
onTimerTick();
|
onTimerTick();
|
||||||
|
|
||||||
if(timertSecondsLast <= 0) {
|
if(timertSecondsLeft <= 0) {
|
||||||
if(timer != null) timer.cancel();
|
if(timer != null) timer.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,9 +149,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
|
||||||
|
|
||||||
// spieler haben 8 Minuten, wenn sie es in weniger als 4 minuten schaffen
|
// spieler haben 8 Minuten, wenn sie es in weniger als 4 minuten schaffen
|
||||||
// gibts +1, in weniger als 2 minuten gibts +2
|
// gibts +1, in weniger als 2 minuten gibts +2
|
||||||
if(machine.getTimerSecondsLast() >= 6*60 ) {
|
if(machine.getTimerSecondsLeft() >= 6*60 ) {
|
||||||
rate(2, "table game faster than 2 minutes");
|
rate(2, "table game faster than 2 minutes");
|
||||||
} else if(machine.getTimerSecondsLast() > 4*60) {
|
} else if(machine.getTimerSecondsLeft() > 4*60) {
|
||||||
rate(1, "table game faster than 4 minutes");
|
rate(1, "table game faster than 4 minutes");
|
||||||
}
|
}
|
||||||
if(machine.getStateChangeCounter() > 100) {
|
if(machine.getStateChangeCounter() > 100) {
|
||||||
|
@ -193,9 +193,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
|
||||||
|
|
||||||
// spieler haben 7 Minuten, wenn sie es in weniger als 4 minuten schaffen
|
// spieler haben 7 Minuten, wenn sie es in weniger als 4 minuten schaffen
|
||||||
// gibts +1, in weniger als 2 minuten gibts +2
|
// gibts +1, in weniger als 2 minuten gibts +2
|
||||||
if(machine.getTimerSecondsLast() >= 5*60 ) {
|
if(machine.getTimerSecondsLeft() >= 5*60 ) {
|
||||||
rate(2, "r0kets faster than 2 minutes");
|
rate(2, "r0kets faster than 2 minutes");
|
||||||
} else if(machine.getTimerSecondsLast() > 3*60) {
|
} else if(machine.getTimerSecondsLeft() > 3*60) {
|
||||||
rate(1, "r0kets faster than 4 minutes");
|
rate(1, "r0kets faster than 4 minutes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,16 +417,16 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
|
||||||
private void sayScore() {
|
private void sayScore() {
|
||||||
ircClient.say("stateChangeCounter: " + machine.getStateChangeCounter());
|
ircClient.say("stateChangeCounter: " + machine.getStateChangeCounter());
|
||||||
|
|
||||||
int secondsLast = machine.getTimerSecondsLast();
|
int secondsLeft = machine.getTimerSecondsLeft();
|
||||||
int seconds = machine.getTimerSeconds();
|
int seconds = machine.getTimerSeconds();
|
||||||
int secondsLeft = seconds - secondsLast;
|
int secondsUsed = seconds - secondsLeft;
|
||||||
|
|
||||||
int mins = seconds / 60;
|
int mins = seconds / 60;
|
||||||
int minsLast = secondsLast / 60;
|
int minsUsed = secondsUsed / 60;
|
||||||
int minsLeft = secondsLeft / 60;
|
int minsLeft = secondsLeft / 60;
|
||||||
|
|
||||||
ircClient.say(String.format("time: %d:%02d last: %d:%02d left: %d:%02d",
|
ircClient.say(String.format("time: %d:%02d used: %d:%02d left: %d:%02d",
|
||||||
mins, seconds % 60, minsLast, secondsLast % 60, minsLeft, secondsLeft % 60));
|
mins, seconds % 60, minsUsed, secondsUsed % 60, minsLeft, secondsLeft % 60));
|
||||||
|
|
||||||
ircClient.say("gamerRating: " + gamerRating);
|
ircClient.say("gamerRating: " + gamerRating);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue