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);
}
function saveMaestroID() {
function saveMaestroID(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() {
if(maestroID === -1) {
location.href = "./../main/index.html";
} else {
location.href = "./../maestro/main_menu.html";
let url = window.location.href;
if(getParentDirectory(url) === "maestro") {
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() {
+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="./../js/main.js"></script>
<script type="text/javascript" src="./../js/request_server.js"></script>
<script type="text/javascript">
saveMaestroID(-1);
$(document).ready(function() {
$("#header").load("./../module/header.html");
$("#section").load("./../module/home_section.html");
$("#footer").load("./../module/footer.html");
+1 -1
View File
@@ -38,7 +38,7 @@
</li>
<li>
<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>
</li>
</ul>
+19 -36
View File
@@ -15,40 +15,14 @@
<script>
function loadMaestroTestAccountInfo() {
let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/maestro/maestro_test_account.php', true);
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;
}
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/maestro/maestro_test_account.php",
"",
let replyJSON = JSON.parse(xhr.responseText);
// console.log(replyJSON);
if(replyJSON === null) {
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"];
(jsonData) => {
let maestroID = jsonData["maestroID"];
let playerID = jsonData["playerID"];
let playerName = jsonData["playerName"];
console.log("maestroID : " + maestroID);
console.log("playerID : " + playerID);
@@ -57,13 +31,22 @@ function loadMaestroTestAccountInfo() {
sessionStorage.setItem("maestroID", maestroID);
sessionStorage.setItem("playerID", playerID);
sessionStorage.setItem("playerName", playerName);
},
(errorMessage) => {
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
}
}
);
let xhr = new XMLHttpRequest(); //new로 생성.
}
function playFree() {
loadMaestroTestAccountInfo();
window.open("./../client/menu_app.html", "_blank");
// window.open("./../client/menu_app.html", "_blank");
location.href = "./../client/menu_app.html";
}
function experienceMaestro() {
@@ -116,7 +99,7 @@ function experienceMaestro() {
</ul>
<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>
<ul id="register_tip">
+43 -1
View File
@@ -24,6 +24,30 @@
<script type="text/javascript">
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로 생성.
xhr.open('POST', './../server/maestro/maestro_test_player.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
@@ -65,6 +89,7 @@ function loadMaestroTestAccountInfo() {
sessionStorage.setItem("playerName", playerName);
}
}
*/
}
function runMaestroAccountApp() {
@@ -75,7 +100,23 @@ function runMaestroAccountApp() {
function deleteMaestroAllRecords() {
// alert("마에스트로 전용 계정의 모든 플레이 기록이 지워집니다.\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.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID);
@@ -87,6 +128,7 @@ function deleteMaestroAllRecords() {
}
alert("마에스트로 전용 계정의 모든 플레이 기록이 지워졌습니다.");
*/
} else {
}
}
+14 -26
View File
@@ -1,42 +1,30 @@
<?php
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;
}
*/
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestro_test_account_id = get_maestro_test_account_id("test");
if($maestro_test_account_id === null) {
$replyJSON["ERROR"] = "등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")");
send_result_fail();
exit;
}
$maestro_test_player_id = get_maestro_test_player_id($maestro_test_account_id);
if($maestro_test_player_id === null) {
$replyJSON["ERROR"] = "등록된 마에스트로 테스트 계정이 없습니다. (".$maestro_test_player_id.")";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")");
send_result_fail();
exit;
}
$maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id);
$replyJSON["maestroID"] = $maestro_test_account_id;
$replyJSON["playerID"] = $maestro_test_player_id;
$replyJSON["playerName"] = $maestro_test_player_name;
$replyJSON["RESULT"] = "ok";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
set_data("maestroID", $maestro_test_account_id);
set_data("playerID", $maestro_test_player_id);
set_data("playerName", $maestro_test_player_name);
send_result_success();
exit;
@@ -45,7 +33,7 @@ function get_maestro_test_account_id($maestro_name) {
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('s', $maestro_name);
$stmt->bind_param("s", $maestro_name);
$stmt->execute();
$stmt->bind_result($maestro_test_account_id);
// while($stmt->fetch()) {
@@ -62,7 +50,7 @@ function get_maestro_test_player_id($maestro_id) {
$query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $maestro_id);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
$stmt->bind_result($maestro_test_player_id);
// while($stmt->fetch()) {
@@ -79,7 +67,7 @@ function get_maestro_test_player_name($player_id) {
$query = "SELECT Name FROM moty_player WHERE PlayerID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id);
$stmt->bind_param("i", $player_id);
$stmt->execute();
$stmt->bind_result($maestro_test_player_name);
// while($stmt->fetch()) {
+12 -21
View File
@@ -1,43 +1,34 @@
<?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"];
/*
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);
if($maestro_test_player_id === null) {
$replyJSON["ERROR"] = "등록된 마에스트로 테스트 계정이 없습니다";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
set_error_message("등록된 마에스트로 테스트 계정이 없습니다");
send_result_fail();
exit;
}
$maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id);
$replyJSON["PlayerID"] = $maestro_test_player_id;
$replyJSON["PlayerName"] = $maestro_test_player_name;
$replyJSON["RESULT"] = "ok";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
set_data("playerID", $maestro_test_player_id);
set_data("playerName", $maestro_test_player_name);
send_result_success();
exit;
function get_maestro_test_player_id($maestro_id) {
global $db_conn;
$query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $maestro_id);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
$stmt->bind_result($maestro_test_player_id);
// while($stmt->fetch()) {
@@ -54,7 +45,7 @@ function get_maestro_test_player_name($player_id) {
$query = "SELECT Name FROM moty_player WHERE PlayerID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id);
$stmt->bind_param("i", $player_id);
$stmt->execute();
$stmt->bind_result($maestro_test_player_name);
// while($stmt->fetch()) {