FEAT: prototype game menu using html elements, better icon for text chat

This commit is contained in:
kharhamel 2020-12-04 11:30:35 +01:00
parent 855b55903b
commit 069f2f1cec
23 changed files with 520 additions and 226 deletions

View file

@ -1,14 +1,11 @@
import {gameManager} from "../Game/GameManager";
import {TextField} from "../Components/TextField";
import {TextInput} from "../Components/TextInput";
import {ClickButton} from "../Components/ClickButton";
import Image = Phaser.GameObjects.Image;
import Rectangle = Phaser.GameObjects.Rectangle;
import {PLAYER_RESOURCES, PlayerResourceDescriptionInterface} from "../Entity/Character";
import {cypressAsserter} from "../../Cypress/CypressAsserter";
import {SelectCharacterSceneName} from "./SelectCharacterScene";
import {ResizableScene} from "./ResizableScene";
import {localUserStore} from "../../Connexion/LocalUserStore";
//todo: put this constants in a dedicated file
export const LoginSceneName = "LoginScene";
@ -29,7 +26,7 @@ export class LoginScene extends ResizableScene {
super({
key: LoginSceneName
});
this.name = localUserStore.getName();
this.name = gameManager.getPlayerName() || '';
}
preload() {
@ -55,7 +52,6 @@ export class LoginScene extends ResizableScene {
this.textField = new TextField(this, this.game.renderer.width / 2, 50, 'Enter your name:');
this.nameInput = new TextInput(this, this.game.renderer.width / 2, 70, 8, this.name,(text: string) => {
this.name = text;
localUserStore.setName(text);
});
this.pressReturnField = new TextField(this, this.game.renderer.width / 2, 130, 'Press enter to start');
@ -87,7 +83,8 @@ export class LoginScene extends ResizableScene {
private login(name: string): void {
gameManager.setPlayerName(name);
this.scene.start(SelectCharacterSceneName);
this.scene.sleep(LoginSceneName)
this.scene.run(SelectCharacterSceneName);
}
public onResize(ev: UIEvent): void {