Fix: show all app list and disable some buttons
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
class GameAppButton extends RoundRectButton {
|
||||
|
||||
constructor(x, y, type, iconName, buttonText, clickEvent) {
|
||||
console.log(type);
|
||||
let setting = new RoundRectButtonSetting(
|
||||
x, y,
|
||||
GameAppButton.BUTTON_WIDTH, GameAppButton.BUTTON_HEIGHT
|
||||
|
||||
@@ -10,21 +10,21 @@ class TypingTabButton extends RoundRectButton {
|
||||
setting.strokeWidthPx = 5;
|
||||
|
||||
setting.setStrokeColor(
|
||||
0x444488,
|
||||
0x6666aa,
|
||||
0x6666aa,
|
||||
0x446688,
|
||||
0x6688aa,
|
||||
0x6688aa,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0xaaaadd,
|
||||
0xddddff,
|
||||
0xddddff,
|
||||
0xaabbdd,
|
||||
0xddeeff,
|
||||
0xddeeff,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#844",
|
||||
"#a66",
|
||||
"#a66",
|
||||
"#468",
|
||||
"#68a",
|
||||
"#68a",
|
||||
"#333"
|
||||
);
|
||||
|
||||
@@ -41,13 +41,13 @@ class TypingTabButton extends RoundRectButton {
|
||||
|
||||
}
|
||||
|
||||
TypingTabButton.BUTTON_WIDTH = 500;
|
||||
TypingTabButton.BUTTON_WIDTH = 480;
|
||||
TypingTabButton.BUTTON_HEIGHT = 80;
|
||||
|
||||
TypingTabButton.BUTTON_GAP = 20;
|
||||
TypingTabButton.MARGIN_VERTICAL = 100;
|
||||
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X = GAME_SCREEN_SIZE.x / 4;
|
||||
TypingTabButton.TEST_BUTTON_POS_X = GAME_SCREEN_SIZE.x / 4 * 3;
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X = GAME_SCREEN_SIZE.x / 4 + TypingTabButton.BUTTON_GAP / 2;
|
||||
TypingTabButton.TEST_BUTTON_POS_X = GAME_SCREEN_SIZE.x / 4 * 3 - TypingTabButton.BUTTON_GAP / 2;
|
||||
|
||||
TypingTabButton.BUTTON_POS_Y = GAME_SCREEN_SIZE.y - (TypingTabButton.BUTTON_HEIGHT / 3 * 4);
|
||||
+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,
|
||||
|
||||
@@ -20,7 +20,8 @@ class TypingPractice {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
});
|
||||
|
||||
this.animalOnTitle = new Animal(Animal.TYPE_ON_TITLE, game.world.centerX - 200, 30);
|
||||
// this.animalOnTitle = new Animal(Animal.TYPE_ON_TITLE, game.world.centerX - 200, 30);
|
||||
this.animalOnTitle = new Animal(Animal.TYPE_ON_TITLE, game.world.centerX, 90);
|
||||
this.animalOnTitle.setSpecies(Animal.SPECIES_DATA[0]);
|
||||
this.animalOnTitle.startAnimation();
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ class TypingTest {
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
});
|
||||
|
||||
this.animalOnTitle = new Animal(Animal.TYPE_ON_TITLE, game.world.centerX - 200, 30);
|
||||
// this.animalOnTitle = new Animal(Animal.TYPE_ON_TITLE, game.world.centerX - 200, 30);
|
||||
this.animalOnTitle = new Animal(Animal.TYPE_ON_TITLE, game.world.centerX, GAME_SCREEN_SIZE.y - 110);
|
||||
this.animalOnTitle.setSpecies(Animal.SPECIES_DATA[0]);
|
||||
this.animalOnTitle.startAnimation();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user