From de600603dab03a3a21662fda90a14f428f9a9200 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, 6 May 2018 14:33:20 +0900 Subject: [PATCH] Add: sessionStorage, menu_app --- src/game/global/define_variables_global.js | 13 +++++++- src/game/global/loading/loading.js | 3 ++ src/game/login/login.js | 7 ++++- src/game/menu/main_menu_app.js | 12 ++++++++ src/game/menu/menu_app.js | 4 +-- src/web/client/login.html | 2 +- src/web/client/menu_app.html | 36 ++++++++++++++++++++++ 7 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 src/game/menu/main_menu_app.js create mode 100644 src/web/client/menu_app.html diff --git a/src/game/global/define_variables_global.js b/src/game/global/define_variables_global.js index cdcc35c..39bc002 100644 --- a/src/game/global/define_variables_global.js +++ b/src/game/global/define_variables_global.js @@ -22,7 +22,18 @@ const GAME_SCREEN_SIZE = { x: 1024, y: 768 } let playerName; let playerUserID; let bestRecord = 0; -let playingStageData; + +{ + playerName = sessionStorage.getItem("playerName"); + console.log("playerName"); + console.log(playerName); + playerUserID = sessionStorage.getItem("playerUserID"); + console.log("playerUserID"); + console.log(playerUserID); + bestRecord = sessionStorage.getItem("bestRecord"); + console.log("bestRecord"); + console.log(bestRecord); +} let textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" }; diff --git a/src/game/global/loading/loading.js b/src/game/global/loading/loading.js index abd72c9..46d9cdf 100644 --- a/src/game/global/loading/loading.js +++ b/src/game/global/loading/loading.js @@ -12,6 +12,9 @@ var Loading = { create: function() { // console.log('Loading'); + + let userID = sessionStorage.getItem("UserID"); + console.log("userID : " + userID); this.game.stage.backgroundColor = '#4d4d4d'; diff --git a/src/game/login/login.js b/src/game/login/login.js index 8cb7e9a..5494d62 100644 --- a/src/game/login/login.js +++ b/src/game/login/login.js @@ -124,8 +124,13 @@ let Login = { loginSucceeded: function(jsonData) { playerUserID = jsonData['UserID']; // console.log('playerUserID : ' + playerUserID); + // this.state.start('Menu'); - this.state.start('Menu'); + sessionStorage.setItem("UserID", playerUserID); + // let userID = sessionStorage.getItem("UserID"); + // console.log("userID : " + userID); + + location.href = '../../web/client/menu_app.html'; }, loginFailed: function(jsonData) { diff --git a/src/game/menu/main_menu_app.js b/src/game/menu/main_menu_app.js new file mode 100644 index 0000000..d2a0db8 --- /dev/null +++ b/src/game/menu/main_menu_app.js @@ -0,0 +1,12 @@ +///////////////////////////// +// Main game + +const CONTENT_ID = "Menu"; + +var game = new Phaser.Game( + GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y, + Phaser.CANVAS, CONTENT_ID +); + +game.state.add('MenuApp', MenuApp); +game.state.start('MenuApp'); diff --git a/src/game/menu/menu_app.js b/src/game/menu/menu_app.js index d2329ae..b89f319 100644 --- a/src/game/menu/menu_app.js +++ b/src/game/menu/menu_app.js @@ -1,7 +1,7 @@ ///////////////////////////// -// Menu +// MenuApp -var Menu = { +var MenuApp = { create: function() { this.stageButtonArray = []; diff --git a/src/web/client/login.html b/src/web/client/login.html index c9caa1f..e03c411 100644 --- a/src/web/client/login.html +++ b/src/web/client/login.html @@ -2,7 +2,7 @@ - Login + 로그인 diff --git a/src/web/client/menu_app.html b/src/web/client/menu_app.html new file mode 100644 index 0000000..9c4c3cd --- /dev/null +++ b/src/web/client/menu_app.html @@ -0,0 +1,36 @@ + + + + + 메뉴 + + + + + + + + + + + + + + + + + + + +