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:
parent
6127d0f25a
commit
66cade4cb2
3 changed files with 25 additions and 4 deletions
|
@ -31,8 +31,15 @@ function init() {
|
||||||
GamesGUI.refresh();
|
GamesGUI.refresh();
|
||||||
});
|
});
|
||||||
Messaging.addEventListener(["Relay", "Answer"], function(o) {
|
Messaging.addEventListener(["Relay", "Answer"], function(o) {
|
||||||
Games.entries.remove(o.from);
|
var gameEntry = Games.entries.get(o.from);
|
||||||
GamesGUI.refresh();
|
if(gameEntry != undefined) {
|
||||||
|
if(!o.message.accept) {
|
||||||
|
gameEntry.answer = false;
|
||||||
|
} else {
|
||||||
|
Games.entries.remove(o.from);
|
||||||
|
}
|
||||||
|
GamesGUI.refresh();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
Messaging.addEventListener(["Game"], function(o) {
|
Messaging.addEventListener(["Game"], function(o) {
|
||||||
GamesGUI.refresh();
|
GamesGUI.refresh();
|
||||||
|
|
|
@ -23,8 +23,16 @@ function showGame(game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function gameProposal(game) {
|
function gameProposal(game) {
|
||||||
var properties = {
|
var properties = {};
|
||||||
textContent: I18n.get('proposedGame')(game.value.yourTurn, game.value.vs.name),
|
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) {
|
if(game.value.yourTurn) {
|
||||||
properties.onClick = answerDialog(game.value.vs.id);
|
properties.onClick = answerDialog(game.value.vs.id);
|
||||||
|
|
|
@ -46,6 +46,9 @@ return {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
questionAccept: "Do you want to start the game ?",
|
questionAccept: "Do you want to start the game ?",
|
||||||
|
refusedGame: function(name) {
|
||||||
|
return name + " refused your invitation";
|
||||||
|
},
|
||||||
startGameWith: "Start a game with",
|
startGameWith: "Start a game with",
|
||||||
theyScored: function(name) {
|
theyScored: function(name) {
|
||||||
return name + " scored";
|
return name + " scored";
|
||||||
|
@ -101,6 +104,9 @@ return {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
questionAccept: "Voulez-vous commencer la partie ?",
|
questionAccept: "Voulez-vous commencer la partie ?",
|
||||||
|
refusedGame: function(name) {
|
||||||
|
return name + " a décliné votre invitation";
|
||||||
|
},
|
||||||
startGameWith: "Commencer une partie avec",
|
startGameWith: "Commencer une partie avec",
|
||||||
theyScored: function(name) {
|
theyScored: function(name) {
|
||||||
return name + " a marqué";
|
return name + " a marqué";
|
||||||
|
|
Loading…
Reference in a new issue