Add: start (page)
This commit is contained in:
@@ -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');
|
||||
@@ -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');
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user