Fix: show all app list and disable some buttons
This commit is contained in:
+32
-12
@@ -49,25 +49,38 @@ class MenuApp {
|
||||
loadSucceeded(replyJSON) {
|
||||
console.log(replyJSON);
|
||||
|
||||
self.makeMouseAppButtons(replyJSON.MouseAppList);
|
||||
self.makeMouseAppButtons(
|
||||
replyJSON.MouseAppList,
|
||||
replyJSON.MouseActiveAppList
|
||||
);
|
||||
self.makeTypingButtons(
|
||||
replyJSON.TypingPracticeAppCount,
|
||||
replyJSON.TypingTestAppCount,
|
||||
replyJSON.TypingAppList
|
||||
replyJSON.TypingAppList,
|
||||
replyJSON.TypingActiveAppList
|
||||
);
|
||||
}
|
||||
|
||||
makeMouseAppButtons(mouseAppJSON) {
|
||||
// console.log(mouseAppJSON);
|
||||
hasApp(appID, appList) {
|
||||
for(let i = 0; i < appList.length; i++) {
|
||||
if(appList[i].AppID === appID)
|
||||
return true;
|
||||
}
|
||||
|
||||
let mouseAppCount = Object.keys(mouseAppJSON).length;
|
||||
return false;
|
||||
}
|
||||
|
||||
makeMouseAppButtons(appList, activeAppList) {
|
||||
// console.log(appList);
|
||||
|
||||
let mouseAppCount = Object.keys(appList).length;
|
||||
|
||||
for(let i = 0; i < mouseAppCount; i++) {
|
||||
let posX = self.getButtonPosX(i, mouseAppCount);
|
||||
let posY = self.getButtonPosY(i, mouseAppCount, GameAppButton.BUTTON_UPPER_POS_Y);
|
||||
|
||||
let app = mouseAppJSON[i];
|
||||
new GameAppButton(
|
||||
let app = appList[i];
|
||||
let gameAppButton = new GameAppButton(
|
||||
posX, posY, GameAppButton.TYPE_MOUSE_APP,
|
||||
"icon_fullscreen", app.KoreanName,
|
||||
() => {
|
||||
@@ -77,18 +90,21 @@ class MenuApp {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(app.AppID, activeAppList))
|
||||
gameAppButton.inputEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
makeTypingButtons(typingPracticeAppCount, typingTestAppCount, typingAppJSON) {
|
||||
makeTypingButtons(typingPracticeAppCount, typingTestAppCount, appList, activeAppList) {
|
||||
// console.log(typingPracticeAppCount);
|
||||
// console.log(typingTestAppCount);
|
||||
// console.log(typingAppJSON);
|
||||
// console.log(appList);
|
||||
|
||||
let isTypingPracticeAppExist = typingPracticeAppCount > 0 ? true : false;
|
||||
let isTypingTestAppExist = typingTestAppCount > 0 ? true : false;
|
||||
|
||||
let typingAppTotalCount = Object.keys(typingAppJSON).length;
|
||||
let typingAppTotalCount = Object.keys(appList).length;
|
||||
let typingAppIndex = 0;
|
||||
|
||||
|
||||
@@ -124,10 +140,10 @@ class MenuApp {
|
||||
typingButtonIndex, typingAppTotalCount, GameAppButton.BUTTON_LOWER_POS_Y
|
||||
);
|
||||
|
||||
let app = typingAppJSON[typingAppIndex];
|
||||
let app = appList[typingAppIndex];
|
||||
let isKoreanTypingApp = app.AppID < 32 ? true : false;
|
||||
|
||||
new GameAppButton(
|
||||
let gameAppButton = new GameAppButton(
|
||||
posX, posY, GameAppButton.TYPE_TYPING_APP,
|
||||
"icon_fullscreen",
|
||||
// (isKoreanTypingApp ? "(한글)" : "(영문)") + "\n" + app.KoreanName,
|
||||
@@ -139,6 +155,10 @@ class MenuApp {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(app.AppID, activeAppList))
|
||||
gameAppButton.inputEnabled = false;
|
||||
|
||||
typingAppIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class MenuTypingPractice {
|
||||
TypingPracticeButton.BUTTON_LOWER_POS_Y
|
||||
);
|
||||
|
||||
new TypingPracticeButton(
|
||||
let typingPracticeButton = new TypingPracticeButton(
|
||||
posX, posY,
|
||||
TypingPracticeButton.NONE_ICON,
|
||||
activeApp.KoreanName,
|
||||
|
||||
Reference in New Issue
Block a user