From 37fa857983861a43c7e299258efa120e3f4d628b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Sat, 8 Dec 2018 18:26:26 +0900 Subject: [PATCH] Add: sample PhaserInput --- src/game/license_timer/game.js | 45 +++++++++++++++++++++++++++++-- src/web/client/license_timer.html | 1 + 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/game/license_timer/game.js b/src/game/license_timer/game.js index 46fda46..bbd81dd 100644 --- a/src/game/license_timer/game.js +++ b/src/game/license_timer/game.js @@ -1,6 +1,10 @@ var LicenseTimer = { create: function() { + Phaser.Device.whenReady(function () { + game.plugins.add(PhaserInput.Plugin); + }); + game.stage.backgroundColor = '#4d4d4d'; this.initVariables(); @@ -23,6 +27,44 @@ var LicenseTimer = { this.titleText = game.add.text(game.world.centerX, 35, "자격증 타이머", titleTextStyle); this.titleText.anchor.set(0.5); + + + 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(); this.makeInputScoreGroup(); @@ -222,14 +264,13 @@ var LicenseTimer = { var set60SecButton = new RoundRectButton( setting, null, "저장", - (function() { console.log("save score"); }).bind(this) + (function() { console.log(this.subjectInputText.value); console.log("save score"); }).bind(this) ); }, setInputTextWidth(inputText, width) { inputText.canvasInput.width = width; - console.log(inputText.canvasInput); inputText.canvasInput._shadowCanvas.setAttribute('width', self._width + self._padding * 2); inputText.canvasInput._hiddenInput.style.width = self._width + 'px'; diff --git a/src/web/client/license_timer.html b/src/web/client/license_timer.html index 22bee57..ce1d756 100644 --- a/src/web/client/license_timer.html +++ b/src/web/client/license_timer.html @@ -31,6 +31,7 @@ +