Fix: button classes revised
This commit is contained in:
+29
-35
@@ -20,7 +20,7 @@ class MenuApp {
|
||||
|
||||
new WelcomePlayerText(sessionStorageManager.playerName);
|
||||
|
||||
let fullscreenButton = new FullscreenButton(this.game);
|
||||
let fullscreenButton = new FullscreenButton();
|
||||
|
||||
|
||||
// bottom
|
||||
@@ -47,7 +47,7 @@ class MenuApp {
|
||||
}
|
||||
|
||||
loadSucceeded(replyJSON) {
|
||||
// console.log(replyJSON);
|
||||
console.log(replyJSON);
|
||||
|
||||
self.makeMouseAppButtons(replyJSON.MouseAppList);
|
||||
self.makeTypingButtons(
|
||||
@@ -68,7 +68,7 @@ class MenuApp {
|
||||
|
||||
let app = mouseAppJSON[i];
|
||||
new GameAppButton(
|
||||
posX, posY, AppButton.TYPE_MOUSE_APP,
|
||||
posX, posY, GameAppButton.TYPE_MOUSE_APP,
|
||||
"icon_fullscreen", app.KoreanName,
|
||||
() => {
|
||||
sessionStorageManager.playingAppID = app.AppID;
|
||||
@@ -88,11 +88,33 @@ class MenuApp {
|
||||
let isTypingPracticeAppExist = typingPracticeAppCount > 0 ? true : false;
|
||||
let isTypingTestAppExist = typingTestAppCount > 0 ? true : false;
|
||||
|
||||
let typingAppTotalCount = Object.keys(typingAppJSON).length
|
||||
+ (isTypingPracticeAppExist ? 1 : 0)
|
||||
+ (isTypingTestAppExist ? 1 : 0);
|
||||
let typingAppTotalCount = Object.keys(typingAppJSON).length;
|
||||
let typingAppIndex = 0;
|
||||
|
||||
|
||||
// typing tab buttons
|
||||
let typingPracticeTabButton = new TypingTabButton(
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 연습",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
}
|
||||
);
|
||||
if(typingPracticeAppCount === 0)
|
||||
typingPracticeTabButton.inputEnabled = false;
|
||||
|
||||
let typingTestTabButton = new TypingTabButton(
|
||||
TypingTabButton.TEST_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 시험",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
}
|
||||
);
|
||||
if(typingTestAppCount === 0)
|
||||
typingTestTabButton.inputEnabled = false;
|
||||
|
||||
|
||||
// typing app buttons
|
||||
for(let typingButtonIndex = 0; typingButtonIndex < typingAppTotalCount; typingButtonIndex++) {
|
||||
|
||||
let posX = self.getButtonPosX(
|
||||
@@ -102,39 +124,11 @@ class MenuApp {
|
||||
typingButtonIndex, typingAppTotalCount, GameAppButton.BUTTON_LOWER_POS_Y
|
||||
);
|
||||
|
||||
if(isTypingPracticeAppExist) {
|
||||
isTypingPracticeAppExist = false;
|
||||
|
||||
new GameAppButton(
|
||||
posX, posY, AppButton.TYPE_TYPING_PRACTICE,
|
||||
"", "타자 연습",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
}
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(isTypingTestAppExist) {
|
||||
isTypingTestAppExist = false;
|
||||
|
||||
new GameAppButton(
|
||||
posX, posY, AppButton.TYPE_TYPING_PRACTICE,
|
||||
"", "타자 시험",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
}
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
let app = typingAppJSON[typingAppIndex];
|
||||
let isKoreanTypingApp = app.AppID < 32 ? true : false;
|
||||
|
||||
new GameAppButton(
|
||||
posX, posY, AppButton.TYPE_TYPING_APP,
|
||||
posX, posY, GameAppButton.TYPE_TYPING_APP,
|
||||
"icon_fullscreen",
|
||||
// (isKoreanTypingApp ? "(한글)" : "(영문)") + "\n" + app.KoreanName,
|
||||
app.KoreanName,
|
||||
|
||||
@@ -19,6 +19,25 @@ class MenuTypingPractice {
|
||||
let fullscreenButton = new FullscreenButton(this.game);
|
||||
|
||||
|
||||
// typing tab buttons
|
||||
let typingPracticeTabButton = new TypingTabButton(
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 연습",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
}
|
||||
);
|
||||
typingPracticeTabButton.inputEnabled = false;
|
||||
|
||||
let typingTestTabButton = new TypingTabButton(
|
||||
TypingTabButton.TEST_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 시험",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
}
|
||||
);
|
||||
// typingTestTabButton.inputEnabled = false;
|
||||
|
||||
// bottom
|
||||
let screenBottom = new ScreenBottom();
|
||||
screenBottom.makeBottomLine();
|
||||
@@ -41,24 +60,33 @@ class MenuTypingPractice {
|
||||
|
||||
}
|
||||
|
||||
hasApp(appID, appList) {
|
||||
for(let i = 0; i < appList.length; i++) {
|
||||
if(appList[i].AppID === appID)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
downloadListSucceeded(replyJSON) {
|
||||
console.log(replyJSON);
|
||||
// console.log(replyJSON);
|
||||
|
||||
let buttonWidthGap = TypingPracticeButton.BUTTON_WIDTH + MenuTypingPractice.BUTTON_GAP;
|
||||
|
||||
let koreanTypingPracticeAppCount = Object.keys(replyJSON.Korean).length;
|
||||
let englishTypingPracticeAppCount = Object.keys(replyJSON.English).length;
|
||||
let koreanTypingPracticeAppCount = Object.keys(replyJSON.KoreanAppList).length;
|
||||
let englishTypingPracticeAppCount = Object.keys(replyJSON.EnglishAppList).length;
|
||||
|
||||
for(let i = 0; i < koreanTypingPracticeAppCount; i++) {
|
||||
let activeApp = replyJSON.Korean[i];
|
||||
let activeApp = replyJSON.KoreanAppList[i];
|
||||
|
||||
let posX = self.getButtonPosX(i, koreanTypingPracticeAppCount);
|
||||
let posY = self.getButtonPosY(i, koreanTypingPracticeAppCount,
|
||||
TypingPracticeButton.BUTTON_UPPER_POS_Y
|
||||
);
|
||||
|
||||
new TypingPracticeButton(
|
||||
posX, posY, LANGUAGE_KOREAN,
|
||||
let typingPracticeButton = new TypingPracticeButton(
|
||||
posX, posY,
|
||||
TypingPracticeButton.NONE_ICON,
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
@@ -68,10 +96,13 @@ class MenuTypingPractice {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(activeApp.AppID, replyJSON.KoreanActiveAppList))
|
||||
typingPracticeButton.inputEnabled = false;
|
||||
}
|
||||
|
||||
for(let i = 0; i < englishTypingPracticeAppCount; i++) {
|
||||
let activeApp = replyJSON.English[i];
|
||||
let activeApp = replyJSON.EnglishAppList[i];
|
||||
|
||||
let posX = self.getButtonPosX(i, englishTypingPracticeAppCount);
|
||||
let posY = self.getButtonPosY(i, englishTypingPracticeAppCount,
|
||||
@@ -79,7 +110,7 @@ class MenuTypingPractice {
|
||||
);
|
||||
|
||||
new TypingPracticeButton(
|
||||
posX, posY, LANGUAGE_ENGLISH,
|
||||
posX, posY,
|
||||
TypingPracticeButton.NONE_ICON,
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
@@ -89,6 +120,9 @@ class MenuTypingPractice {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(activeApp.AppID, replyJSON.EnglishActiveAppList))
|
||||
typingPracticeButton.inputEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,24 @@ class MenuTypingTest {
|
||||
screenBottom.printBottomCenterText("메뉴 > 타자 시험");
|
||||
screenBottom.printBottomRightText(sessionStorageManager.playerName);
|
||||
|
||||
// typing tab buttons
|
||||
let typingPracticeTabButton = new TypingTabButton(
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 연습",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
}
|
||||
);
|
||||
// typingPracticeTabButton.inputEnabled = false;
|
||||
|
||||
let typingTestTabButton = new TypingTabButton(
|
||||
TypingTabButton.TEST_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 시험",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
}
|
||||
);
|
||||
typingTestTabButton.inputEnabled = false;
|
||||
|
||||
this.makeActiveTypingTestAppButtons();
|
||||
}
|
||||
@@ -41,26 +59,33 @@ class MenuTypingTest {
|
||||
|
||||
}
|
||||
|
||||
hasApp(appID, appList) {
|
||||
for(let i = 0; i < appList.length; i++) {
|
||||
if(appList[i].AppID === appID)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
downloadListSucceeded(replyJSON) {
|
||||
// console.log(replyJSON);
|
||||
|
||||
let buttonWidthGap = TypingPracticeButton.BUTTON_WIDTH + MenuTypingTest.BUTTON_GAP;
|
||||
|
||||
let koreanTypingTestAppCount = Object.keys(replyJSON.Korean).length;
|
||||
let englishTypingTestAppCount = Object.keys(replyJSON.English).length;
|
||||
let koreanTypingPracticeAppCount = Object.keys(replyJSON.KoreanAppList).length;
|
||||
let englishTypingPracticeAppCount = Object.keys(replyJSON.EnglishAppList).length;
|
||||
|
||||
// let startX = game.world.width / 2 - (buttonWidthGap * koreanTypingTestAppCount / 2) - (buttonWidthGap / 2);
|
||||
// let koreanTypingTestAppIndex = 0;
|
||||
for(let i = 0; i < koreanTypingTestAppCount; i++) {
|
||||
let activeApp = replyJSON.Korean[i];
|
||||
for(let i = 0; i < koreanTypingPracticeAppCount; i++) {
|
||||
let activeApp = replyJSON.KoreanAppList[i];
|
||||
|
||||
let posX = self.getButtonPosX(i, koreanTypingTestAppCount);
|
||||
let posY = self.getButtonPosY(i, koreanTypingTestAppCount,
|
||||
let posX = self.getButtonPosX(i, koreanTypingPracticeAppCount);
|
||||
let posY = self.getButtonPosY(i, koreanTypingPracticeAppCount,
|
||||
TypingPracticeButton.BUTTON_UPPER_POS_Y
|
||||
);
|
||||
|
||||
new TypingPracticeButton(
|
||||
posX, posY, LANGUAGE_KOREAN,
|
||||
let typingTestButton = new TypingPracticeButton(
|
||||
posX, posY,
|
||||
TypingPracticeButton.NONE_ICON,
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
@@ -70,19 +95,21 @@ class MenuTypingTest {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(activeApp.AppID, replyJSON.KoreanActiveAppList))
|
||||
typingTestButton.inputEnabled = false;
|
||||
}
|
||||
|
||||
// startX = game.world.width / 2 - (buttonWidthGap * englishTypingTestAppCount / 2) - (buttonWidthGap / 2);
|
||||
for(let i = 0; i < englishTypingTestAppCount; i++) {
|
||||
let activeApp = replyJSON.English[i];
|
||||
for(let i = 0; i < englishTypingPracticeAppCount; i++) {
|
||||
let activeApp = replyJSON.EnglishAppList[i];
|
||||
|
||||
let posX = self.getButtonPosX(i, englishTypingTestAppCount);
|
||||
let posY = self.getButtonPosY(i, englishTypingTestAppCount,
|
||||
let posX = self.getButtonPosX(i, englishTypingPracticeAppCount);
|
||||
let posY = self.getButtonPosY(i, englishTypingPracticeAppCount,
|
||||
TypingPracticeButton.BUTTON_LOWER_POS_Y
|
||||
);
|
||||
|
||||
new TypingPracticeButton(
|
||||
posX, posY, LANGUAGE_ENGLISH,
|
||||
let typingTestButton = new TypingPracticeButton(
|
||||
posX, posY,
|
||||
TypingPracticeButton.NONE_ICON,
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
@@ -92,6 +119,9 @@ class MenuTypingTest {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(activeApp.AppID, replyJSON.EnglishActiveAppList))
|
||||
typingTestButton.inputEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user