Add: ScreenBottom
This commit is contained in:
@@ -25,14 +25,11 @@ let bestRecord = 0;
|
||||
|
||||
{
|
||||
playerName = sessionStorage.getItem("playerName");
|
||||
console.log("playerName");
|
||||
console.log(playerName);
|
||||
console.log("playerName : " + playerName);
|
||||
playerUserID = sessionStorage.getItem("playerUserID");
|
||||
console.log("playerUserID");
|
||||
console.log(playerUserID);
|
||||
console.log("playerUserID : " + playerUserID);
|
||||
bestRecord = sessionStorage.getItem("bestRecord");
|
||||
console.log("bestRecord");
|
||||
console.log(bestRecord);
|
||||
console.log("bestRecord : " + bestRecord);
|
||||
}
|
||||
|
||||
let textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/////////////////////////////
|
||||
// Screen bottom
|
||||
|
||||
class ScreenBottom {
|
||||
|
||||
constructor(game) {
|
||||
this.game = game;
|
||||
|
||||
this.BOTTOM_BAR_HEIGHT = 50;
|
||||
this.BOTTOM_BAR_NAME_WIDTH = 200;
|
||||
this.BOTTOM_BAR_TEXT_OFFSET = 10;
|
||||
|
||||
this.bottomAreaPositionY = this.game.world.height - this.BOTTOM_BAR_HEIGHT;
|
||||
}
|
||||
|
||||
makeBottomLine() {
|
||||
this.game.add.graphics()
|
||||
.beginFill(0xffffff, 0.1)
|
||||
.drawRect(0, this.bottomAreaPositionY, game.world.width, this.BOTTOM_BAR_HEIGHT);
|
||||
|
||||
|
||||
this.printBottomLeftText(playerName);
|
||||
this.printBottomCenterText("메뉴");
|
||||
this.printBottomRightText(playerName);
|
||||
|
||||
let textStyleInfo = textStyleBasic; //$.extend( {}, textStyleBasic);
|
||||
textStyleInfo.font = "32px Arial";
|
||||
textStyleInfo.align = "right";
|
||||
textStyleInfo.boundsAlignH = "right";
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user