Fix: remove game argument for ScreenBottom constructor

This commit is contained in:
2018-05-16 10:26:40 +09:00
parent 3ed621d9f3
commit c307c69d8b
5 changed files with 14 additions and 24 deletions
+6 -8
View File
@@ -3,19 +3,17 @@
class ScreenBottom { class ScreenBottom {
constructor(game) { constructor() {
this.game = game;
this.BOTTOM_BAR_HEIGHT = 50; this.BOTTOM_BAR_HEIGHT = 50;
this.BOTTOM_BAR_NAME_WIDTH = 200; this.BOTTOM_BAR_NAME_WIDTH = 200;
this.BOTTOM_BAR_TEXT_OFFSET = 10; this.BOTTOM_BAR_TEXT_OFFSET = 10;
this.bottomAreaPositionY = this.game.world.height - this.BOTTOM_BAR_HEIGHT; this.bottomAreaPositionY = game.world.height - this.BOTTOM_BAR_HEIGHT;
let style = { font: "32px Arial", fill: "#fff", align: "left", boundsAlignH: "left", boundsAlignV: "bottom" }; let style = { font: "32px Arial", fill: "#fff", align: "left", boundsAlignH: "left", boundsAlignV: "bottom" };
let posX = this.BOTTOM_BAR_TEXT_OFFSET; let posX = this.BOTTOM_BAR_TEXT_OFFSET;
this.leftText = this.game.add.text(posX, this.bottomAreaPositionY, "", style) this.leftText = game.add.text(posX, this.bottomAreaPositionY, "", style)
.setTextBounds(0, 0, this.BOTTOM_BAR_NAME_WIDTH, this.BOTTOM_BAR_HEIGHT) .setTextBounds(0, 0, this.BOTTOM_BAR_NAME_WIDTH, this.BOTTOM_BAR_HEIGHT)
.addColor('#ffffff', 0); .addColor('#ffffff', 0);
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); // .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
@@ -24,7 +22,7 @@ class ScreenBottom {
style.align = "center"; style.align = "center";
style.boundsAlignH = "center"; style.boundsAlignH = "center";
posX = game.world.width / 2 - this.BOTTOM_BAR_NAME_OFFSET_RIGHT; posX = game.world.width / 2 - this.BOTTOM_BAR_NAME_OFFSET_RIGHT;
this.centerText = this.game.add.text(0, this.bottomAreaPositionY, "", style) this.centerText = game.add.text(0, this.bottomAreaPositionY, "", style)
.setTextBounds(0, 0, game.world.width, this.BOTTOM_BAR_HEIGHT) .setTextBounds(0, 0, game.world.width, this.BOTTOM_BAR_HEIGHT)
.addColor('#ffffff', 0); .addColor('#ffffff', 0);
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); // .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
@@ -34,14 +32,14 @@ class ScreenBottom {
style.align = "right"; style.align = "right";
style.boundsAlignH = "right"; style.boundsAlignH = "right";
posX = game.world.width - this.BOTTOM_BAR_NAME_WIDTH - this.BOTTOM_BAR_TEXT_OFFSET; posX = game.world.width - this.BOTTOM_BAR_NAME_WIDTH - this.BOTTOM_BAR_TEXT_OFFSET;
this.rightText = this.game.add.text(posX, this.bottomAreaPositionY, "", style) this.rightText = game.add.text(posX, this.bottomAreaPositionY, "", style)
.setTextBounds(0, 0, this.BOTTOM_BAR_NAME_WIDTH, this.BOTTOM_BAR_HEIGHT) .setTextBounds(0, 0, this.BOTTOM_BAR_NAME_WIDTH, this.BOTTOM_BAR_HEIGHT)
.addColor('#ffffff', 0); .addColor('#ffffff', 0);
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); // .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
} }
makeBottomLine() { makeBottomLine() {
this.game.add.graphics() game.add.graphics()
.beginFill(0xffffff, 0.1) .beginFill(0xffffff, 0.1)
.drawRect(0, this.bottomAreaPositionY, game.world.width, this.BOTTOM_BAR_HEIGHT); .drawRect(0, this.bottomAreaPositionY, game.world.width, this.BOTTOM_BAR_HEIGHT);
+1 -1
View File
@@ -38,7 +38,7 @@ class MenuApp {
// bottom // bottom
let screenBottom = new ScreenBottom(game); let screenBottom = new ScreenBottom();
screenBottom.makeBottomLine(); screenBottom.makeBottomLine();
// screenBottom.printBottomLeftText("게임 진행 정보"); // screenBottom.printBottomLeftText("게임 진행 정보");
let playingAppName = appInfoManager.getAppNameKorean(sessionStorageManager.playingAppName); let playingAppName = appInfoManager.getAppNameKorean(sessionStorageManager.playingAppName);
+1 -1
View File
@@ -53,7 +53,7 @@ class Game {
// bottom // bottom
let screenBottom = new ScreenBottom(game); let screenBottom = new ScreenBottom();
screenBottom.makeBottomLine(); screenBottom.makeBottomLine();
let highScore = NumberUtil.numberWithCommas(scoreManager.getHighScore()); let highScore = NumberUtil.numberWithCommas(scoreManager.getHighScore());
screenBottom.printBottomLeftText("최고 기록 : " + highScore); screenBottom.printBottomLeftText("최고 기록 : " + highScore);
+5 -13
View File
@@ -30,7 +30,7 @@ class Result {
// bottom // bottom
let screenBottom = new ScreenBottom(game); let screenBottom = new ScreenBottom();
screenBottom.makeBottomLine(); screenBottom.makeBottomLine();
screenBottom.printBottomLeftText("게임 진행 정보"); screenBottom.printBottomLeftText("게임 진행 정보");
let playingAppName = appInfoManager.getAppNameKorean(sessionStorageManager.playingAppName); let playingAppName = appInfoManager.getAppNameKorean(sessionStorageManager.playingAppName);
@@ -44,12 +44,12 @@ class Result {
} }
printScore() { printScore() {
const style = { font: "52px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" }; const style = { font: "64px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
game.add.text(0, 0, "결과", style) game.add.text(0, 0, "결과", style)
.setTextBounds(0, 0, game.world.width, 80) .setTextBounds(0, 0, game.world.width, 100)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
let posY = 100; let posY = 120;
let score = NumberUtil.numberWithCommas(sessionStorageManager.score); let score = NumberUtil.numberWithCommas(sessionStorageManager.score);
console.log(score); console.log(score);
style.font = "bold 80px Arial"; style.font = "bold 80px Arial";
@@ -68,20 +68,12 @@ class Result {
} }
printHowToPlay(text) {
const style = { font: "32px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
let howToPlayText = game.add.text(0, 0, appInfoManager.getHowToPlayText(sessionStorageManager.playingAppName), style);
howToPlayText.setTextBounds(100, 100, game.world.width - 100, 200);
howToPlayText.stroke = "#333";
howToPlayText.strokeThickness = 5;
}
makeStartButton() { makeStartButton() {
let setting = new RoundRectButtonSetting(200, 100); let setting = new RoundRectButtonSetting(200, 100);
setting.fontStyle.fontWeight = "bold"; setting.fontStyle.fontWeight = "bold";
let startButton = new RoundRectButton(setting, "다시 시작", this.startStage); let startButton = new RoundRectButton(setting, "다시 시작", this.startStage);
startButton.move(game.world.centerX, game.world.height / 2 - 60); startButton.move(game.world.centerX, game.world.height / 2 - 70);
} }
loadHistoryRecords() { loadHistoryRecords() {
+1 -1
View File
@@ -31,7 +31,7 @@ class Start {
// bottom // bottom
let screenBottom = new ScreenBottom(game); let screenBottom = new ScreenBottom();
screenBottom.makeBottomLine(); screenBottom.makeBottomLine();
screenBottom.printBottomLeftText("게임 진행 정보"); screenBottom.printBottomLeftText("게임 진행 정보");
let playingAppName = appInfoManager.getAppNameKorean(sessionStorageManager.playingAppName); let playingAppName = appInfoManager.getAppNameKorean(sessionStorageManager.playingAppName);