Stop emitting the (temporarily ?) deprecated Quit message at the endof a game and factorize the function to go back to main menu instead

This commit is contained in:
Tissevert 2020-01-16 22:33:41 +01:00
parent 38ccd13634
commit 421b91c0ff

View file

@ -38,13 +38,15 @@ function init(gameID) {
);
}
function backToMain() {
window.location = '..';
}
function fail(errorCode) {
return function(f) {
Screen.dialog({
text: I18n.get(errorCode),
answers: [
{label: 'backToMain', action: function() {window.location = '..';}}
]
answers: [{label: 'backToMain', action: backToMain}]
});
}
}
@ -160,14 +162,7 @@ function gameEnd(o, f) {
}
Screen.dialog({
text: I18n.get(Session.is(winner) ? 'won' : 'lost'),
answers: [{
label: 'endGame',
action: function() {
Messaging.send({tag: "Quit"});
Screen.select('reception');
f();
}
}]
answers: [{label: 'endGame', action: backToMain}]
});
}