Fix integration login scene in game manager
This commit is contained in:
parent
8c935e8b27
commit
4e556782af
3 changed files with 41 additions and 16 deletions
|
@ -1,9 +1,9 @@
|
|||
import KeyboardKeydownCallback = Phaser.Types.Input.Keyboard.KeyboardKeydownCallback;
|
||||
import {gameManager} from "../Game/GameManager";
|
||||
import {ROOM} from "../../Enum/EnvironmentVariable";
|
||||
import {TextField} from "../Components/TextField";
|
||||
import {TextInput} from "../Components/TextInput";
|
||||
import {ClickButton} from "../Components/ClickButton";
|
||||
import {GameSceneInterface} from "../Game/GameScene";
|
||||
import {MessageUserPositionInterface} from "../../Connexion";
|
||||
|
||||
//todo: put this constants in a dedicated file
|
||||
export const LoginSceneName = "LoginScene";
|
||||
|
@ -11,21 +11,22 @@ enum LoginTextures {
|
|||
playButton = "play_button",
|
||||
}
|
||||
|
||||
export class LogincScene extends Phaser.Scene {
|
||||
export class LogincScene extends Phaser.Scene implements GameSceneInterface {
|
||||
private emailInput: TextInput;
|
||||
private textField: TextField;
|
||||
private playButton: ClickButton;
|
||||
private infoTextField: TextField;
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
key: LoginSceneName
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
preload() {
|
||||
this.load.image(LoginTextures.playButton, "resources/objects/play_button.png");
|
||||
}
|
||||
|
||||
|
||||
create() {
|
||||
this.textField = new TextField(this, 10, 10, 'Enter your email:');
|
||||
this.emailInput = new TextInput(this, 10, 50);
|
||||
|
@ -37,15 +38,25 @@ export class LogincScene extends Phaser.Scene {
|
|||
let infoText = "Commandes de base: \n - Z,Q,S,D (ou les flèches de direction) pour bouger\n - SHIFT pour accélerer";
|
||||
this.infoTextField = new TextField(this, 10, 300, infoText);
|
||||
}
|
||||
|
||||
|
||||
update(time: number, delta: number): void {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
async login() {
|
||||
let email = this.emailInput.text;
|
||||
if (!email) return;
|
||||
await gameManager.connect(email);
|
||||
this.scene.start("GameScene");
|
||||
gameManager.connect(email).then(() => {
|
||||
this.scene.start("GameScene");
|
||||
});
|
||||
}
|
||||
|
||||
Map: Phaser.Tilemaps.Tilemap;
|
||||
RoomId: string;
|
||||
|
||||
createCurrentPlayer(UserId: string): void {
|
||||
}
|
||||
|
||||
shareUserPosition(UsersPosition: Array<MessageUserPositionInterface>): void {
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue