Add: show animal icon in typing app button
This commit is contained in:
@@ -32,22 +32,22 @@ class MenuTypingTest {
|
||||
0, 60 + AppAreaBG.GAP_Y,
|
||||
GAME_SCREEN_SIZE.x, 270
|
||||
);
|
||||
koreanBG.printText(
|
||||
"한 글 타 자",
|
||||
game.world.centerX, 320,
|
||||
36, "#000", 0.05
|
||||
);
|
||||
// koreanBG.printText(
|
||||
// "한 글 타 자",
|
||||
// game.world.centerX, 320,
|
||||
// 36, "#000", 0.05
|
||||
// );
|
||||
|
||||
// english app area
|
||||
let englishBG = new AppAreaBG(AppAreaBG.COLOR_TYPING_ENGLISH, 1,
|
||||
0, 340,
|
||||
GAME_SCREEN_SIZE.x, 270
|
||||
);
|
||||
englishBG.printText(
|
||||
"영 문 타 자",
|
||||
game.world.centerX, 370,
|
||||
36, "#000", 0.05
|
||||
);
|
||||
// englishBG.printText(
|
||||
// "영 문 타 자",
|
||||
// game.world.centerX, 370,
|
||||
// 36, "#000", 0.05
|
||||
// );
|
||||
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ class MenuTypingTest {
|
||||
let dbConnectManager = new DBConnectManager();
|
||||
dbConnectManager.requestTypingTestAppList(
|
||||
sessionStorageManager.maestroID,
|
||||
sessionStorageManager.playerID,
|
||||
self.downloadListSucceeded,
|
||||
self.downloadListFailed
|
||||
);
|
||||
@@ -99,6 +100,27 @@ class MenuTypingTest {
|
||||
return false;
|
||||
}
|
||||
|
||||
getBestRecord(jsonList, appID) {
|
||||
let count = Object.keys(jsonList).length;
|
||||
|
||||
for(let i = 0; i < count; i++) {
|
||||
if(jsonList[i].AppID === appID)
|
||||
return jsonList[i].BestRecord;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
getIconImage(jsonList, appID) {
|
||||
let bestRecord = this.getBestRecord(jsonList, appID);
|
||||
|
||||
if(bestRecord === 0)
|
||||
return "snail_shadow";
|
||||
|
||||
let animalLevel = Animal.animalLevelIDByRecord(bestRecord, Animal.TYPE_PRACTICE);
|
||||
return Animal.SPECIES_DATA[animalLevel].species + Animal.SPRITE_NAMES.icon;
|
||||
}
|
||||
|
||||
downloadListSucceeded(replyJSON) {
|
||||
// console.log(replyJSON);
|
||||
|
||||
@@ -115,11 +137,10 @@ class MenuTypingTest {
|
||||
TypingAppButton.BUTTON_UPPER_POS_Y
|
||||
);
|
||||
|
||||
let iconImage = "snail_shadow";
|
||||
let typingTestButton = new TypingAppButton(
|
||||
TypingAppButton.TYPE_TEST_KOREAN,
|
||||
posX, posY,
|
||||
iconImage,
|
||||
self.getIconImage(replyJSON.KoreanHighScoreList, activeApp.AppID),
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
sessionStorageManager.playingAppID = activeApp.AppID;
|
||||
@@ -141,11 +162,10 @@ class MenuTypingTest {
|
||||
TypingAppButton.BUTTON_LOWER_POS_Y
|
||||
);
|
||||
|
||||
let iconImage = "snail_shadow";
|
||||
let typingTestButton = new TypingAppButton(
|
||||
TypingAppButton.TYPE_TEST_ENGLISH,
|
||||
posX, posY,
|
||||
iconImage,
|
||||
self.getIconImage(replyJSON.KoreanHighScoreList, activeApp.AppID),
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
sessionStorageManager.playingAppID = activeApp.AppID;
|
||||
|
||||
Reference in New Issue
Block a user