From 0dc052dd792ebc403b9646f9859828760613464e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Sun, 28 Oct 2018 14:21:03 +0900 Subject: [PATCH] Add: player login with maestro --- src/game/global/global_variables.js | 1 + src/game/lib/session_storage_manager.js | 8 +++++ src/game/login/login.js | 20 ++++++++---- .../maestro/player_login_with_maestro.php | 32 +++++++++++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 src/web/server/maestro/player_login_with_maestro.php diff --git a/src/game/global/global_variables.js b/src/game/global/global_variables.js index a01f459..0901d69 100644 --- a/src/game/global/global_variables.js +++ b/src/game/global/global_variables.js @@ -23,6 +23,7 @@ var GAME_SCREEN_SIZE = { x: 1024, y: 768 } let sessionStorageManager = new SessionStorageManager(); { if(isDebugMode()) { + console.log("maestroName : " + sessionStorageManager.getMaestroName()); console.log("maestroID : " + sessionStorageManager.getMaestroID()); console.log("maestroAccountType : " + sessionStorageManager.getMaestroAccountType()); console.log("playerName : " + sessionStorageManager.getPlayerName()); diff --git a/src/game/lib/session_storage_manager.js b/src/game/lib/session_storage_manager.js index ebee888..44230e2 100644 --- a/src/game/lib/session_storage_manager.js +++ b/src/game/lib/session_storage_manager.js @@ -19,6 +19,14 @@ SessionStorageManager.prototype.getMaestroID = function() { 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 SessionStorageManager.prototype.setMaestroAccountType = function(value) { sessionStorage.setItem("maestroAccountType", value); diff --git a/src/game/login/login.js b/src/game/login/login.js index b160fa9..122b9d0 100644 --- a/src/game/login/login.js +++ b/src/game/login/login.js @@ -6,7 +6,7 @@ var Login = { }, create: function() { - sessionStorageManager.clear(); + // sessionStorageManager.clear(); // receive maestro_name from player_login_with_maestro.php this.game.stage.backgroundColor = '#4d4d4d'; 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; - if(sessionStorageManager.getMaestroID() === null) - this.makeMaestroNameText(textX, 200); + this.makeMaestroNameText(textX, 200); this.makeNameText(textX, 300); 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) this.inputTextMaestroName.canvasInput.focus(); @@ -50,17 +58,17 @@ var Login = { makeMaestroNameText: function(x, y) { this.makeTextField(x, y, "마에스트로 계정 :"); - this.inputTextMaestroName = this.makeInputTypeText(x, y, "삼화초"); + this.inputTextMaestroName = this.makeInputTypeText(x, y, ""); }, makeNameText: function(x, y) { this.makeTextField(x, y, "이름 :"); - this.inputTextName = this.makeInputTypeText(x, y, "박지상"); + this.inputTextName = this.makeInputTypeText(x, y, ""); }, makeEnterCodeText: function(x, y) { this.makeTextField(x, y, "입장번호 :"); - this.inputTextEnterCode = this.makeInputTypeText(x, y, "760621"); + this.inputTextEnterCode = this.makeInputTypeText(x, y, ""); }, makeTextField: function(x, y, text) { diff --git a/src/web/server/maestro/player_login_with_maestro.php b/src/web/server/maestro/player_login_with_maestro.php new file mode 100644 index 0000000..96a9f46 --- /dev/null +++ b/src/web/server/maestro/player_login_with_maestro.php @@ -0,0 +1,32 @@ + + + + + + + + + + + + +