fix merge conflict

This commit is contained in:
Gabriele Cirulli
2014-03-12 11:23:22 +01:00
7 changed files with 88 additions and 17 deletions
+10 -2
View File
@@ -1,6 +1,7 @@
function HTMLActuator() {
this.tileContainer = document.querySelector(".tile-container");
this.scoreContainer = document.querySelector(".score-container");
this.bestContainer = document.querySelector(".best-container");
this.messageContainer = document.querySelector(".game-message");
this.score = 0;
@@ -21,6 +22,7 @@ HTMLActuator.prototype.actuate = function (grid, metadata) {
});
self.updateScore(metadata.score);
self.updateBestScore(metadata.bestScore);
if (metadata.over) self.message(false); // You lose
if (metadata.won) self.message(true); // You win!
@@ -103,11 +105,17 @@ HTMLActuator.prototype.updateScore = function (score) {
}
};
HTMLActuator.prototype.updateBestScore = function (bestScore) {
this.bestContainer.textContent = bestScore;
};
HTMLActuator.prototype.message = function (won) {
var type = won ? "game-won" : "game-over";
var message = won ? "You win!" : "Game over!"
var message = won ? "You win!" : "Game over!";
// if (ga) ga("send", "event", "game", "end", type, this.score);
if (typeof ga !== "undefined") {
ga("send", "event", "game", "end", type, this.score);
}
this.messageContainer.classList.add(type);
this.messageContainer.getElementsByTagName("p")[0].textContent = message;