From 86d6a314f72e8763ff565394c635cd8a4a5ca593 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Wed, 10 Mar 2021 15:41:21 -0500 Subject: [PATCH] Longer usernames --- front/src/Phaser/Components/TextInput.ts | 5 +---- front/src/Phaser/Login/LoginScene.ts | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/front/src/Phaser/Components/TextInput.ts b/front/src/Phaser/Components/TextInput.ts index 92ddcb5..942dae7 100644 --- a/front/src/Phaser/Components/TextInput.ts +++ b/front/src/Phaser/Components/TextInput.ts @@ -7,7 +7,7 @@ export class TextInput extends Phaser.GameObjects.BitmapText { super(scene, x, y, 'main_font', text, 32); this.scene.add.existing(this); - this.underLine = this.scene.add.text(x, y+1, '_______', { fontFamily: 'Arial', fontSize: "32px", color: '#ffffff'}) + this.underLine = this.scene.add.text(x, y+1, '______________', { fontFamily: 'Arial', fontSize: "32px", color: '#ffffff'}) let keySpace = this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); @@ -24,9 +24,6 @@ export class TextInput extends Phaser.GameObjects.BitmapText { private deleteLetter() { this.text = this.text.substr(0, this.text.length - 1); - if (this.underLine.text.length > this.underLineLength) { - this.underLine.text = this.underLine.text.substr(0, this.underLine.text.length - 1); - } } diff --git a/front/src/Phaser/Login/LoginScene.ts b/front/src/Phaser/Login/LoginScene.ts index 6592bed..2b834d3 100644 --- a/front/src/Phaser/Login/LoginScene.ts +++ b/front/src/Phaser/Login/LoginScene.ts @@ -54,7 +54,8 @@ export class LoginScene extends Phaser.Scene { this.textField = new TextField(this, this.game.renderer.width / 2, 50, 'Enter your name:'); this.textField.setOrigin(0.5).setCenterAlign() - this.nameInput = new TextInput(this, this.game.renderer.width / 2 - 64, 70, 4, this.name,(text: string) => { + this.nameInput = new TextInput(this, this.game.renderer.width / 2 - 128, 70, 8, this.name,(text: string) => { + this.name = text; if (window.localStorage) { window.localStorage.setItem('playerName', text); -- 2.25.1