Fix: go home button

This commit is contained in:
2018-07-12 14:54:45 +09:00
parent a0e0702370
commit a549a63491
10 changed files with 174 additions and 91 deletions
+46
View File
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>메뉴</title>
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script> -->
<script src="../../../resources/js/phaser.min.js"></script>
<!-- global source files -->
<script src="../../game/lib/session_storage_manager.js"></script>
<script src="../../game/global/global_variables.js"></script>
<!-- library source files -->
<script src="../../game/lib/input_type_text.js"></script>
<script src="../../game/lib/round_rect_button.js"></script>
<script src="../../game/lib/back_button.js"></script>
<script src="../../game/lib/fullscreen_button.js"></script>
<script src="../../game/lib/app_button.js"></script>
<script src="../../game/lib/game_app_button.js"></script>
<script src="../../game/lib/screen_bottom.js"></script>
<script src="../../game/lib/db_connect_manager.js"></script>
<!-- source files -->
<script src="../../game/menu/menu_app.js"></script>
<script src="../../game/menu/main_menu_app.js"></script>
<style>
body{
padding: 0;
margin: 0;
}
canvas{
margin: 0 auto;
}
</style>
</head>
<body>
<div id="MenuApp" style="text-align:center;" />
</body>
</html>
+35 -6
View File
@@ -15,17 +15,46 @@ function loadMaestroID() {
console.log("loaded maestroID : " + maestroID); console.log("loaded maestroID : " + maestroID);
} }
function saveMaestroID() { function saveMaestroID(maestroID) {
sessionStorage.setItem("maestroID", maestroID); sessionStorage.setItem("maestroID", maestroID);
console.log("saved maestroID : " + maestroID); // console.log("saved maestroID : " + maestroID);
}
function getParentDirectory(url) {
let directories = url.split("/");
if(directories.length < 2)
return "";
return directories[directories.length - 2];
}
function getPage(url) {
let directories = url.split("/");
if(directories.length < 1)
return "";
return directories[directories.length - 1];
} }
function goHome() { function goHome() {
if(maestroID === -1) { let url = window.location.href;
location.href = "./../main/index.html";
} else { if(getParentDirectory(url) === "maestro") {
location.href = "./../maestro/main_menu.html"; if(getPage(url) !== "main_menu.html")
location.href = "./../maestro/main_menu.html";
return;
} }
// parent directory is "main"
if(getPage(url) === "faq.html") {
if(maestroID === -1) {
location.href = "./../main/index.html";
} else {
location.href = "./../maestro/main_menu.html";
}
} else if(getPage(url) !== "index.html")
location.href = "./../main/index.html";
} }
function logout() { function logout() {
+4
View File
@@ -10,8 +10,12 @@
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script> <script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="./../js/main.js"></script> <script type="text/javascript" src="./../js/main.js"></script>
<script type="text/javascript" src="./../js/request_server.js"></script>
<script type="text/javascript"> <script type="text/javascript">
saveMaestroID(-1);
$(document).ready(function() { $(document).ready(function() {
$("#header").load("./../module/header.html"); $("#header").load("./../module/header.html");
$("#section").load("./../module/home_section.html"); $("#section").load("./../module/home_section.html");
$("#footer").load("./../module/footer.html"); $("#footer").load("./../module/footer.html");
+1 -1
View File
@@ -38,7 +38,7 @@
</li> </li>
<li> <li>
<span class="col"> <span class="col">
<a href="./../maestro/login.html" id="login_maestro" class="btn btn-sea">마에스트로 계정<br/>로그인</a> <a href="./../main/login.html" id="login_maestro" class="btn btn-sea">마에스트로 계정<br/>로그인</a>
</span> </span>
</li> </li>
</ul> </ul>
+19 -36
View File
@@ -15,40 +15,14 @@
<script> <script>
function loadMaestroTestAccountInfo() { function loadMaestroTestAccountInfo() {
let xhr = new XMLHttpRequest(); //new로 생성. sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
xhr.open('POST', './../server/maestro/maestro_test_account.php', true); "./../server/maestro/maestro_test_account.php",
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); "",
xhr.send();
xhr.onload = function() {
if(xhr.readyState === 4 && xhr.status === 200) {
// console.log(xhr.responseText);
// console.log(xhr.responseText.length);
if(xhr.responseText.length === 0 || xhr.responseText === null) {
console.log("no data from server");
return;
}
let replyJSON = JSON.parse(xhr.responseText); (jsonData) => {
// console.log(replyJSON); let maestroID = jsonData["maestroID"];
let playerID = jsonData["playerID"];
if(replyJSON === null) { let playerName = jsonData["playerName"];
console.log("no data from server");
return;
}
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
console.log(replyJSON["ERROR"]);
return;
}
if(replyJSON["RESULT"] === "fail") {
console.log(replyJSON["RESULT"]);
return;
}
let maestroID = replyJSON["maestroID"];
let playerID = replyJSON["playerID"];
let playerName = replyJSON["playerName"];
console.log("maestroID : " + maestroID); console.log("maestroID : " + maestroID);
console.log("playerID : " + playerID); console.log("playerID : " + playerID);
@@ -57,13 +31,22 @@ function loadMaestroTestAccountInfo() {
sessionStorage.setItem("maestroID", maestroID); sessionStorage.setItem("maestroID", maestroID);
sessionStorage.setItem("playerID", playerID); sessionStorage.setItem("playerID", playerID);
sessionStorage.setItem("playerName", playerName); sessionStorage.setItem("playerName", playerName);
},
(errorMessage) => {
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
} }
}
);
let xhr = new XMLHttpRequest(); //new로 생성.
} }
function playFree() { function playFree() {
loadMaestroTestAccountInfo(); loadMaestroTestAccountInfo();
window.open("./../client/menu_app.html", "_blank"); // window.open("./../client/menu_app.html", "_blank");
location.href = "./../client/menu_app.html";
} }
function experienceMaestro() { function experienceMaestro() {
@@ -116,7 +99,7 @@ function experienceMaestro() {
</ul> </ul>
<div class="col alignCenter"> <div class="col alignCenter">
<a href="./../maestro/register.html" id="maestro_register" class="btn btn-sea width400">마에스트로<br/>가입</a> <a href="./../main/register.html" id="maestro_register" class="btn btn-sea width400">마에스트로<br/>가입</a>
</div> </div>
<ul id="register_tip"> <ul id="register_tip">
+43 -1
View File
@@ -24,6 +24,30 @@
<script type="text/javascript"> <script type="text/javascript">
function loadMaestroTestAccountInfo() { function loadMaestroTestAccountInfo() {
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/maestro/maestro_test_player.php",
"maestro_id=" + maestroID,
(jsonData) => {
let playerID = jsonData["playerID"];
let playerName = jsonData["playerName"];
console.log("playerID : " + playerID);
console.log("playerName : " + playerName);
sessionStorage.setItem("playerID", playerID);
sessionStorage.setItem("playerName", playerName);
},
(errorMessage) => {
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
}
);
/*
let xhr = new XMLHttpRequest(); //new로 생성. let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/maestro/maestro_test_player.php', true); xhr.open('POST', './../server/maestro/maestro_test_player.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
@@ -65,6 +89,7 @@ function loadMaestroTestAccountInfo() {
sessionStorage.setItem("playerName", playerName); sessionStorage.setItem("playerName", playerName);
} }
} }
*/
} }
function runMaestroAccountApp() { function runMaestroAccountApp() {
@@ -75,7 +100,23 @@ function runMaestroAccountApp() {
function deleteMaestroAllRecords() { function deleteMaestroAllRecords() {
// alert("마에스트로 전용 계정의 모든 플레이 기록이 지워집니다.\n예) 게임 기록, 타자 타수, 순위 등"); // alert("마에스트로 전용 계정의 모든 플레이 기록이 지워집니다.\n예) 게임 기록, 타자 타수, 순위 등");
if(confirm("마에스트로 전용 계정의 모든 플레이 기록이 지워집니다.\n예) 게임 기록, 타자 타수, 순위 등")) { if(confirm("마에스트로 전용 계정의 모든 플레이 기록이 지워집니다.\n예) 게임 기록, 타자 타수, 순위 등")) {
let xhr = new XMLHttpRequest(); //new로 생성. sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/maestro/delete_test_player_record.php",
"maestro_id=" + maestroID,
(jsonData) => {
alert("마에스트로 전용 계정의 모든 플레이 기록이 지워졌습니다.");
},
(errorMessage) => {
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
}
);
/* let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/maestro/delete_test_player_record.php', true); xhr.open('POST', './../server/maestro/delete_test_player_record.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID); xhr.send("maestro_id=" + maestroID);
@@ -87,6 +128,7 @@ function deleteMaestroAllRecords() {
} }
alert("마에스트로 전용 계정의 모든 플레이 기록이 지워졌습니다."); alert("마에스트로 전용 계정의 모든 플레이 기록이 지워졌습니다.");
*/
} else { } else {
} }
} }
+14 -26
View File
@@ -1,42 +1,30 @@
<?php <?php
header('Content-Type: application/json'); header("Content-Type: application/json");
/*
if(!is_numeric($enterCode)) {
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
exit;
} else if(strlen($enterCode) != 6) {
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
exit;
}
*/
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
$maestro_test_account_id = get_maestro_test_account_id("test"); $maestro_test_account_id = get_maestro_test_account_id("test");
if($maestro_test_account_id === null) { if($maestro_test_account_id === null) {
$replyJSON["ERROR"] = "등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")"; set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")");
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE); send_result_fail();
$db_conn->close();
exit; exit;
} }
$maestro_test_player_id = get_maestro_test_player_id($maestro_test_account_id); $maestro_test_player_id = get_maestro_test_player_id($maestro_test_account_id);
if($maestro_test_player_id === null) { if($maestro_test_player_id === null) {
$replyJSON["ERROR"] = "등록된 마에스트로 테스트 계정이 없습니다. (".$maestro_test_player_id.")"; set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")");
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE); send_result_fail();
$db_conn->close();
exit; exit;
} }
$maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id); $maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id);
$replyJSON["maestroID"] = $maestro_test_account_id; set_data("maestroID", $maestro_test_account_id);
$replyJSON["playerID"] = $maestro_test_player_id; set_data("playerID", $maestro_test_player_id);
$replyJSON["playerName"] = $maestro_test_player_name; set_data("playerName", $maestro_test_player_name);
$replyJSON["RESULT"] = "ok"; send_result_success();
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
exit; exit;
@@ -45,7 +33,7 @@ function get_maestro_test_account_id($maestro_name) {
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?"; $query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('s', $maestro_name); $stmt->bind_param("s", $maestro_name);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($maestro_test_account_id); $stmt->bind_result($maestro_test_account_id);
// while($stmt->fetch()) { // while($stmt->fetch()) {
@@ -62,7 +50,7 @@ function get_maestro_test_player_id($maestro_id) {
$query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?"; $query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $maestro_id); $stmt->bind_param("i", $maestro_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($maestro_test_player_id); $stmt->bind_result($maestro_test_player_id);
// while($stmt->fetch()) { // while($stmt->fetch()) {
@@ -79,7 +67,7 @@ function get_maestro_test_player_name($player_id) {
$query = "SELECT Name FROM moty_player WHERE PlayerID=?"; $query = "SELECT Name FROM moty_player WHERE PlayerID=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id); $stmt->bind_param("i", $player_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($maestro_test_player_name); $stmt->bind_result($maestro_test_player_name);
// while($stmt->fetch()) { // while($stmt->fetch()) {
+12 -21
View File
@@ -1,43 +1,34 @@
<?php <?php
header('Content-Type: application/json'); header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestro_id = $_POST["maestro_id"]; $maestro_id = $_POST["maestro_id"];
/*
if(!is_numeric($enterCode)) {
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
exit;
} else if(strlen($enterCode) != 6) {
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
exit;
}
*/
include "./../setup/connect_db.php";
$maestro_test_player_id = get_maestro_test_player_id($maestro_id); $maestro_test_player_id = get_maestro_test_player_id($maestro_id);
if($maestro_test_player_id === null) { if($maestro_test_player_id === null) {
$replyJSON["ERROR"] = "등록된 마에스트로 테스트 계정이 없습니다"; set_error_message("등록된 마에스트로 테스트 계정이 없습니다");
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE); send_result_fail();
$db_conn->close();
exit; exit;
} }
$maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id); $maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id);
$replyJSON["PlayerID"] = $maestro_test_player_id; set_data("playerID", $maestro_test_player_id);
$replyJSON["PlayerName"] = $maestro_test_player_name; set_data("playerName", $maestro_test_player_name);
$replyJSON["RESULT"] = "ok"; send_result_success();
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
exit; exit;
function get_maestro_test_player_id($maestro_id) { function get_maestro_test_player_id($maestro_id) {
global $db_conn; global $db_conn;
$query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?"; $query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $maestro_id); $stmt->bind_param("i", $maestro_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($maestro_test_player_id); $stmt->bind_result($maestro_test_player_id);
// while($stmt->fetch()) { // while($stmt->fetch()) {
@@ -54,7 +45,7 @@ function get_maestro_test_player_name($player_id) {
$query = "SELECT Name FROM moty_player WHERE PlayerID=?"; $query = "SELECT Name FROM moty_player WHERE PlayerID=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id); $stmt->bind_param("i", $player_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($maestro_test_player_name); $stmt->bind_result($maestro_test_player_name);
// while($stmt->fetch()) { // while($stmt->fetch()) {