GUI: fixed wrong feedback panel status in computer games (related to #11189)

This commit is contained in:
Oleg Agafonov 2023-09-22 11:00:47 +04:00
parent 598aaa7632
commit abda1fb53b
5 changed files with 17 additions and 17 deletions

View file

@ -81,7 +81,7 @@ public class CallbackClientImpl implements CallbackClient {
}
// keep track of synced messages only
if (!callback.getMethod().getType().canProcessInAnyOrder()) {
if (!callback.getMethod().getType().canComeInAnyOrder()) {
this.lastMessages.put(callback.getMethod().getType(), callback.getMessageId());
}
}
@ -372,7 +372,7 @@ public class CallbackClientImpl implements CallbackClient {
break;
}
case GAME_INFORM: {
case GAME_UPDATE_AND_INFORM: {
GameClientMessage message = (GameClientMessage) callback.getData();
GamePanel panel = MageFrame.getGame(callback.getObjectId());
if (panel != null) {

View file

@ -49,7 +49,7 @@ public enum ClientCallbackMethod {
// game
START_GAME(ClientCallbackType.TABLE_CHANGE, "startGame"),
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_ERROR(ClientCallbackType.MESSAGE, "gameError"),
GAME_UPDATE(ClientCallbackType.UPDATE, "gameUpdate"),

View file

@ -7,26 +7,26 @@ package mage.interfaces.callback;
*/
public enum ClientCallbackType {
TABLE_CHANGE,
UPDATE(true, true),
MESSAGE(true, false),
DIALOG,
CLIENT_SIDE_EVENT(true, true);
UPDATE(true, true), // game update
TABLE_CHANGE, // all important game events + game update
MESSAGE(true, false), // show message/log without game update
DIALOG, // all dialogs + game update
CLIENT_SIDE_EVENT(true, true); // without game uodate
final boolean canProcessInAnyOrder;
final boolean mustIgnoreOnOutdated;
final boolean canComeInAnyOrder;
final boolean mustIgnoreOnOutdated; // if event come in any order and contain game update then it must be ignored on outdate
ClientCallbackType() {
this(false, false);
}
ClientCallbackType(boolean canProcessInAnyOrder, boolean mustIgnoreOnOutdated) {
this.canProcessInAnyOrder = canProcessInAnyOrder;
ClientCallbackType(boolean canComeInAnyOrder, boolean mustIgnoreOnOutdated) {
this.canComeInAnyOrder = canComeInAnyOrder;
this.mustIgnoreOnOutdated = mustIgnoreOnOutdated;
}
public boolean canProcessInAnyOrder() {
return this.canProcessInAnyOrder;
public boolean canComeInAnyOrder() {
return this.canComeInAnyOrder;
}
public boolean mustIgnoreOnOutdated() {

View file

@ -58,7 +58,7 @@ public class GameSessionWatcher {
public void inform(final String message) {
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))));
}
}

View file

@ -45,7 +45,7 @@ public class LoadCallbackClient implements CallbackClient {
// ignore bloaded logs
switch (callback.getMethod()) {
case CHATMESSAGE:
case GAME_INFORM:
case GAME_UPDATE_AND_INFORM:
case GAME_UPDATE:
break;
default:
@ -77,7 +77,7 @@ public class LoadCallbackClient implements CallbackClient {
break;
}
case GAME_INFORM:
case GAME_UPDATE_AND_INFORM:
case GAME_INFORM_PERSONAL: {
GameClientMessage message = (GameClientMessage) callback.getData();
gameView = message.getGameView();