Add: sample PhaserInput

This commit is contained in:
2018-12-08 18:26:26 +09:00
parent 7cce32996a
commit 37fa857983
2 changed files with 44 additions and 2 deletions
+43 -2
View File
@@ -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';