Fix: some bugs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class AppButton {
|
||||
|
||||
constructor(x, y, type, iconName, clickEvent) {
|
||||
constructor(x, y, type, iconName, appText, clickEvent) {
|
||||
let setting = new RoundRectButtonSetting(150, 150);
|
||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
@@ -46,14 +46,23 @@ class AppButton {
|
||||
);
|
||||
}
|
||||
|
||||
let icon_fullscreen = game.add.sprite(0, 0, iconName);
|
||||
icon_fullscreen.width = 80;
|
||||
icon_fullscreen.height = 80;
|
||||
|
||||
this.button = new RoundRectButton(setting, "", clickEvent);
|
||||
this.button.setIcon(icon_fullscreen);
|
||||
|
||||
this.move(x, y);
|
||||
|
||||
if(iconName.length > 0) {
|
||||
let icon_fullscreen = game.add.sprite(0, 0, iconName);
|
||||
icon_fullscreen.width = 80;
|
||||
icon_fullscreen.height = 80;
|
||||
this.button.setIcon(icon_fullscreen);
|
||||
}
|
||||
|
||||
if(appText.length > 0) {
|
||||
const style = { font: "32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
let icon_text = game.add.text(0, 0, appText, style);
|
||||
icon_text.setTextBounds(x - 50, y - 50, 100, 100);
|
||||
icon_text.stroke = "#333";
|
||||
icon_text.strokeThickness = 5;
|
||||
}
|
||||
}
|
||||
|
||||
move(x, y) {
|
||||
@@ -63,4 +72,7 @@ class AppButton {
|
||||
}
|
||||
|
||||
AppButton.TYPE_MOUSE = 0;
|
||||
AppButton.TYPE_TYPING = 1;
|
||||
AppButton.TYPE_TYPING = 1;
|
||||
|
||||
AppButton.NONE_ICON = "";
|
||||
AppButton.NONE_BUTTON_TEXT = "";
|
||||
@@ -47,7 +47,7 @@ class MenuApp {
|
||||
// console.log(replyJSON);
|
||||
|
||||
let mouseAppCount = self.getAppCount(replyJSON, AppButton.TYPE_MOUSE);
|
||||
let typingAppCount = self.getAppCount(replyJSON, AppButton.TYPE_TYPING);
|
||||
let typingPracticeAppCount = self.getAppCount(replyJSON, AppButton.TYPE_TYPING);
|
||||
|
||||
let startX = game.world.width / 2 - (150 * mouseAppCount / 2) - (150 / 2);
|
||||
let mouseAppIndex = 0;
|
||||
@@ -55,7 +55,8 @@ class MenuApp {
|
||||
let activeApp = replyJSON[i];
|
||||
if(self.isMouseApp(activeApp)) {
|
||||
mouseAppIndex++;
|
||||
new AppButton(startX + 150 * mouseAppIndex, 300, AppButton.TYPE_MOUSE, activeApp.AppName,
|
||||
new AppButton(startX + 150 * mouseAppIndex, 300, AppButton.TYPE_MOUSE,
|
||||
activeApp.AppName, AppButton.NONE_BUTTON_TEXT,
|
||||
() => {
|
||||
sessionStorageManager.playingAppID = activeApp.AppID;
|
||||
sessionStorageManager.playingAppName = activeApp.AppName;
|
||||
@@ -65,8 +66,9 @@ class MenuApp {
|
||||
}
|
||||
}
|
||||
|
||||
if(typingAppCount > 0) {
|
||||
new AppButton(game.world.width / 2, 500, AppButton.TYPE_TYPING, "icon_fullscreen",
|
||||
if(typingPracticeAppCount > 0) {
|
||||
new AppButton(game.world.width / 2, 500, AppButton.TYPE_TYPING,
|
||||
"icon_fullscreen", "타자 연습\n(임시)",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
}
|
||||
|
||||
@@ -14,8 +14,7 @@ class MenuTypingPractice {
|
||||
|
||||
// top
|
||||
let backButton = new BackButton( () => {
|
||||
sessionStorageManager.clear();
|
||||
location.href = '../../web/client/login.html';
|
||||
location.href = '../../web/client/menu_app.html';
|
||||
});
|
||||
let fullscreenButton = new FullscreenButton(this.game);
|
||||
|
||||
@@ -55,7 +54,8 @@ class MenuTypingPractice {
|
||||
let activeApp = replyJSON[i];
|
||||
if(self.isMouseApp(activeApp)) {
|
||||
mouseAppIndex++;
|
||||
new AppButton(startX + 150 * mouseAppIndex, 300, AppButton.TYPE_MOUSE, activeApp.AppName,
|
||||
new AppButton(startX + 150 * mouseAppIndex, 300, AppButton.TYPE_MOUSE,
|
||||
AppButton.NONE_ICON, "양손 기본",
|
||||
() => {
|
||||
sessionStorageManager.playingAppID = activeApp.AppID;
|
||||
sessionStorageManager.playingAppName = activeApp.AppName;
|
||||
@@ -66,7 +66,8 @@ class MenuTypingPractice {
|
||||
}
|
||||
|
||||
if(typingAppCount > 0) {
|
||||
new AppButton(game.world.width / 2, 500, AppButton.TYPE_TYPING, "icon_fullscreen",
|
||||
new AppButton(game.world.width / 2, 500, AppButton.TYPE_TYPING,
|
||||
AppButton.NONE_ICON, "검지 글쇠",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_app.html';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user