forked from External/mage
Added option to activate/deactivate JSON game log. Added logic to write the logs to subdirectory. Some changes to SEND_PLAYER_ACTION type logging.
This commit is contained in:
parent
dc5220df4f
commit
b60522f9e4
7 changed files with 138 additions and 70 deletions
|
|
@ -190,16 +190,15 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
break;
|
||||
}
|
||||
case GAME_OVER: {
|
||||
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
|
||||
if (panel != null) {
|
||||
appendJsonEvent("GAME_OVER", callback.getObjectId(), callback.getData());
|
||||
ActionData actionData = appendJsonEvent("GAME_OVER", callback.getObjectId(), callback.getData());
|
||||
String logFileName = "game-" + actionData.gameId + ".json";
|
||||
|
||||
S3Uploader.upload(logFileName, actionData.gameId.toString());
|
||||
|
||||
Session session = SessionHandler.getSession();
|
||||
if (session.isJsonLogActive()) {
|
||||
appendJsonEvent("GAME_OVER", callback.getObjectId(), callback.getData());
|
||||
ActionData actionData = appendJsonEvent("GAME_OVER", callback.getObjectId(), callback.getData());
|
||||
String logFileName = "game-" + actionData.gameId + ".json";
|
||||
S3Uploader.upload(logFileName, actionData.gameId.toString());
|
||||
}
|
||||
panel.endMessage((String) callback.getData(), callback.getMessageId());
|
||||
}
|
||||
break;
|
||||
|
|
@ -408,10 +407,13 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
|
||||
private ActionData appendJsonEvent(String name, UUID gameId, Object value) {
|
||||
Session session = SessionHandler.getSession();
|
||||
ActionData actionData = new ActionData(name, gameId);
|
||||
actionData.value = value;
|
||||
session.appendJsonLog(actionData);
|
||||
return actionData;
|
||||
if (session.isJsonLogActive()) {
|
||||
ActionData actionData = new ActionData(name, gameId);
|
||||
actionData.value = value;
|
||||
session.appendJsonLog(actionData);
|
||||
return actionData;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void createChatStartMessage(ChatPanelBasic chatPanel) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue