Add: sample PhaserInput
This commit is contained in:
@@ -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';
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> -->
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script> -->
|
||||
<script src="../../../resources/js/phaser.min.js"></script>
|
||||
<script type="text/javascript" src="../../util/phaser-input-master/build/phaser-input.min.js"></script>
|
||||
|
||||
<!-- global source files -->
|
||||
<script src="../../game/lib/session_storage_manager.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user