Add: show animal icon in typing app button

This commit is contained in:
2018-09-02 20:41:44 +09:00
parent 5de2b1daa8
commit ac46b61539
10 changed files with 182 additions and 42 deletions
+19 -16
View File
@@ -8,22 +8,6 @@ class Animal {
this.posY = y;
}
animalLevelIDByRecord(record) {
for(let i = Animal.SPECIES_DATA.length - 1; i > 0; i--) {
if(record >= this.typingCount(Animal.SPECIES_DATA[i]))
return i;
}
return 0;
}
typingCount(speciesData) {
if(sessionStorageManager.playingAppID <= 20)
return speciesData.practiceTypingCount;
else
return speciesData.testTypingCount;
}
loadSpriteNames() {
let spriteNames = {};
@@ -102,6 +86,22 @@ class Animal {
}
static animalLevelIDByRecord(record, gameType) {
for(let i = Animal.SPECIES_DATA.length - 1; i > 0; i--) {
if(record >= this.typingCount(Animal.SPECIES_DATA[i], gameType))
return i;
}
return 0;
}
static typingCount(speciesData, gameType) {
if(gameType === Animal.TYPE_PRACTICE)
return speciesData.practiceTypingCount;
else
return speciesData.testTypingCount;
}
static loadResources() {
game.load.image('snail_shadow', '../../../resources/image/character/animal/snail/shadow.png');
@@ -151,6 +151,9 @@ class Animal {
Animal.TYPE_ANIMATION = 0;
Animal.TYPE_ICON = 1;
Animal.TYPE_PRACTICE = 0;
Animal.TYPE_TEST = 1;
Animal.ANIMATION_TYPE_CHANGE = 0;
Animal.ANIMATION_TYPE_DAMAGE = 1;
-1
View File
@@ -84,7 +84,6 @@ class TypingAppButton extends RoundRectButton {
this.text.x = 30;
if(iconName.length > 0) {
console.log(this.icon);
this.icon.x = 40;
this.icon.width = 100;
this.icon.height = 100;
+4 -4
View File
@@ -117,7 +117,7 @@ class DBConnectManager {
xhr.send("maestro_id=" + maestroID);
}
requestTypingPracticeAppList(maestroID, onSucceededListener, onFailedListener) {
requestTypingPracticeAppList(maestroID, playerID, onSucceededListener, onFailedListener) {
let xhr = new XMLHttpRequest();
xhr.open("POST", this.phpPath + "server/app/menu_active_typing_practice_app_list.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
@@ -131,10 +131,10 @@ class DBConnectManager {
onFailedListener(replyJSON);
}
};
xhr.send("maestro_id=" + maestroID);
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID);
}
requestTypingTestAppList(maestroID, onSucceededListener, onFailedListener) {
requestTypingTestAppList(maestroID, playerID, onSucceededListener, onFailedListener) {
let xhr = new XMLHttpRequest();
xhr.open("POST", this.phpPath + "server/app/menu_active_typing_test_app_list.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
@@ -148,7 +148,7 @@ class DBConnectManager {
onFailedListener(replyJSON);
}
};
xhr.send("maestro_id=" + maestroID);
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID);
}
requestPlayerHistory(maestroID, date, listener) {