Fix: button classes revised
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user