Add: player login with maestro

This commit is contained in:
2018-10-28 14:21:03 +09:00
parent 5cb864058f
commit 0dc052dd79
4 changed files with 55 additions and 6 deletions
+1
View File
@@ -23,6 +23,7 @@ var GAME_SCREEN_SIZE = { x: 1024, y: 768 }
let sessionStorageManager = new SessionStorageManager(); let sessionStorageManager = new SessionStorageManager();
{ {
if(isDebugMode()) { if(isDebugMode()) {
console.log("maestroName : " + sessionStorageManager.getMaestroName());
console.log("maestroID : " + sessionStorageManager.getMaestroID()); console.log("maestroID : " + sessionStorageManager.getMaestroID());
console.log("maestroAccountType : " + sessionStorageManager.getMaestroAccountType()); console.log("maestroAccountType : " + sessionStorageManager.getMaestroAccountType());
console.log("playerName : " + sessionStorageManager.getPlayerName()); console.log("playerName : " + sessionStorageManager.getPlayerName());
+8
View File
@@ -19,6 +19,14 @@ SessionStorageManager.prototype.getMaestroID = function() {
return sessionStorage.getItem("maestroID"); return sessionStorage.getItem("maestroID");
} }
// maestro ID
SessionStorageManager.prototype.setMaestroName = function(value) {
sessionStorage.setItem("maestroName", value);
}
SessionStorageManager.prototype.getMaestroName = function() {
return sessionStorage.getItem("maestroName");
}
// maestro account type // maestro account type
SessionStorageManager.prototype.setMaestroAccountType = function(value) { SessionStorageManager.prototype.setMaestroAccountType = function(value) {
sessionStorage.setItem("maestroAccountType", value); sessionStorage.setItem("maestroAccountType", value);
+14 -6
View File
@@ -6,7 +6,7 @@ var Login = {
}, },
create: function() { create: function() {
sessionStorageManager.clear(); // sessionStorageManager.clear(); // receive maestro_name from player_login_with_maestro.php
this.game.stage.backgroundColor = '#4d4d4d'; this.game.stage.backgroundColor = '#4d4d4d';
this.textStyle = { font: "bold 32px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "middle" }; this.textStyle = { font: "bold 32px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "middle" };
@@ -28,10 +28,18 @@ var Login = {
var textX = this.game.world.centerX - 320; var textX = this.game.world.centerX - 320;
if(sessionStorageManager.getMaestroID() === null) this.makeMaestroNameText(textX, 200);
this.makeMaestroNameText(textX, 200);
this.makeNameText(textX, 300); this.makeNameText(textX, 300);
this.makeEnterCodeText(textX, 360); this.makeEnterCodeText(textX, 360);
if(sessionStorageManager.getMaestroName() != null) {
this.inputTextMaestroName.canvasInput.value(sessionStorageManager.getMaestroName());
} else {
if(isDebugMode()) {
this.inputTextMaestroName.canvasInput.value("삼화초");
this.inputTextName.canvasInput.value("박지상");
this.inputTextEnterCode.canvasInput.value("760621");
}
}
if(sessionStorageManager.getMaestroID() === null) if(sessionStorageManager.getMaestroID() === null)
this.inputTextMaestroName.canvasInput.focus(); this.inputTextMaestroName.canvasInput.focus();
@@ -50,17 +58,17 @@ var Login = {
makeMaestroNameText: function(x, y) { makeMaestroNameText: function(x, y) {
this.makeTextField(x, y, "마에스트로 계정 :"); this.makeTextField(x, y, "마에스트로 계정 :");
this.inputTextMaestroName = this.makeInputTypeText(x, y, "삼화초"); this.inputTextMaestroName = this.makeInputTypeText(x, y, "");
}, },
makeNameText: function(x, y) { makeNameText: function(x, y) {
this.makeTextField(x, y, "이름 :"); this.makeTextField(x, y, "이름 :");
this.inputTextName = this.makeInputTypeText(x, y, "박지상"); this.inputTextName = this.makeInputTypeText(x, y, "");
}, },
makeEnterCodeText: function(x, y) { makeEnterCodeText: function(x, y) {
this.makeTextField(x, y, "입장번호 :"); this.makeTextField(x, y, "입장번호 :");
this.inputTextEnterCode = this.makeInputTypeText(x, y, "760621"); this.inputTextEnterCode = this.makeInputTypeText(x, y, "");
}, },
makeTextField: function(x, y, text) { makeTextField: function(x, y, text) {
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<script>
<?php
$maestro_name = $_GET["maestro_name"];
// echo "maestro_name : $maestro_name</br>";
if($maestro_name == "") {
echo "no maestro_name";
run_url("./../../player/login.html");
exit;
}
echo("sessionStorage.setItem('maestroName', '$maestro_name');\n\r");
run_url("./../../client/login.html");
function run_url($targetUrl) {
echo("location.replace('$targetUrl');");
}
?>
</script>
</head>
<body>
</body>
</html>