Fix: restructing session manager, ES6 -> ES5

This commit is contained in:
2018-09-14 22:22:22 +09:00
parent 72e7c1a28f
commit 3f340535ac
44 changed files with 3100 additions and 3262 deletions
+34 -37
View File
@@ -1,13 +1,10 @@
/////////////////////////////
// Login
var Login = {
class Login {
preload() {
preload: function() {
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
}
},
create() {
create: function() {
sessionStorageManager.clear();
this.game.stage.backgroundColor = '#4d4d4d';
@@ -24,12 +21,12 @@ class Login {
var textX = this.game.world.centerX - 320;
if(sessionStorageManager.maestroID === null)
if(sessionStorageManager.getMaestroID() === null)
this.makeMaestroNameText(textX, 200);
this.makeNameText(textX, 300);
this.makeEnterCodeText(textX, 360);
if(sessionStorageManager.maestroID === null)
if(sessionStorageManager.getMaestroID() === null)
this.inputTextMaestroName.canvasInput.focus();
else
this.inputTextName.canvasInput.focus();
@@ -37,31 +34,31 @@ class Login {
this.makeStartButton(game.world.centerX, game.world.centerY + 100);
this.makeInfoText();
}
},
makeMaestroNameText(x, y) {
makeMaestroNameText: function(x, y) {
this.makeTextField(x, y, "마에스트로 계정 :");
this.inputTextMaestroName = this.makeInputTypeText(x, y, "jisangs");
}
},
makeNameText(x, y) {
makeNameText: function(x, y) {
this.makeTextField(x, y, "이름 :");
this.inputTextName = this.makeInputTypeText(x, y, "박지상");
}
},
makeEnterCodeText(x, y) {
makeEnterCodeText: function(x, y) {
this.makeTextField(x, y, "입장번호 :");
this.inputTextEnterCode = this.makeInputTypeText(x, y, "760621");
}
},
makeTextField(x, y, text) {
makeTextField: function(x, y, text) {
return game.add.text(x, y, text, this.textStyle)
.setTextBounds(0, 0, 200, 0)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
.boundsAlignH = 'right';
}
},
makeInputTypeText(x, y, text) {
makeInputTypeText: function(x, y, text) {
var inputText = new InputTypeText(x + 420, y);
inputText.anchor.set(0.5);
inputText.canvasInput.value('');
@@ -75,9 +72,9 @@ class Login {
}
return inputText;
}
},
makeStartButton(x, y) {
makeStartButton: function(x, y) {
var setting = new RoundRectButtonSetting(x, y, 200, 100);
setting.fontStyle.fontWeight = "bold";
@@ -86,26 +83,26 @@ class Login {
RoundRectButton.NONE_ICON, "시작",
(function() { this.startMenu(); }).bind(this)
);
}
},
makeInfoText(x, y) {
makeInfoText: function(x, y) {
var textStyle = { font: "30px Arial", fill: "#faa" };
this.infoText = game.add.text(game.world.centerX, 640, "", textStyle);
this.infoText.anchor.set(0.5);
this.infoText.stroke = "#333";
this.infoText.strokeThickness = 3;
}
},
startMenu() {
startMenu: function() {
var maestroName = this.inputTextMaestroName.canvasInput._value;
sessionStorageManager.playerName = this.inputTextName.canvasInput._value;
sessionStorageManager.setPlayerName(this.inputTextName.canvasInput._value);
var enterCode = this.inputTextEnterCode.canvasInput._value;
var dbConnectManager = new DBConnectManager();
dbConnectManager.requestCheckPlayerLogin(
maestroName,
sessionStorageManager.playerName,
sessionStorageManager.getPlayerName(),
enterCode,
(function(jsonData) {
this.loginSucceeded(jsonData);
@@ -114,23 +111,23 @@ class Login {
this.loginFailed(jsonData);
}).bind(this)
);
}
},
loginSucceeded(jsonData) {
sessionStorageManager.maestroID = jsonData['MaestroID'];
sessionStorageManager.maestroAccountType = jsonData['MaestroAccountType'];
sessionStorageManager.playerID = jsonData['PlayerID'];
sessionStorageManager.playerName = jsonData['PlayerName'];
sessionStorageManager.playerAccountType = jsonData['PlayerAccountType'];
loginSucceeded: function(jsonData) {
sessionStorageManager.setMaestroID(jsonData['MaestroID']);
sessionStorageManager.setMaestroAccountType(jsonData['MaestroAccountType']);
sessionStorageManager.setPlayerID(jsonData['PlayerID']);
sessionStorageManager.setPlayerName(jsonData['PlayerName']);
sessionStorageManager.setPlayerAccountType(jsonData['PlayerAccountType']);
sessionStorageManager.playingAppName = "menu";
sessionStorageManager.setPlayingAppName("menu");
location.href = '../../web/client/menu_app.html';
// console.log("===== after login =====");
// console.log(sessionStorageManager.playerID);
}
},
loginFailed(jsonData) {
loginFailed: function(jsonData) {
sessionStorageManager.clear();
// show retry message