mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
check awaitNextInputTimer
This commit is contained in:
@@ -461,17 +461,13 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
|
||||
@Override
|
||||
public final void awaitNextInput() {
|
||||
if (awaitNextInputTimer == null) {
|
||||
String name = "?";
|
||||
if (this.currentPlayer != null)
|
||||
name = this.currentPlayer.getLobbyPlayerName();
|
||||
awaitNextInputTimer = new Timer("awaitNextInputTimer Game:" + this.gameView.getId() + " Player:" + name);
|
||||
}
|
||||
checkAwaitNextInputTimer();
|
||||
//delay updating prompt to await next input briefly so buttons don't flicker disabled then enabled
|
||||
awaitNextInputTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
FThreads.invokeInEdtLater(() -> {
|
||||
checkAwaitNextInputTimer();
|
||||
synchronized (awaitNextInputTimer) {
|
||||
if (awaitNextInputTask != null) {
|
||||
updatePromptForAwait(getCurrentPlayer());
|
||||
@@ -483,6 +479,14 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
};
|
||||
awaitNextInputTimer.schedule(awaitNextInputTask, 250);
|
||||
}
|
||||
private void checkAwaitNextInputTimer() {
|
||||
if (awaitNextInputTimer == null) {
|
||||
String name = "?";
|
||||
if (this.currentPlayer != null)
|
||||
name = this.currentPlayer.getLobbyPlayerName();
|
||||
awaitNextInputTimer = new Timer("awaitNextInputTimer Game:" + this.gameView.getId() + " Player:" + name);
|
||||
}
|
||||
}
|
||||
|
||||
protected final void updatePromptForAwait(final PlayerView playerView) {
|
||||
showPromptMessage(playerView, Localizer.getInstance().getMessage("lblWaitingForOpponent"));
|
||||
|
||||
Reference in New Issue
Block a user