diff --git a/src/game/global/define_variables_global.js b/src/game/global/define_variables_global.js index 402823d..7ae0670 100644 --- a/src/game/global/define_variables_global.js +++ b/src/game/global/define_variables_global.js @@ -19,17 +19,14 @@ function isReleaseMode() { const GAME_SCREEN_SIZE = { x: 1024, y: 768 } -let playerName; -let playerUserID; -let bestRecord = 0; +let sessingPlayerName; +let sessionPlayerUserID; { - playerName = sessionStorage.getItem("playerName"); - console.log("playerName : " + playerName); - playerUserID = sessionStorage.getItem("playerUserID"); - console.log("playerUserID : " + playerUserID); - bestRecord = sessionStorage.getItem("bestRecord"); - console.log("bestRecord : " + bestRecord); + sessionPlayerName = sessionStorage.getItem("playerName"); + console.log("playerName : " + sessionPlayerName); + sessionPlayerUserID = sessionStorage.getItem("playerUserID"); + console.log("playerUserID : " + sessionPlayerUserID); } let textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" }; diff --git a/src/game/login/login.js b/src/game/login/login.js index f877f5b..d8976a1 100644 --- a/src/game/login/login.js +++ b/src/game/login/login.js @@ -79,7 +79,7 @@ let Login = { }, startMenu: function() { - playerName = self.inputTextName.canvasInput._value; + sessionPlayerName = self.inputTextName.canvasInput._value; let birthday = self.inputTextBirthday.canvasInput._value; xhr = new XMLHttpRequest(); @@ -105,7 +105,7 @@ let Login = { } xhr.open('POST', '../../web/client/php/check_user.php', true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - let param = 'name=' + playerName + '&birthday=' + birthday; + let param = 'name=' + sessionPlayerName + '&birthday=' + birthday; // console.log(param); xhr.send(param); @@ -127,12 +127,12 @@ let Login = { }, loginSucceeded: function(jsonData) { - playerUserID = jsonData['UserID']; + sessionPlayerUserID = jsonData['UserID']; // console.log('playerUserID : ' + playerUserID); // this.state.start('Menu'); - sessionStorage.setItem("playerName", playerName); - sessionStorage.setItem("playerUserID", playerUserID); + sessionStorage.setItem("playerName", sessionPlayerName); + sessionStorage.setItem("playerUserID", sessionPlayerUserID); console.log("playerName : " + sessionStorage.getItem("playerName")); console.log("playerUserID : " + sessionStorage.getItem("playerUserID")); diff --git a/src/game/menu/menu_app.js b/src/game/menu/menu_app.js index f74cdb2..ffbd07e 100644 --- a/src/game/menu/menu_app.js +++ b/src/game/menu/menu_app.js @@ -24,7 +24,7 @@ let MenuApp = { // app icons let space_invaders = new AppButton(AppButton.TYPE_MOUSE, "icon_fullscreen", () => { - console.log("space invaders"); + location.href = '../../web/client/start.html'; } ); space_invaders.move(400, 400); @@ -42,7 +42,7 @@ let MenuApp = { screenBottom.makeBottomLine(); // screenBottom.printBottomLeftText("게임 진행 정보"); screenBottom.printBottomCenterText("메뉴"); - screenBottom.printBottomRightText(playerName); + screenBottom.printBottomRightText(sessionPlayerName); // this.loadTypingStageData(); }, diff --git a/src/game/start/main.js b/src/game/start/main.js new file mode 100644 index 0000000..97f7d28 --- /dev/null +++ b/src/game/start/main.js @@ -0,0 +1,12 @@ +///////////////////////////// +// Main game + +const CONTENT_ID = "Start"; + +var game = new Phaser.Game( + GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y, + Phaser.CANVAS, CONTENT_ID +); + +game.state.add('Start', Start); +game.state.start('Start'); diff --git a/src/game/start/start.js b/src/game/start/start.js new file mode 100644 index 0000000..f2ac41d --- /dev/null +++ b/src/game/start/start.js @@ -0,0 +1,69 @@ +///////////////////////////// +// Start + +let Start = { + + preload: function() { + game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png'); + }, + + create: function() { + this.game.stage.backgroundColor = '#4d4d4d'; + + // top + let backButton = new BackButton( () => { + location.href = '../../web/client/menu_app.html'; + }); + + let fullscreenButton = new FullscreenButton(this.game); + + + // contents + this.makeStartButton(); + + + // bottom + let screenBottom = new ScreenBottom(game); + screenBottom.makeBottomLine(); + // screenBottom.printBottomLeftText("게임 진행 정보"); + screenBottom.printBottomCenterText("Game name"); + screenBottom.printBottomRightText(sessionPlayerName); + + // this.loadTypingStageData(); + }, + + makeStartButton: function() { + let setting = new RoundRectButtonSetting(200, 100); + setting.fontStyle.fontWeight = "bold"; + + let startButton = new RoundRectButton(setting, "시작", this.startStage); + startButton.move(game.world.centerX, game.world.centerY); + }, + + + + loadTypingStageData: function() { + var self = this; + + xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + // console.log("onreadystatechange : " + xhr); + // console.log("xhr.readyState : " + xhr.readyState); + // console.log("xhr.status : " + xhr.status); + if(xhr.readyState == 4 && xhr.status == 200) { + // console.log(xhr.responseText); + var jsonData = JSON.parse(xhr.responseText); + self.updateStageButton(jsonData); + } + } + xhr.open('GET', 'activated_stage_list.php', true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.send(); + }, + + startStage: function() { + console.log("startStage"); + // this.startState('TypingTestStage'); + }, + +} \ No newline at end of file diff --git a/src/web/client/start.html b/src/web/client/start.html new file mode 100644 index 0000000..0c99362 --- /dev/null +++ b/src/web/client/start.html @@ -0,0 +1,41 @@ + + +
+ +