Keep a line in games list for negative answers to let the user know about them and dismiss the news when they read it

This commit is contained in:
Tissevert 2020-01-14 11:19:03 +01:00
parent 6127d0f25a
commit 66cade4cb2
3 changed files with 25 additions and 4 deletions

View File

@ -31,8 +31,15 @@ function init() {
GamesGUI.refresh();
});
Messaging.addEventListener(["Relay", "Answer"], function(o) {
Games.entries.remove(o.from);
GamesGUI.refresh();
var gameEntry = Games.entries.get(o.from);
if(gameEntry != undefined) {
if(!o.message.accept) {
gameEntry.answer = false;
} else {
Games.entries.remove(o.from);
}
GamesGUI.refresh();
}
});
Messaging.addEventListener(["Game"], function(o) {
GamesGUI.refresh();

View File

@ -23,8 +23,16 @@ function showGame(game) {
}
function gameProposal(game) {
var properties = {
textContent: I18n.get('proposedGame')(game.value.yourTurn, game.value.vs.name),
var properties = {};
if(game.value.answer != undefined) {
properties.textContent = I18n.get('refusedGame')(game.value.vs.name);
properties.class = 'clickable';
properties.onClick = function() {Games.entries.remove(game.key); refresh();};
} else {
properties.textContent = I18n.get('proposedGame')(
game.value.yourTurn,
game.value.vs.name
);
};
if(game.value.yourTurn) {
properties.onClick = answerDialog(game.value.vs.id);

View File

@ -46,6 +46,9 @@ return {
}
},
questionAccept: "Do you want to start the game ?",
refusedGame: function(name) {
return name + " refused your invitation";
},
startGameWith: "Start a game with",
theyScored: function(name) {
return name + " scored";
@ -101,6 +104,9 @@ return {
}
},
questionAccept: "Voulez-vous commencer la partie ?",
refusedGame: function(name) {
return name + " a décliné votre invitation";
},
startGameWith: "Commencer une partie avec",
theyScored: function(name) {
return name + " a marqué";