Fix: setting - change player enter code (complete)
This commit is contained in:
+25
-94
@@ -7,7 +7,7 @@ var Setup = {
|
||||
|
||||
create: function() {
|
||||
this.game.stage.backgroundColor = '#4d4d4d';
|
||||
this.textStyle = { font: "bold 32px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "middle" };
|
||||
this.textStyle = { font: "32px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "middle" };
|
||||
|
||||
// keyboard shortcut
|
||||
this.keyboardShortcut = new KeyboardShortcut();
|
||||
@@ -31,32 +31,12 @@ var Setup = {
|
||||
screenTopUI.makeFullScreenButton();
|
||||
|
||||
|
||||
var textX = this.game.world.centerX - 320;
|
||||
this.makePrevEnterCodeText(textX, 300);
|
||||
this.makeNewEnterCodeInput(textX, 360);
|
||||
var textStartY = 240;
|
||||
this.makePrevEnterCodeText(game.world.centerX, textStartY);
|
||||
this.makeNewEnterCodeInput(game.world.centerX, textStartY + 60);
|
||||
this.makeEnterCodeHint(game.world.centerX, textStartY + 100);
|
||||
|
||||
this.startButton = this.makeCheckEnterCodeButton(game.world.centerX, game.world.centerY + 100);
|
||||
/*
|
||||
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 || sessionStorageManager.getMaestroID() == -1)
|
||||
this.inputTextMaestroName.canvasInput.focus();
|
||||
else
|
||||
this.inputTextName.canvasInput.focus();
|
||||
|
||||
this.makeStartButton(game.world.centerX, game.world.centerY + 100);
|
||||
*/
|
||||
this.startButton = this.makeCheckEnterCodeButton(game.world.centerX, textStartY + 200);
|
||||
|
||||
this.makeInfoText();
|
||||
this.infoText.text = "새로운 입장번호를 입력하신 후, [ 변경 ] 버튼을 눌러주세요.";
|
||||
@@ -80,20 +60,28 @@ var Setup = {
|
||||
},
|
||||
|
||||
makePrevEnterCodeText: function(x, y) {
|
||||
this.makeTextField(x, y, "현재의 입장번호 :");
|
||||
this.prevEnterCodeText = this.makeTextField(x + 200 + 40, y, "111111");
|
||||
var title = this.makeTextField(x - 10, y, "현재 입장번호 :", this.textStyle);
|
||||
title.anchor.x = 1;
|
||||
this.prevEnterCodeText = this.makeTextField(x + 10, y, "", this.textStyle);
|
||||
},
|
||||
|
||||
makeNewEnterCodeInput: function(x, y) {
|
||||
this.makeTextField(x, y, "새로운 입장번호 :");
|
||||
this.inputTextEnterCode = this.makeInputTypeText(x + 20, y, "");
|
||||
this.inputTextEnterCode.canvasInput.placeHolder("입력 후 [ ENTER ]키를 누르세요");
|
||||
var title = this.makeTextField(x - 10, y, "바꿀 입장번호 :", this.textStyle);
|
||||
title.anchor.x = 1;
|
||||
this.inputTextEnterCode = this.makeInputTypeText(x + 10 - 220, y, "");
|
||||
this.inputTextEnterCode.canvasInput.placeHolder("새로운 입장번호");
|
||||
},
|
||||
|
||||
makeEnterCodeHint: function(x, y) {
|
||||
var textStyle = { font: "18px Arial", fill: "#0dd" };
|
||||
var hint = this.makeTextField(x + 10, y, "최소 2개 ~ 최대 8개의 숫자로 입력하세요.", textStyle);
|
||||
hint.anchor.x = 0;
|
||||
},
|
||||
|
||||
|
||||
|
||||
makeTextField: function(x, y, text) {
|
||||
var textfield = game.add.text(x, y, text, this.textStyle)
|
||||
makeTextField: function(x, y, text, textStyle) {
|
||||
var textfield = game.add.text(x, y, text, textStyle)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
textfield.anchor.x = 0;
|
||||
textfield.anchor.y = 0.5;
|
||||
@@ -157,6 +145,8 @@ var Setup = {
|
||||
if(!accountValidator.isValidPlayerPW(newEnterCode)) {
|
||||
var errorMessage = accountValidator.messageForInvalidPlayerPW(newEnterCode);
|
||||
this.showInfoText(errorMessage);
|
||||
this.inputTextEnterCode.canvasInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.showInfoText("입장번호를 바꾸겠습니다.");
|
||||
@@ -175,42 +165,10 @@ var Setup = {
|
||||
this.showInfoText("입장번호 변경에 실패하였습니다.")
|
||||
}).bind(this)
|
||||
);
|
||||
/*
|
||||
var maestroName = this.inputTextMaestroName.canvasInput._value;
|
||||
sessionStorageManager.setPlayerName(this.inputTextName.canvasInput._value);
|
||||
var enterCode = this.inputTextEnterCode.canvasInput._value;
|
||||
|
||||
if(maestroName == "") {
|
||||
this.infoText.text = "마에스트로 계정 이름을 입력해주세요";
|
||||
this.inputTextMaestroName.canvasInput.focus();
|
||||
return;
|
||||
} else if(sessionStorageManager.getPlayerName() == "") {
|
||||
this.infoText.text = "학생의 이름을 입력해주세요";
|
||||
this.inputTextName.canvasInput.focus();
|
||||
return;
|
||||
} else if(enterCode == "") {
|
||||
this.infoText.text = "학생의 입장번호를 입력해주세요";
|
||||
this.inputTextEnterCode.canvasInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var dbConnectManager = new DBConnectManager();
|
||||
dbConnectManager.requestCheckPlayerLogin(
|
||||
maestroName,
|
||||
sessionStorageManager.getPlayerName(),
|
||||
enterCode,
|
||||
(function(jsonData) {
|
||||
this.loginSucceeded(jsonData);
|
||||
}).bind(this),
|
||||
(function(jsonData) {
|
||||
this.loginFailed(jsonData);
|
||||
}).bind(this)
|
||||
);
|
||||
*/
|
||||
},
|
||||
|
||||
loadPrevEnterCode: function() {
|
||||
this.prevEnterCode = '1111';
|
||||
this.prevEnterCode = '';
|
||||
|
||||
var dbConnectManager = new DBConnectManager();
|
||||
dbConnectManager.requestPlayerEnterCode(
|
||||
@@ -222,36 +180,9 @@ var Setup = {
|
||||
}).bind(this),
|
||||
(function(jsonData) {
|
||||
this.showInfoText(jsonData['error']);
|
||||
this.statButton.buttonDisabled();
|
||||
// this.statButton.buttonDisabled();
|
||||
}).bind(this)
|
||||
);
|
||||
},
|
||||
|
||||
/*
|
||||
loginSucceeded: function(jsonData) {
|
||||
sessionStorageManager.setMaestroID(jsonData['MaestroID']);
|
||||
sessionStorageManager.setMaestroAccountType(jsonData['MaestroAccountType']);
|
||||
sessionStorageManager.setPlayerID(jsonData['PlayerID']);
|
||||
sessionStorageManager.setPlayerName(jsonData['PlayerName']);
|
||||
sessionStorageManager.setPlayerAccountType(jsonData['PlayerAccountType']);
|
||||
|
||||
sessionStorageManager.setPlayingAppName("menu");
|
||||
location.href = '../../web/client/menu_app.html';
|
||||
|
||||
// console.log("===== after login =====");
|
||||
// console.log(sessionStorageManager.playerID);
|
||||
},
|
||||
|
||||
loginFailed: function(jsonData) {
|
||||
sessionStorageManager.clear();
|
||||
|
||||
// show retry message
|
||||
// console.log('login failed, jsonData : ' + JSON.stringify(jsonData));
|
||||
|
||||
if(jsonData["error"] !== null) {
|
||||
this.infoText.text = jsonData["error"];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -40,7 +40,6 @@ AccountValidator.prototype.isValidMaestroPW = function(textPW) {
|
||||
}
|
||||
|
||||
AccountValidator.prototype.messageForInvalidMaestroPW = function(textPW) {
|
||||
console.log(textPW);
|
||||
if(textPW.length < AccountValidator.MAESTRO_PW_LENGTH_MINIMUM)
|
||||
return "마에스트로의 암호는 " + AccountValidator.MAESTRO_PW_LENGTH_MINIMUM + "글자 이상이어야 합니다.";
|
||||
else if(textPW.length > AccountValidator.MAESTRO_PW_LENGTH_MAXIMUM)
|
||||
@@ -81,7 +80,6 @@ AccountValidator.prototype.isValidPlayerPW = function(textPW) {
|
||||
}
|
||||
|
||||
AccountValidator.prototype.messageForInvalidPlayerPW = function(textPW) {
|
||||
console.log(textPW);
|
||||
if(typeof textPW == "undefined" || textPW == null || textPW == "")
|
||||
return "학생 입장 번호를 입력해 주세요.";
|
||||
else if(textPW.length < Number(AccountValidator.PLAYER_PW_LENGTH_MINIMUM))
|
||||
|
||||
Reference in New Issue
Block a user