mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Auto-pause playback if mouse down anywhere above prompt or if device pauses game
This commit is contained in:
@@ -6,7 +6,6 @@ import forge.FThreads;
|
||||
import forge.GuiBase;
|
||||
import forge.game.event.*;
|
||||
import forge.match.input.InputPlaybackControl;
|
||||
|
||||
import java.util.concurrent.BrokenBarrierException;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -173,5 +172,4 @@ public class FControlGamePlayback extends IGameEventVisitor.Base<Void> {
|
||||
public void setSpeed(boolean isFast) {
|
||||
fasterPlayback = isFast;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,14 +8,10 @@ public class InputPlaybackControl extends InputSyncronizedBase implements InputS
|
||||
private static final long serialVersionUID = 7979208993306642072L;
|
||||
|
||||
FControlGamePlayback control;
|
||||
|
||||
|
||||
private boolean isPaused = false;
|
||||
private boolean isFast = false;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for Constructor.
|
||||
* @param fControlGamePlayback
|
||||
*/
|
||||
|
||||
public InputPlaybackControl(FControlGamePlayback fControlGamePlayback) {
|
||||
control = fControlGamePlayback;
|
||||
}
|
||||
@@ -28,43 +24,49 @@ public class InputPlaybackControl extends InputSyncronizedBase implements InputS
|
||||
setPause(false);
|
||||
ButtonUtil.enableAllFocusOk();
|
||||
}
|
||||
|
||||
|
||||
private void setPause(boolean pause) {
|
||||
isPaused = pause;
|
||||
if ( isPaused )
|
||||
if (isPaused) {
|
||||
ButtonUtil.setButtonText("Resume", "Step");
|
||||
else {
|
||||
}
|
||||
else {
|
||||
ButtonUtil.setButtonText("Pause", isFast ? "1x Speed" : "10x Faster");
|
||||
showMessage("Press pause to pause game.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onGamePaused() {
|
||||
showMessage(getTurnPhasePriorityMessage(GuiBase.getInterface().getGame()));
|
||||
}
|
||||
|
||||
|
||||
public void pause() {
|
||||
if (isPaused) { return; }
|
||||
control.pause();
|
||||
setPause(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onOk() {
|
||||
if ( isPaused ) {
|
||||
if (isPaused) {
|
||||
control.resume();
|
||||
setPause(false);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
control.pause();
|
||||
setPause(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCancel() {
|
||||
if ( isPaused ) {
|
||||
if (isPaused) {
|
||||
control.singleStep();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
isFast = !isFast;
|
||||
control.setSpeed(isFast);
|
||||
setPause(isPaused); // update message
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user