diff --git a/src/game/license_timer/game.js b/src/game/license_timer/game.js index bbd81dd..0d52064 100644 --- a/src/game/license_timer/game.js +++ b/src/game/license_timer/game.js @@ -3,9 +3,9 @@ var LicenseTimer = { create: function() { Phaser.Device.whenReady(function () { game.plugins.add(PhaserInput.Plugin); - }); +  }); - game.stage.backgroundColor = '#4d4d4d'; + game.stage.backgroundColor = "#4d4d4d"; this.initVariables(); @@ -32,37 +32,6 @@ var LicenseTimer = { this.fullscreenButton = new FullscreenButton(); - var btnTexture = new Phaser.Graphics() - .beginFill(0xffffff) - .drawRoundedRect(0, 0, 200, 60, 5) - .endFill() - .generateTexture(); - - // return game.add.sprite(0, 0, btnTexture); - game.add.sprite( - game.world.centerX - 85, game.world.centerY, - btnTexture - ); - - this.subjectInputText = game.add.inputField(game.world.centerX - 85, game.world.centerY, { - font: '32px Arial', - fill: '#212121', - fillAlpha: 0, - fontWeight: "", //'bold', - // forceCase: PhaserInput.ForceCase.upper, - width: 200, - max: 100, - padding: 8, - borderWidth: 1, - borderColor: '#000', - borderRadius: 6, - placeHolder: '과목 입력', - textAlign: 'center', - zoom: true - }); - this.subjectInputText.setText(''); - this.subjectInputText.blockInput = false; - this.makeTimer(); @@ -70,12 +39,12 @@ var LicenseTimer = { this.makeInputScoreGroup(); // bottom ui - this.screenBottomUI = new ScreenBottomUI(); + // this.screenBottomUI = new ScreenBottomUI(); // this.screenBottomUI.printLeftText(); - this.printSubject(); - this.printRecentScore(this.recentRecord); + // this.printSubject(); + // this.printRecentScore(this.recentRecord); // this.screenBottomUI.printCenterText("점수 등록은 선생님에게 부탁하세요."); - this.screenBottomUI.printRightText(sessionStorageManager.getPlayerName()); + // this.screenBottomUI.printRightText(sessionStorageManager.getPlayerName()); }, @@ -161,40 +130,6 @@ var LicenseTimer = { ); - /* - // modify timer buttons - setting.x = GAME_SCREEN_SIZE.x - 210; - setting.y = 120; - setting.width = 100; - setting.height = 50; - var plus10minButton = new RoundRectButton( - setting, - null, "+10분", - (function() { console.log("+10 min"); }).bind(this) - ); - - setting.x = GAME_SCREEN_SIZE.x - 80; - var plus1minButton = new RoundRectButton( - setting, - null, "+1분", - (function() { console.log("+1 min"); }).bind(this) - ); - - setting.x = GAME_SCREEN_SIZE.x - 210; - setting.y = 180; - var minus10minButton = new RoundRectButton( - setting, - null, "-10분", - (function() { console.log("-10 min"); }).bind(this) - ); - - setting.x = GAME_SCREEN_SIZE.x - 80; - var minus1minButton = new RoundRectButton( - setting, - null, "-1분", - (function() { console.log("-1 min"); }).bind(this) - ); - */ }, makeStartButtonGroup: function() { @@ -214,48 +149,44 @@ var LicenseTimer = { }, makeInputScoreGroup: function() { - var InputScoreGruopPosY = GAME_SCREEN_SIZE.y - 120; + var InputScoreGruopPosY = GAME_SCREEN_SIZE.y - 70; // bar var bar = game.add.graphics(); - bar.beginFill(0x000000, 0.2); + bar.beginFill(0x303030); //, 0.2); bar.drawRect(0, InputScoreGruopPosY, GAME_SCREEN_SIZE.x, 70); + + var subjectTextSetting = this.makeInputTextSetting(300, "과목 입력"); + this.subjectText = this.makeInputText(20, InputScoreGruopPosY + 10, subjectTextSetting); + this.subjectText.setText(this.subject); + + var setting = new RoundRectButtonSetting(0, 0, 0, 0); - setting.fontStyle.boundsAlignH = "center"; // left, center. right + setting.fontStyle.boundsAlignH = "left"; // left, center. right setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom setting.strokeWidthPx = 5; - // subject input text - this.inputTextSubject = new InputTypeText(220, InputScoreGruopPosY + 35); - this.setInputTextWidth(this.inputTextSubject, 300); - this.inputTextSubject.anchor.set(0.5); - this.inputTextSubject.canvasInput.value(this.subject); - this.inputTextSubject.canvasInput.focus(); - this.inputTextSubject.canvasInput.placeHolder("과목 입력"); - var titleTextStyle = { font: "36px Arial", fill: "#fff", align: "center"}; - this.titleText = game.add.text(350, InputScoreGruopPosY + 40, "과목에서", titleTextStyle); + this.titleText = game.add.text(350, InputScoreGruopPosY + 40, "과목", titleTextStyle); this.titleText.anchor.set(0, 0.5); // subject input text - this.inputTextScore = new InputTypeText(game.world.centerX + 200, InputScoreGruopPosY + 35); - this.setInputTextWidth(this.inputTextScore, 200); - this.inputTextScore.anchor.set(0.5); - this.inputTextScore.canvasInput.value(''); - this.inputTextScore.canvasInput.focus(); - this.inputTextScore.canvasInput.placeHolder("점수 입력"); - // inputTextScore.canvasInput._onkeydown = this.checkInputText; - // inputTextScore.canvasInput._onkeyup = function() { - // this.inputTextScore.canvasInput._onkeyup = function() { - // self.checkTypingContents(event); - // } + // var inputTextSetting = this.makeInputTextSetting(200, "점수 입력"); + var recordTextSetting = this.makeInputTextSetting(150, "점수 입력"); + this.recordText = this.makeInputText(game.world.centerX - 50, InputScoreGruopPosY + 10, recordTextSetting); + // this.subjectText.setText(this.subject); - this.titleText = game.add.text(740, InputScoreGruopPosY + 40, "점 획득", titleTextStyle); + this.titleText = game.add.text(640, InputScoreGruopPosY + 40, "점", titleTextStyle); this.titleText.anchor.set(0, 0.5); + var passwordTextSetting = this.makeInputTextSetting(150, "비밀번호"); + passwordTextSetting.type = PhaserInput.InputType.password; + this.passwordText = this.makeInputText(GAME_SCREEN_SIZE.x - 330, InputScoreGruopPosY + 10, passwordTextSetting); + + // set timer buttons setting.x = GAME_SCREEN_SIZE.x - 80; setting.y = InputScoreGruopPosY + 35; @@ -264,7 +195,7 @@ var LicenseTimer = { var set60SecButton = new RoundRectButton( setting, null, "저장", - (function() { console.log(this.subjectInputText.value); console.log("save score"); }).bind(this) + (function() { console.log(this.subjectText.value); console.log("save score"); }).bind(this) ); }, @@ -362,6 +293,34 @@ var LicenseTimer = { + ":" + this.getTwoDigitNumber(this.timeLeftSecond); }, + makeInputTextSetting(width, placeHolder) { + return { + font: "32px Arial", + fill: "#000000", + fillAlpha: 1, + fontWeight: "bold", + forceCase: "", // PhaserInput.ForceCase.upper, + width: width, + max: 100, + padding: 8, + borderWidth: 1, + borderColor: "#aaa", + borderRadius: 6, + placeHolder: placeHolder, + textAlign: "center", + zoom: true + } + }, + + makeInputText(x, y, setting) { + var inputText = game.add.inputField(x, y, setting); + inputText.setText(''); + inputText.blockInput = false; + + return inputText; + }, + + /* printSubject: function() { this.screenBottomUI.printLeftText("과목 : " + this.subject); }, @@ -370,6 +329,7 @@ var LicenseTimer = { var recentRecord = RecordUtil.getRecordValueWithUnit(record, sessionStorageManager.getPlayingAppID()); this.screenBottomUI.printCenterText("최근 점수 : " + recentRecord); }, + */ }