Fix: screen top ui, screen bottom ui

This commit is contained in:
2018-09-03 09:15:50 +09:00
parent ac46b61539
commit 8cf7f67ac6
24 changed files with 197 additions and 153 deletions
+6 -6
View File
@@ -22,9 +22,9 @@ class TypingAppButton extends RoundRectButton {
0x666666
);
setting.setTextColor(
"#668",
"#668",
"#668",
"#66c",
"#66c",
"#66c",
"#333"
);
break;
@@ -44,9 +44,9 @@ class TypingAppButton extends RoundRectButton {
0x666666
);
setting.setTextColor(
"#866",
"#866",
"#866",
"#a66",
"#a66",
"#a66",
"#333"
);
break;
@@ -1,41 +1,41 @@
/////////////////////////////
// Screen bottom
class ScreenBottom {
class ScreenBottomUI {
constructor() {
this.dbConnectManager = new DBConnectManager();
this.bottomBarCenterY = game.world.height - ScreenBottom.BOTTOM_BAR_HEIGHT / 2;
this.bottomBarCenterY = game.world.height - ScreenBottomUI.BG_HEIGHT / 2;
this.makeBottomLine();
this.leftText = this.printBottomText(this.leftText, "", "left");
this.centerText = this.printBottomText(this.centerText, "", "center");
this.rightText = this.printBottomText(this.rightText, "", "right");
this.drawBG();
this.leftText = this.printText(this.leftText, "", "left");
this.centerText = this.printText(this.centerText, "", "center");
this.rightText = this.printText(this.rightText, "", "right");
}
makeBottomLine() {
drawBG() {
game.add.graphics()
.beginFill(0x303030, 1)
.drawRect(
0, game.world.height - ScreenBottom.BOTTOM_BAR_HEIGHT,
game.world.width, ScreenBottom.BOTTOM_BAR_HEIGHT
0, game.world.height - ScreenBottomUI.BG_HEIGHT,
game.world.width, ScreenBottomUI.BG_HEIGHT
);
}
printBottomLeftText(text) {
printLeftText(text) {
this.leftText.text = text;
}
printBottomCenterText(text) {
printCenterText(text) {
this.centerText.text = text;
}
printBottomRightText(text) {
printRightText(text) {
this.rightText.text = text;
}
printBottomText(textObject, text, align) {
printText(textObject, text, align) {
if(textObject !== null && textObject !== undefined) {
textObject.text = "";
textObject = null;
@@ -45,7 +45,7 @@ class ScreenBottom {
let anchorValue = 0;
switch(align) {
case "left":
posX = ScreenBottom.BOTTOM_BAR_TEXT_OFFSET;
posX = ScreenBottomUI.TEXT_OFFSET;
break;
case "center":
@@ -54,7 +54,7 @@ class ScreenBottom {
break;
case "right":
posX = game.world.width - ScreenBottom.BOTTOM_BAR_TEXT_OFFSET;
posX = game.world.width - ScreenBottomUI.TEXT_OFFSET;
anchorValue = 1;
break;
}
@@ -67,10 +67,10 @@ class ScreenBottom {
return textObject;
}
printBottomLeftTextWithBestRecord(bestRecord) {
printLeftTextWithBestRecord(bestRecord) {
let roundUpBestRecord = Math.round(bestRecord);
let highScoreWithCommas = NumberUtil.numberWithCommas(roundUpBestRecord);
this.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
this.printLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
}
getFontStyle() {
@@ -79,6 +79,7 @@ class ScreenBottom {
}
ScreenBottom.BOTTOM_BAR_HEIGHT = 50;
ScreenBottom.BOTTOM_BAR_NAME_WIDTH = 200;
ScreenBottom.BOTTOM_BAR_TEXT_OFFSET = 10;
ScreenBottomUI.BG_HEIGHT = 50;
ScreenBottomUI.NAME_WIDTH = 200;
ScreenBottomUI.TEXT_OFFSET = 10;
+30
View File
@@ -0,0 +1,30 @@
/////////////////////////////
// Screen top ui
class ScreenTopUI {
constructor() {
this.drawBG();
}
drawBG() {
game.add.graphics()
.beginFill(0x303030, 1)
.drawRect(
0, 0,
game.world.width, ScreenTopUI.BG_HEIGHT
);
}
makeBackButton(eventHandler) {
this.backButton = new BackButton(eventHandler);
}
makeFullScreenButton() {
// this.fullscreenButton = new FullscreenButton();
}
}
ScreenTopUI.BG_HEIGHT = 60;