Fix: show all app list and disable some buttons
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
class GameAppButton extends RoundRectButton {
|
class GameAppButton extends RoundRectButton {
|
||||||
|
|
||||||
constructor(x, y, type, iconName, buttonText, clickEvent) {
|
constructor(x, y, type, iconName, buttonText, clickEvent) {
|
||||||
console.log(type);
|
|
||||||
let setting = new RoundRectButtonSetting(
|
let setting = new RoundRectButtonSetting(
|
||||||
x, y,
|
x, y,
|
||||||
GameAppButton.BUTTON_WIDTH, GameAppButton.BUTTON_HEIGHT
|
GameAppButton.BUTTON_WIDTH, GameAppButton.BUTTON_HEIGHT
|
||||||
|
|||||||
@@ -10,21 +10,21 @@ class TypingTabButton extends RoundRectButton {
|
|||||||
setting.strokeWidthPx = 5;
|
setting.strokeWidthPx = 5;
|
||||||
|
|
||||||
setting.setStrokeColor(
|
setting.setStrokeColor(
|
||||||
0x444488,
|
0x446688,
|
||||||
0x6666aa,
|
0x6688aa,
|
||||||
0x6666aa,
|
0x6688aa,
|
||||||
0x333333
|
0x333333
|
||||||
);
|
);
|
||||||
setting.setButtonColor(
|
setting.setButtonColor(
|
||||||
0xaaaadd,
|
0xaabbdd,
|
||||||
0xddddff,
|
0xddeeff,
|
||||||
0xddddff,
|
0xddeeff,
|
||||||
0x666666
|
0x666666
|
||||||
);
|
);
|
||||||
setting.setTextColor(
|
setting.setTextColor(
|
||||||
"#844",
|
"#468",
|
||||||
"#a66",
|
"#68a",
|
||||||
"#a66",
|
"#68a",
|
||||||
"#333"
|
"#333"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -41,13 +41,13 @@ class TypingTabButton extends RoundRectButton {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TypingTabButton.BUTTON_WIDTH = 500;
|
TypingTabButton.BUTTON_WIDTH = 480;
|
||||||
TypingTabButton.BUTTON_HEIGHT = 80;
|
TypingTabButton.BUTTON_HEIGHT = 80;
|
||||||
|
|
||||||
TypingTabButton.BUTTON_GAP = 20;
|
TypingTabButton.BUTTON_GAP = 20;
|
||||||
TypingTabButton.MARGIN_VERTICAL = 100;
|
TypingTabButton.MARGIN_VERTICAL = 100;
|
||||||
|
|
||||||
TypingTabButton.PRACTICE_BUTTON_POS_X = GAME_SCREEN_SIZE.x / 4;
|
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.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);
|
TypingTabButton.BUTTON_POS_Y = GAME_SCREEN_SIZE.y - (TypingTabButton.BUTTON_HEIGHT / 3 * 4);
|
||||||
+32
-12
@@ -49,25 +49,38 @@ class MenuApp {
|
|||||||
loadSucceeded(replyJSON) {
|
loadSucceeded(replyJSON) {
|
||||||
console.log(replyJSON);
|
console.log(replyJSON);
|
||||||
|
|
||||||
self.makeMouseAppButtons(replyJSON.MouseAppList);
|
self.makeMouseAppButtons(
|
||||||
|
replyJSON.MouseAppList,
|
||||||
|
replyJSON.MouseActiveAppList
|
||||||
|
);
|
||||||
self.makeTypingButtons(
|
self.makeTypingButtons(
|
||||||
replyJSON.TypingPracticeAppCount,
|
replyJSON.TypingPracticeAppCount,
|
||||||
replyJSON.TypingTestAppCount,
|
replyJSON.TypingTestAppCount,
|
||||||
replyJSON.TypingAppList
|
replyJSON.TypingAppList,
|
||||||
|
replyJSON.TypingActiveAppList
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
makeMouseAppButtons(mouseAppJSON) {
|
hasApp(appID, appList) {
|
||||||
// console.log(mouseAppJSON);
|
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++) {
|
for(let i = 0; i < mouseAppCount; i++) {
|
||||||
let posX = self.getButtonPosX(i, mouseAppCount);
|
let posX = self.getButtonPosX(i, mouseAppCount);
|
||||||
let posY = self.getButtonPosY(i, mouseAppCount, GameAppButton.BUTTON_UPPER_POS_Y);
|
let posY = self.getButtonPosY(i, mouseAppCount, GameAppButton.BUTTON_UPPER_POS_Y);
|
||||||
|
|
||||||
let app = mouseAppJSON[i];
|
let app = appList[i];
|
||||||
new GameAppButton(
|
let gameAppButton = new GameAppButton(
|
||||||
posX, posY, GameAppButton.TYPE_MOUSE_APP,
|
posX, posY, GameAppButton.TYPE_MOUSE_APP,
|
||||||
"icon_fullscreen", app.KoreanName,
|
"icon_fullscreen", app.KoreanName,
|
||||||
() => {
|
() => {
|
||||||
@@ -77,18 +90,21 @@ class MenuApp {
|
|||||||
location.href = '../../web/client/start.html';
|
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(typingPracticeAppCount);
|
||||||
// console.log(typingTestAppCount);
|
// console.log(typingTestAppCount);
|
||||||
// console.log(typingAppJSON);
|
// console.log(appList);
|
||||||
|
|
||||||
let isTypingPracticeAppExist = typingPracticeAppCount > 0 ? true : false;
|
let isTypingPracticeAppExist = typingPracticeAppCount > 0 ? true : false;
|
||||||
let isTypingTestAppExist = typingTestAppCount > 0 ? true : false;
|
let isTypingTestAppExist = typingTestAppCount > 0 ? true : false;
|
||||||
|
|
||||||
let typingAppTotalCount = Object.keys(typingAppJSON).length;
|
let typingAppTotalCount = Object.keys(appList).length;
|
||||||
let typingAppIndex = 0;
|
let typingAppIndex = 0;
|
||||||
|
|
||||||
|
|
||||||
@@ -124,10 +140,10 @@ class MenuApp {
|
|||||||
typingButtonIndex, typingAppTotalCount, GameAppButton.BUTTON_LOWER_POS_Y
|
typingButtonIndex, typingAppTotalCount, GameAppButton.BUTTON_LOWER_POS_Y
|
||||||
);
|
);
|
||||||
|
|
||||||
let app = typingAppJSON[typingAppIndex];
|
let app = appList[typingAppIndex];
|
||||||
let isKoreanTypingApp = app.AppID < 32 ? true : false;
|
let isKoreanTypingApp = app.AppID < 32 ? true : false;
|
||||||
|
|
||||||
new GameAppButton(
|
let gameAppButton = new GameAppButton(
|
||||||
posX, posY, GameAppButton.TYPE_TYPING_APP,
|
posX, posY, GameAppButton.TYPE_TYPING_APP,
|
||||||
"icon_fullscreen",
|
"icon_fullscreen",
|
||||||
// (isKoreanTypingApp ? "(한글)" : "(영문)") + "\n" + app.KoreanName,
|
// (isKoreanTypingApp ? "(한글)" : "(영문)") + "\n" + app.KoreanName,
|
||||||
@@ -139,6 +155,10 @@ class MenuApp {
|
|||||||
location.href = '../../web/client/start.html';
|
location.href = '../../web/client/start.html';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(!self.hasApp(app.AppID, activeAppList))
|
||||||
|
gameAppButton.inputEnabled = false;
|
||||||
|
|
||||||
typingAppIndex++;
|
typingAppIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class MenuTypingPractice {
|
|||||||
TypingPracticeButton.BUTTON_LOWER_POS_Y
|
TypingPracticeButton.BUTTON_LOWER_POS_Y
|
||||||
);
|
);
|
||||||
|
|
||||||
new TypingPracticeButton(
|
let typingPracticeButton = new TypingPracticeButton(
|
||||||
posX, posY,
|
posX, posY,
|
||||||
TypingPracticeButton.NONE_ICON,
|
TypingPracticeButton.NONE_ICON,
|
||||||
activeApp.KoreanName,
|
activeApp.KoreanName,
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ class TypingPractice {
|
|||||||
location.href = '../../web/client/menu_typing_practice.html';
|
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.setSpecies(Animal.SPECIES_DATA[0]);
|
||||||
this.animalOnTitle.startAnimation();
|
this.animalOnTitle.startAnimation();
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ class TypingTest {
|
|||||||
location.href = '../../web/client/menu_typing_test.html';
|
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.setSpecies(Animal.SPECIES_DATA[0]);
|
||||||
this.animalOnTitle.startAnimation();
|
this.animalOnTitle.startAnimation();
|
||||||
|
|
||||||
|
|||||||
@@ -3,27 +3,60 @@ header("Content-Type: application/json");
|
|||||||
|
|
||||||
$maestro_id = $_POST["maestro_id"];
|
$maestro_id = $_POST["maestro_id"];
|
||||||
|
|
||||||
|
include "./../lib/send_reply_json.php";
|
||||||
include "./../setup/connect_db.php";
|
include "./../setup/connect_db.php";
|
||||||
|
|
||||||
$replyJSON = array();
|
$mouseAppList = get_app_list(100);
|
||||||
$replyJSON["MouseAppList"] = get_mouse_app_list($maestro_id);
|
$typingAppList = get_app_list(50);
|
||||||
$replyJSON["TypingPracticeAppCount"] = get_typing_practice_app_count($maestro_id);
|
$mouseActiveAppList = get_active_mouse_app_list($maestro_id);
|
||||||
$replyJSON["TypingTestAppCount"] = get_typing_test_app_count($maestro_id);
|
$typingActiveAppList = get_active_typing_app_list($maestro_id);
|
||||||
$replyJSON["TypingAppList"] = get_typing_app_list($maestro_id);
|
$typingPracticeAppCount = get_typing_practice_app_count($maestro_id);
|
||||||
$db_conn->close();
|
$typingTestAppCount = get_typing_test_app_count($maestro_id);
|
||||||
|
|
||||||
if($replyJSON.length === 0) {
|
if($replyJSON.length === 0) {
|
||||||
send_error_message($replyJSON, "앱 목록 가져오기 실패");
|
set_error_code("no_app_list");
|
||||||
$db_conn->close();
|
set_error_message("앱 목록을 가져오지 못했습니다.");
|
||||||
|
send_result_fail();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
set_data("MouseAppList", $mouseAppList);
|
||||||
$db_conn->close();
|
set_data("TypingAppList", $typingAppList);
|
||||||
|
set_data("MouseActiveAppList", $mouseActiveAppList);
|
||||||
|
set_data("TypingActiveAppList", $typingActiveAppList);
|
||||||
|
set_data("TypingPracticeAppCount", $typingPracticeAppCount);
|
||||||
|
set_data("TypingTestAppCount", $typingTestAppCount);
|
||||||
|
send_result_success();
|
||||||
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function get_mouse_app_list($maestro_id) {
|
function get_app_list($appType) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT AppID, AppName, KoreanName
|
||||||
|
FROM app
|
||||||
|
WHERE AppType = ? AND Status = 1
|
||||||
|
ORDER BY AppID ASC";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param('i', $appType);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($app_id, $app_name, $korean_name);
|
||||||
|
|
||||||
|
$return_array = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$row_array['AppID'] = $app_id;
|
||||||
|
$row_array['AppName'] = $app_name;
|
||||||
|
$row_array['KoreanName'] = $korean_name;
|
||||||
|
array_push($return_array, $row_array);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $return_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_active_mouse_app_list($maestro_id) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
@@ -48,6 +81,31 @@ function get_mouse_app_list($maestro_id) {
|
|||||||
return $return_array;
|
return $return_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_active_typing_app_list($maestro_id) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT A.AppID, A.AppName, A.KoreanName, A.AppType
|
||||||
|
FROM app AS A
|
||||||
|
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType = 50 AND AA.MaestroID=?";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param("i", $maestro_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($app_id, $app_name, $korean_name, $app_type);
|
||||||
|
|
||||||
|
$return_array = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$row_array["AppID"] = $app_id;
|
||||||
|
$row_array["AppName"] = $app_name;
|
||||||
|
$row_array["KoreanName"] = $korean_name;
|
||||||
|
$row_array["AppType"] = $app_type;
|
||||||
|
array_push($return_array, $row_array);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $return_array;
|
||||||
|
}
|
||||||
|
|
||||||
function get_typing_practice_app_count($maestro_id) {
|
function get_typing_practice_app_count($maestro_id) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
@@ -82,29 +140,4 @@ function get_typing_test_app_count($maestro_id) {
|
|||||||
return $typing_practice_app_count;
|
return $typing_practice_app_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_typing_app_list($maestro_id) {
|
|
||||||
global $db_conn;
|
|
||||||
|
|
||||||
$query = "
|
|
||||||
SELECT A.AppID, A.AppName, A.KoreanName, A.AppType
|
|
||||||
FROM app AS A
|
|
||||||
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType = 50 AND AA.MaestroID=?";
|
|
||||||
$stmt = $db_conn->prepare($query);
|
|
||||||
$stmt->bind_param("i", $maestro_id);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->bind_result($app_id, $app_name, $korean_name, $app_type);
|
|
||||||
|
|
||||||
$return_array = array();
|
|
||||||
while($stmt->fetch()) {
|
|
||||||
$row_array["AppID"] = $app_id;
|
|
||||||
$row_array["AppName"] = $app_name;
|
|
||||||
$row_array["KoreanName"] = $korean_name;
|
|
||||||
$row_array["AppType"] = $app_type;
|
|
||||||
array_push($return_array, $row_array);
|
|
||||||
}
|
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
return $return_array;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -2,11 +2,11 @@ USE moty;
|
|||||||
|
|
||||||
INSERT INTO `maestro` (`MaestroID`, `Name`, `Password`, `Email`, `AccountType`, `ActivateStatus`, `AvailableActivateDateTime`, `PlayerCount`, `AcceptClausesDateTime`, `MaestroTestID`) VALUES
|
INSERT INTO `maestro` (`MaestroID`, `Name`, `Password`, `Email`, `AccountType`, `ActivateStatus`, `AvailableActivateDateTime`, `PlayerCount`, `AcceptClausesDateTime`, `MaestroTestID`) VALUES
|
||||||
(1, 'testplayer', '', 'test@jinaju.com', 100, 1, '2100-12-31 00:00:00', 0, '2018-05-27 17:13:35', 1),
|
(1, 'testplayer', '', 'test@jinaju.com', 100, 1, '2100-12-31 00:00:00', 0, '2018-05-27 17:13:35', 1),
|
||||||
(2, '마에스트로 체험', '', 'test@jinaju.com', 101, 1, '2100-12-31 00:00:00', 0, '2018-07-08 00:00:00', 2);
|
(2, '체험 마에스트로', '', 'test@jinaju.com', 101, 1, '2100-12-31 00:00:00', 0, '2018-07-08 00:00:00', 2);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `player` (`PlayerID`, `MaestroID`, `Name`, `EnterCode`, `AccountType`) VALUES
|
INSERT INTO `player` (`PlayerID`, `MaestroID`, `Name`, `EnterCode`, `AccountType`) VALUES
|
||||||
(1, 1, '학생 체험', '', 0),
|
(1, 1, '체험 학생', '', 0),
|
||||||
(2, 2, '마에스트로', '', 0);
|
(2, 2, '마에스트로', '', 0);
|
||||||
|
|
||||||
INSERT INTO `admin` (`AdminID`, `Name`, `Password`, `Email`, `AccountType`, `ActivateStatus`) VALUES
|
INSERT INTO `admin` (`AdminID`, `Name`, `Password`, `Email`, `AccountType`, `ActivateStatus`) VALUES
|
||||||
|
|||||||
Reference in New Issue
Block a user