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
+30 -21
View File
@@ -11,6 +11,33 @@ class ScreenBottom {
this.BOTTOM_BAR_TEXT_OFFSET = 10;
this.bottomAreaPositionY = this.game.world.height - this.BOTTOM_BAR_HEIGHT;
let style = { font: "32px Arial", fill: "#fff", align: "left", boundsAlignH: "left", boundsAlignV: "bottom" };
let posX = this.BOTTOM_BAR_TEXT_OFFSET;
this.leftText = this.game.add.text(posX, this.bottomAreaPositionY, "", style)
.setTextBounds(0, 0, this.BOTTOM_BAR_NAME_WIDTH, this.BOTTOM_BAR_HEIGHT)
.addColor('#ffffff', 0);
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
// let style = { font: "32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "bottom" };
style.align = "center";
style.boundsAlignH = "center";
posX = game.world.width / 2 - this.BOTTOM_BAR_NAME_OFFSET_RIGHT;
this.centerText = this.game.add.text(0, this.bottomAreaPositionY, "", style)
.setTextBounds(0, 0, game.world.width, this.BOTTOM_BAR_HEIGHT)
.addColor('#ffffff', 0);
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
// let style = { font: "32px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "bottom" };
style.align = "right";
style.boundsAlignH = "right";
posX = game.world.width - this.BOTTOM_BAR_NAME_WIDTH - this.BOTTOM_BAR_TEXT_OFFSET;
this.rightText = this.game.add.text(posX, this.bottomAreaPositionY, "", style)
.setTextBounds(0, 0, this.BOTTOM_BAR_NAME_WIDTH, this.BOTTOM_BAR_HEIGHT)
.addColor('#ffffff', 0);
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
}
makeBottomLine() {
@@ -25,33 +52,15 @@ class ScreenBottom {
}
printBottomLeftText(text) {
let style = { font: "32px Arial", fill: "#fff", align: "left", boundsAlignH: "left", boundsAlignV: "bottom" };
let posX = this.BOTTOM_BAR_TEXT_OFFSET;
this.game.add.text(posX, this.bottomAreaPositionY, text, style)
.setTextBounds(0, 0, this.BOTTOM_BAR_NAME_WIDTH, this.BOTTOM_BAR_HEIGHT)
.addColor('#ffffff', 0);
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.leftText.text = text;
}
printBottomCenterText(text) {
let style = { font: "32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "bottom" };
let posX = game.world.width / 2 - this.BOTTOM_BAR_NAME_OFFSET_RIGHT;
this.game.add.text(0, this.bottomAreaPositionY, text, style)
.setTextBounds(0, 0, game.world.width, this.BOTTOM_BAR_HEIGHT)
.addColor('#ffffff', 0);
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.centerText.text = text;
}
printBottomRightText(text) {
let style = { font: "32px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "bottom" };
let posX = game.world.width - this.BOTTOM_BAR_NAME_WIDTH - this.BOTTOM_BAR_TEXT_OFFSET;
this.game.add.text(posX, this.bottomAreaPositionY, text, style)
.setTextBounds(0, 0, this.BOTTOM_BAR_NAME_WIDTH, this.BOTTOM_BAR_HEIGHT)
.addColor('#ffffff', 0);
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.rightText.text = text;
}
}