Add: ScoreManager, ScoreBoard

This commit is contained in:
2018-05-13 16:15:46 +09:00
parent b720f940ec
commit b89490facd
9 changed files with 196 additions and 27 deletions
+16 -4
View File
@@ -11,6 +11,8 @@ class Game {
location.href = '../../web/client/menu_app.html';
});
let scoreBoard = new ScoreBoard();
let fullscreenButton = new FullscreenButton(this.game);
@@ -36,11 +38,22 @@ class Game {
// bottom
let screenBottom = new ScreenBottom(game);
screenBottom.makeBottomLine();
screenBottom.printBottomLeftText("게임 진행 정보");
let highScore = NumberUtil.numberWithCommas(scoreManager.getHighScore());
screenBottom.printBottomLeftText("최고 기록 : " + highScore);
let playingAppName = appInfoManager.getAppNameKorean(sessionStorageManager.playingAppName);
screenBottom.printBottomCenterText(playingAppName);
screenBottom.printBottomRightText(sessionStorageManager.playerName);
scoreManager.addOnChangeScoreFunctions( score => {
console.log("onChangeScore : " + score);
scoreBoard.printScore(NumberUtil.numberWithCommas(score));
});
scoreManager.addOnChangeHighScoreFunctions( highScore => {
console.log("onChangeHighScore : " + highScore);
screenBottom.printBottomLeftText("최고 기록 : " + NumberUtil.numberWithCommas(highScore));
});
this.startGame();
// this.countDown();
}
@@ -90,9 +103,8 @@ class Game {
}
onAlienFired(sprite) {
console.log("onAlienFired");
console.log("x : " + sprite.x + ", y : " + sprite.y);
let scoreText = new ScoreText(sprite.x, sprite.y, 30);
scoreManager.plusScore(3000);
let scoreText = new ScoreText(sprite.x, sprite.y, 3000);
}
onAlienEscaped() {