mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
GUI: fixed wrong feedback panel status in computer games (related to #11189)
This commit is contained in:
parent
598aaa7632
commit
abda1fb53b
5 changed files with 17 additions and 17 deletions
|
|
@ -81,7 +81,7 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep track of synced messages only
|
// keep track of synced messages only
|
||||||
if (!callback.getMethod().getType().canProcessInAnyOrder()) {
|
if (!callback.getMethod().getType().canComeInAnyOrder()) {
|
||||||
this.lastMessages.put(callback.getMethod().getType(), callback.getMessageId());
|
this.lastMessages.put(callback.getMethod().getType(), callback.getMessageId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -372,7 +372,7 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GAME_INFORM: {
|
case GAME_UPDATE_AND_INFORM: {
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
if (panel != null) {
|
if (panel != null) {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public enum ClientCallbackMethod {
|
||||||
// game
|
// game
|
||||||
START_GAME(ClientCallbackType.TABLE_CHANGE, "startGame"),
|
START_GAME(ClientCallbackType.TABLE_CHANGE, "startGame"),
|
||||||
GAME_INIT(ClientCallbackType.TABLE_CHANGE, "gameInit"),
|
GAME_INIT(ClientCallbackType.TABLE_CHANGE, "gameInit"),
|
||||||
GAME_INFORM(ClientCallbackType.MESSAGE, "gameInform"),
|
GAME_UPDATE_AND_INFORM(ClientCallbackType.UPDATE, "gameInform"), // update game and feedback panel with current status (e.g. on non our priority)
|
||||||
GAME_INFORM_PERSONAL(ClientCallbackType.MESSAGE, "gameInformPersonal"),
|
GAME_INFORM_PERSONAL(ClientCallbackType.MESSAGE, "gameInformPersonal"),
|
||||||
GAME_ERROR(ClientCallbackType.MESSAGE, "gameError"),
|
GAME_ERROR(ClientCallbackType.MESSAGE, "gameError"),
|
||||||
GAME_UPDATE(ClientCallbackType.UPDATE, "gameUpdate"),
|
GAME_UPDATE(ClientCallbackType.UPDATE, "gameUpdate"),
|
||||||
|
|
|
||||||
|
|
@ -7,26 +7,26 @@ package mage.interfaces.callback;
|
||||||
*/
|
*/
|
||||||
public enum ClientCallbackType {
|
public enum ClientCallbackType {
|
||||||
|
|
||||||
TABLE_CHANGE,
|
UPDATE(true, true), // game update
|
||||||
UPDATE(true, true),
|
TABLE_CHANGE, // all important game events + game update
|
||||||
MESSAGE(true, false),
|
MESSAGE(true, false), // show message/log without game update
|
||||||
DIALOG,
|
DIALOG, // all dialogs + game update
|
||||||
CLIENT_SIDE_EVENT(true, true);
|
CLIENT_SIDE_EVENT(true, true); // without game uodate
|
||||||
|
|
||||||
final boolean canProcessInAnyOrder;
|
final boolean canComeInAnyOrder;
|
||||||
final boolean mustIgnoreOnOutdated;
|
final boolean mustIgnoreOnOutdated; // if event come in any order and contain game update then it must be ignored on outdate
|
||||||
|
|
||||||
ClientCallbackType() {
|
ClientCallbackType() {
|
||||||
this(false, false);
|
this(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientCallbackType(boolean canProcessInAnyOrder, boolean mustIgnoreOnOutdated) {
|
ClientCallbackType(boolean canComeInAnyOrder, boolean mustIgnoreOnOutdated) {
|
||||||
this.canProcessInAnyOrder = canProcessInAnyOrder;
|
this.canComeInAnyOrder = canComeInAnyOrder;
|
||||||
this.mustIgnoreOnOutdated = mustIgnoreOnOutdated;
|
this.mustIgnoreOnOutdated = mustIgnoreOnOutdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canProcessInAnyOrder() {
|
public boolean canComeInAnyOrder() {
|
||||||
return this.canProcessInAnyOrder;
|
return this.canComeInAnyOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean mustIgnoreOnOutdated() {
|
public boolean mustIgnoreOnOutdated() {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class GameSessionWatcher {
|
||||||
|
|
||||||
public void inform(final String message) {
|
public void inform(final String message) {
|
||||||
if (!killed) {
|
if (!killed) {
|
||||||
userManager.getUser(userId).ifPresent(user -> user.fireCallback(new ClientCallback(ClientCallbackMethod.GAME_INFORM, game.getId(), new GameClientMessage(getGameView(), null, message))));
|
userManager.getUser(userId).ifPresent(user -> user.fireCallback(new ClientCallback(ClientCallbackMethod.GAME_UPDATE_AND_INFORM, game.getId(), new GameClientMessage(getGameView(), null, message))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class LoadCallbackClient implements CallbackClient {
|
||||||
// ignore bloaded logs
|
// ignore bloaded logs
|
||||||
switch (callback.getMethod()) {
|
switch (callback.getMethod()) {
|
||||||
case CHATMESSAGE:
|
case CHATMESSAGE:
|
||||||
case GAME_INFORM:
|
case GAME_UPDATE_AND_INFORM:
|
||||||
case GAME_UPDATE:
|
case GAME_UPDATE:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -77,7 +77,7 @@ public class LoadCallbackClient implements CallbackClient {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GAME_INFORM:
|
case GAME_UPDATE_AND_INFORM:
|
||||||
case GAME_INFORM_PERSONAL: {
|
case GAME_INFORM_PERSONAL: {
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
gameView = message.getGameView();
|
gameView = message.getGameView();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue