Add: show animal icon in typing app button
This commit is contained in:
+19
-16
@@ -8,22 +8,6 @@ class Animal {
|
|||||||
this.posY = y;
|
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() {
|
loadSpriteNames() {
|
||||||
let spriteNames = {};
|
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() {
|
static loadResources() {
|
||||||
game.load.image('snail_shadow', '../../../resources/image/character/animal/snail/shadow.png');
|
game.load.image('snail_shadow', '../../../resources/image/character/animal/snail/shadow.png');
|
||||||
|
|
||||||
@@ -151,6 +151,9 @@ class Animal {
|
|||||||
Animal.TYPE_ANIMATION = 0;
|
Animal.TYPE_ANIMATION = 0;
|
||||||
Animal.TYPE_ICON = 1;
|
Animal.TYPE_ICON = 1;
|
||||||
|
|
||||||
|
Animal.TYPE_PRACTICE = 0;
|
||||||
|
Animal.TYPE_TEST = 1;
|
||||||
|
|
||||||
Animal.ANIMATION_TYPE_CHANGE = 0;
|
Animal.ANIMATION_TYPE_CHANGE = 0;
|
||||||
Animal.ANIMATION_TYPE_DAMAGE = 1;
|
Animal.ANIMATION_TYPE_DAMAGE = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ class TypingAppButton extends RoundRectButton {
|
|||||||
this.text.x = 30;
|
this.text.x = 30;
|
||||||
|
|
||||||
if(iconName.length > 0) {
|
if(iconName.length > 0) {
|
||||||
console.log(this.icon);
|
|
||||||
this.icon.x = 40;
|
this.icon.x = 40;
|
||||||
this.icon.width = 100;
|
this.icon.width = 100;
|
||||||
this.icon.height = 100;
|
this.icon.height = 100;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class DBConnectManager {
|
|||||||
xhr.send("maestro_id=" + maestroID);
|
xhr.send("maestro_id=" + maestroID);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestTypingPracticeAppList(maestroID, onSucceededListener, onFailedListener) {
|
requestTypingPracticeAppList(maestroID, playerID, onSucceededListener, onFailedListener) {
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
xhr.open("POST", this.phpPath + "server/app/menu_active_typing_practice_app_list.php", true);
|
xhr.open("POST", this.phpPath + "server/app/menu_active_typing_practice_app_list.php", true);
|
||||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
@@ -131,10 +131,10 @@ class DBConnectManager {
|
|||||||
onFailedListener(replyJSON);
|
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();
|
let xhr = new XMLHttpRequest();
|
||||||
xhr.open("POST", this.phpPath + "server/app/menu_active_typing_test_app_list.php", true);
|
xhr.open("POST", this.phpPath + "server/app/menu_active_typing_test_app_list.php", true);
|
||||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
@@ -148,7 +148,7 @@ class DBConnectManager {
|
|||||||
onFailedListener(replyJSON);
|
onFailedListener(replyJSON);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.send("maestro_id=" + maestroID);
|
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestPlayerHistory(maestroID, date, listener) {
|
requestPlayerHistory(maestroID, date, listener) {
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class MenuTypingPractice {
|
|||||||
let dbConnectManager = new DBConnectManager();
|
let dbConnectManager = new DBConnectManager();
|
||||||
dbConnectManager.requestTypingPracticeAppList(
|
dbConnectManager.requestTypingPracticeAppList(
|
||||||
sessionStorageManager.maestroID,
|
sessionStorageManager.maestroID,
|
||||||
|
sessionStorageManager.playerID,
|
||||||
self.downloadListSucceeded,
|
self.downloadListSucceeded,
|
||||||
self.downloadListFailed
|
self.downloadListFailed
|
||||||
);
|
);
|
||||||
@@ -99,6 +100,27 @@ class MenuTypingPractice {
|
|||||||
return false;
|
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) {
|
downloadListSucceeded(replyJSON) {
|
||||||
// console.log(replyJSON);
|
// console.log(replyJSON);
|
||||||
|
|
||||||
@@ -115,11 +137,10 @@ class MenuTypingPractice {
|
|||||||
TypingAppButton.BUTTON_UPPER_POS_Y
|
TypingAppButton.BUTTON_UPPER_POS_Y
|
||||||
);
|
);
|
||||||
|
|
||||||
let iconImage = "snail_shadow";
|
|
||||||
let typingPracticeButton = new TypingAppButton(
|
let typingPracticeButton = new TypingAppButton(
|
||||||
TypingAppButton.TYPE_PRACTICE_KOREAN,
|
TypingAppButton.TYPE_PRACTICE_KOREAN,
|
||||||
posX, posY,
|
posX, posY,
|
||||||
iconImage,
|
self.getIconImage(replyJSON.KoreanHighScoreList, activeApp.AppID),
|
||||||
activeApp.KoreanName,
|
activeApp.KoreanName,
|
||||||
() => {
|
() => {
|
||||||
sessionStorageManager.playingAppID = activeApp.AppID;
|
sessionStorageManager.playingAppID = activeApp.AppID;
|
||||||
@@ -141,11 +162,10 @@ class MenuTypingPractice {
|
|||||||
TypingAppButton.BUTTON_LOWER_POS_Y
|
TypingAppButton.BUTTON_LOWER_POS_Y
|
||||||
);
|
);
|
||||||
|
|
||||||
let iconImage = "snail_shadow";
|
|
||||||
let typingPracticeButton = new TypingAppButton(
|
let typingPracticeButton = new TypingAppButton(
|
||||||
TypingAppButton.TYPE_PRACTICE_ENGLISH,
|
TypingAppButton.TYPE_PRACTICE_ENGLISH,
|
||||||
posX, posY,
|
posX, posY,
|
||||||
iconImage,
|
self.getIconImage(activeApp.AppID),
|
||||||
activeApp.KoreanName,
|
activeApp.KoreanName,
|
||||||
() => {
|
() => {
|
||||||
sessionStorageManager.playingAppID = activeApp.AppID;
|
sessionStorageManager.playingAppID = activeApp.AppID;
|
||||||
|
|||||||
@@ -32,22 +32,22 @@ class MenuTypingTest {
|
|||||||
0, 60 + AppAreaBG.GAP_Y,
|
0, 60 + AppAreaBG.GAP_Y,
|
||||||
GAME_SCREEN_SIZE.x, 270
|
GAME_SCREEN_SIZE.x, 270
|
||||||
);
|
);
|
||||||
koreanBG.printText(
|
// koreanBG.printText(
|
||||||
"한 글 타 자",
|
// "한 글 타 자",
|
||||||
game.world.centerX, 320,
|
// game.world.centerX, 320,
|
||||||
36, "#000", 0.05
|
// 36, "#000", 0.05
|
||||||
);
|
// );
|
||||||
|
|
||||||
// english app area
|
// english app area
|
||||||
let englishBG = new AppAreaBG(AppAreaBG.COLOR_TYPING_ENGLISH, 1,
|
let englishBG = new AppAreaBG(AppAreaBG.COLOR_TYPING_ENGLISH, 1,
|
||||||
0, 340,
|
0, 340,
|
||||||
GAME_SCREEN_SIZE.x, 270
|
GAME_SCREEN_SIZE.x, 270
|
||||||
);
|
);
|
||||||
englishBG.printText(
|
// englishBG.printText(
|
||||||
"영 문 타 자",
|
// "영 문 타 자",
|
||||||
game.world.centerX, 370,
|
// game.world.centerX, 370,
|
||||||
36, "#000", 0.05
|
// 36, "#000", 0.05
|
||||||
);
|
// );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -84,6 +84,7 @@ class MenuTypingTest {
|
|||||||
let dbConnectManager = new DBConnectManager();
|
let dbConnectManager = new DBConnectManager();
|
||||||
dbConnectManager.requestTypingTestAppList(
|
dbConnectManager.requestTypingTestAppList(
|
||||||
sessionStorageManager.maestroID,
|
sessionStorageManager.maestroID,
|
||||||
|
sessionStorageManager.playerID,
|
||||||
self.downloadListSucceeded,
|
self.downloadListSucceeded,
|
||||||
self.downloadListFailed
|
self.downloadListFailed
|
||||||
);
|
);
|
||||||
@@ -99,6 +100,27 @@ class MenuTypingTest {
|
|||||||
return false;
|
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) {
|
downloadListSucceeded(replyJSON) {
|
||||||
// console.log(replyJSON);
|
// console.log(replyJSON);
|
||||||
|
|
||||||
@@ -115,11 +137,10 @@ class MenuTypingTest {
|
|||||||
TypingAppButton.BUTTON_UPPER_POS_Y
|
TypingAppButton.BUTTON_UPPER_POS_Y
|
||||||
);
|
);
|
||||||
|
|
||||||
let iconImage = "snail_shadow";
|
|
||||||
let typingTestButton = new TypingAppButton(
|
let typingTestButton = new TypingAppButton(
|
||||||
TypingAppButton.TYPE_TEST_KOREAN,
|
TypingAppButton.TYPE_TEST_KOREAN,
|
||||||
posX, posY,
|
posX, posY,
|
||||||
iconImage,
|
self.getIconImage(replyJSON.KoreanHighScoreList, activeApp.AppID),
|
||||||
activeApp.KoreanName,
|
activeApp.KoreanName,
|
||||||
() => {
|
() => {
|
||||||
sessionStorageManager.playingAppID = activeApp.AppID;
|
sessionStorageManager.playingAppID = activeApp.AppID;
|
||||||
@@ -141,11 +162,10 @@ class MenuTypingTest {
|
|||||||
TypingAppButton.BUTTON_LOWER_POS_Y
|
TypingAppButton.BUTTON_LOWER_POS_Y
|
||||||
);
|
);
|
||||||
|
|
||||||
let iconImage = "snail_shadow";
|
|
||||||
let typingTestButton = new TypingAppButton(
|
let typingTestButton = new TypingAppButton(
|
||||||
TypingAppButton.TYPE_TEST_ENGLISH,
|
TypingAppButton.TYPE_TEST_ENGLISH,
|
||||||
posX, posY,
|
posX, posY,
|
||||||
iconImage,
|
self.getIconImage(replyJSON.KoreanHighScoreList, activeApp.AppID),
|
||||||
activeApp.KoreanName,
|
activeApp.KoreanName,
|
||||||
() => {
|
() => {
|
||||||
sessionStorageManager.playingAppID = activeApp.AppID;
|
sessionStorageManager.playingAppID = activeApp.AppID;
|
||||||
|
|||||||
@@ -68,7 +68,11 @@ class Result {
|
|||||||
|
|
||||||
if(sessionStorageManager.playingAppID < 100) {
|
if(sessionStorageManager.playingAppID < 100) {
|
||||||
let leftAnimal = new Animal(Animal.TYPE_ANIMATION, game.world.centerX - 200, 150);
|
let leftAnimal = new Animal(Animal.TYPE_ANIMATION, game.world.centerX - 200, 150);
|
||||||
let animalLevelID = leftAnimal.animalLevelIDByRecord(sessionStorageManager.record);
|
let animalLevelID = 0;
|
||||||
|
if(sessionStorageManager.playingAppID < 20)
|
||||||
|
animalLevelID = Animal.animalLevelIDByRecord(sessionStorageManager.record, Animal.TYPE_PRACTICE);
|
||||||
|
else
|
||||||
|
animalLevelID = Animal.animalLevelIDByRecord(sessionStorageManager.record, Animal.TYPE_TEST);
|
||||||
leftAnimal.setSpecies(Animal.SPECIES_DATA[animalLevelID]);;
|
leftAnimal.setSpecies(Animal.SPECIES_DATA[animalLevelID]);;
|
||||||
// leftAnimal.tweenAnimation(Animal.ANIMATION_TYPE_CHANGE);
|
// leftAnimal.tweenAnimation(Animal.ANIMATION_TYPE_CHANGE);
|
||||||
leftAnimal.startAnimation();
|
leftAnimal.startAnimation();
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ class TypingPractice {
|
|||||||
|
|
||||||
if(this.isKeyPressed(inputContent, typingContent)) {
|
if(this.isKeyPressed(inputContent, typingContent)) {
|
||||||
this.typingScore.increase();
|
this.typingScore.increase();
|
||||||
let animalLevelID = this.animalOnTitle.animalLevelIDByRecord(this.typingScore.score());
|
let animalLevelID = Animal.animalLevelIDByRecord(this.typingScore.score(), Animal.TYPE_PRACTICE);
|
||||||
if(animalLevelID > this.playingAnimalIndex) {
|
if(animalLevelID > this.playingAnimalIndex) {
|
||||||
this.playingAnimalIndex = animalLevelID;
|
this.playingAnimalIndex = animalLevelID;
|
||||||
this.animalOnTitle.setSpecies(Animal.SPECIES_DATA[this.playingAnimalIndex]);;
|
this.animalOnTitle.setSpecies(Animal.SPECIES_DATA[this.playingAnimalIndex]);;
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ class TypingTest {
|
|||||||
// console.log('typingRecordTotal : ' + typingRecordTotal);
|
// console.log('typingRecordTotal : ' + typingRecordTotal);
|
||||||
// console.log('-----------------------------------');
|
// console.log('-----------------------------------');
|
||||||
|
|
||||||
let animalLevelID = this.animalOnTitle.animalLevelIDByRecord(typingRecordTotalInteger);
|
let animalLevelID = Animal.animalLevelIDByRecord(typingRecordTotalInteger, Animal.TYPE_TEST);
|
||||||
this.animalOnTitle.setSpecies(Animal.SPECIES_DATA[animalLevelID]);;
|
this.animalOnTitle.setSpecies(Animal.SPECIES_DATA[animalLevelID]);;
|
||||||
this.animalOnTitle.tweenAnimation(Animal.ANIMATION_TYPE_CHANGE);
|
this.animalOnTitle.tweenAnimation(Animal.ANIMATION_TYPE_CHANGE);
|
||||||
this.animalOnTitle.startAnimation();
|
this.animalOnTitle.startAnimation();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
header("Content-Type: application/json");
|
header("Content-Type: application/json");
|
||||||
|
|
||||||
$maestro_id = $_POST["maestro_id"];
|
$maestro_id = $_POST["maestro_id"];
|
||||||
|
$player_id = $_POST["player_id"];
|
||||||
|
|
||||||
include "./../lib/send_reply_json.php";
|
include "./../lib/send_reply_json.php";
|
||||||
include "./../setup/connect_db.php";
|
include "./../setup/connect_db.php";
|
||||||
@@ -21,13 +22,19 @@ if($englishAppList === null) {
|
|||||||
send_result_fail();
|
send_result_fail();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$koreanActiveAppList = get_active_typing_practice_app_list($maestro_id, 1);
|
$koreanActiveAppList = get_active_typing_practice_app_list($maestro_id, 1);
|
||||||
$englishActiveAppList = get_active_typing_practice_app_list($maestro_id, 2);
|
$englishActiveAppList = get_active_typing_practice_app_list($maestro_id, 2);
|
||||||
|
|
||||||
|
$koreanHighScoreList = get_high_score_list($maestro_id, $player_id, $koreanAppList);
|
||||||
|
$englishHighScoreList = get_high_score_list($maestro_id, $player_id, $englishAppList);
|
||||||
|
|
||||||
set_data("KoreanAppList", $koreanAppList);
|
set_data("KoreanAppList", $koreanAppList);
|
||||||
set_data("EnglishAppList", $englishAppList);
|
set_data("EnglishAppList", $englishAppList);
|
||||||
set_data("KoreanActiveAppList", $koreanActiveAppList);
|
set_data("KoreanActiveAppList", $koreanActiveAppList);
|
||||||
set_data("EnglishActiveAppList", $englishActiveAppList);
|
set_data("EnglishActiveAppList", $englishActiveAppList);
|
||||||
|
set_data("KoreanHighScoreList", $koreanHighScoreList);
|
||||||
|
set_data("EnglishHighScoreList", $englishHighScoreList);
|
||||||
send_result_success();
|
send_result_success();
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@@ -84,4 +91,44 @@ function get_active_typing_practice_app_list($maestro_id, $appType) {
|
|||||||
return $return_array;
|
return $return_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_high_score_list($maestro_id, $player_id, $appList) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$return_array = array();
|
||||||
|
$count = count($appList);
|
||||||
|
|
||||||
|
for($i = 0; $i < $count; $i++) {
|
||||||
|
$app_id_list = $appList[$i]['AppID'];
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT MAX(BR.BestRecord)
|
||||||
|
FROM app AS A
|
||||||
|
INNER JOIN best_record AS BR
|
||||||
|
ON A.AppID = ? AND A.AppID = BR.AppID AND BR.MaestroID = ? AND BR.PlayerID = ?
|
||||||
|
ORDER BY A.AppID ASC";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param('iii', $app_id_list, $maestro_id, $player_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($best_record);
|
||||||
|
|
||||||
|
$returnValue = $stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
if($returnValue === NULL || $returnValue === FALSE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// $row_array['maestro_id'] = $maestro_id;
|
||||||
|
// $row_array['player_id'] = $player_id;
|
||||||
|
$row_array['AppID'] = $app_id_list;
|
||||||
|
if($best_record === NULL)
|
||||||
|
$row_array['BestRecord'] = 0;
|
||||||
|
else
|
||||||
|
$row_array['BestRecord'] = $best_record;
|
||||||
|
|
||||||
|
array_push($return_array, $row_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return_array;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
$maestro_id = $_POST["maestro_id"];
|
$maestro_id = $_POST["maestro_id"];
|
||||||
|
$player_id = $_POST["player_id"];
|
||||||
|
|
||||||
include "./../lib/send_reply_json.php";
|
include "./../lib/send_reply_json.php";
|
||||||
include "./../setup/connect_db.php";
|
include "./../setup/connect_db.php";
|
||||||
@@ -21,13 +22,19 @@ if($englishAppList === null) {
|
|||||||
send_result_fail();
|
send_result_fail();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$koreanActiveAppList = get_active_typing_practice_app_list($maestro_id, 11);
|
$koreanActiveAppList = get_active_typing_practice_app_list($maestro_id, 11);
|
||||||
$englishActiveAppList = get_active_typing_practice_app_list($maestro_id, 12);
|
$englishActiveAppList = get_active_typing_practice_app_list($maestro_id, 12);
|
||||||
|
|
||||||
|
$koreanHighScoreList = get_high_score_list($maestro_id, $player_id, $koreanAppList);
|
||||||
|
$englishHighScoreList = get_high_score_list($maestro_id, $player_id, $englishAppList);
|
||||||
|
|
||||||
set_data("KoreanAppList", $koreanAppList);
|
set_data("KoreanAppList", $koreanAppList);
|
||||||
set_data("EnglishAppList", $englishAppList);
|
set_data("EnglishAppList", $englishAppList);
|
||||||
set_data("KoreanActiveAppList", $koreanActiveAppList);
|
set_data("KoreanActiveAppList", $koreanActiveAppList);
|
||||||
set_data("EnglishActiveAppList", $englishActiveAppList);
|
set_data("EnglishActiveAppList", $englishActiveAppList);
|
||||||
|
set_data("KoreanHighScoreList", $koreanHighScoreList);
|
||||||
|
set_data("EnglishHighScoreList", $englishHighScoreList);
|
||||||
send_result_success();
|
send_result_success();
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@@ -84,4 +91,44 @@ function get_active_typing_practice_app_list($maestro_id, $appType) {
|
|||||||
return $return_array;
|
return $return_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_high_score_list($maestro_id, $player_id, $appList) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$return_array = array();
|
||||||
|
$count = count($appList);
|
||||||
|
|
||||||
|
for($i = 0; $i < $count; $i++) {
|
||||||
|
$app_id_list = $appList[$i]['AppID'];
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT MAX(BR.BestRecord)
|
||||||
|
FROM app AS A
|
||||||
|
INNER JOIN best_record AS BR
|
||||||
|
ON A.AppID = ? AND A.AppID = BR.AppID AND BR.MaestroID = ? AND BR.PlayerID = ?
|
||||||
|
ORDER BY A.AppID ASC";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param('iii', $app_id_list, $maestro_id, $player_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($best_record);
|
||||||
|
|
||||||
|
$returnValue = $stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
if($returnValue === NULL || $returnValue === FALSE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// $row_array['maestro_id'] = $maestro_id;
|
||||||
|
// $row_array['player_id'] = $player_id;
|
||||||
|
$row_array['AppID'] = $app_id_list;
|
||||||
|
if($best_record === NULL)
|
||||||
|
$row_array['BestRecord'] = 0;
|
||||||
|
else
|
||||||
|
$row_array['BestRecord'] = $best_record;
|
||||||
|
|
||||||
|
array_push($return_array, $row_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return_array;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user