Merge branch 'develop' into new_custom_woka_scene
This commit is contained in:
@@ -9,6 +9,7 @@ import { EnableCameraSceneName } from "../Login/EnableCameraScene";
|
||||
import { LoginSceneName } from "../Login/LoginScene";
|
||||
import { SelectCharacterSceneName } from "../Login/SelectCharacterScene";
|
||||
import { GameScene } from "./GameScene";
|
||||
import { EmptySceneName } from "../Login/EmptyScene";
|
||||
|
||||
/**
|
||||
* This class should be responsible for any scene starting/stopping
|
||||
@@ -32,7 +33,14 @@ export class GameManager {
|
||||
|
||||
public async init(scenePlugin: Phaser.Scenes.ScenePlugin): Promise<string> {
|
||||
this.scenePlugin = scenePlugin;
|
||||
this.startRoom = await connectionManager.initGameConnexion();
|
||||
const result = await connectionManager.initGameConnexion();
|
||||
if (result instanceof URL) {
|
||||
window.location.assign(result.toString());
|
||||
// window.location.assign is not immediate and Javascript keeps running after.
|
||||
// so we need to redirect to an empty Phaser scene, waiting for the redirection to take place
|
||||
return EmptySceneName;
|
||||
}
|
||||
this.startRoom = result;
|
||||
this.loadMap(this.startRoom);
|
||||
|
||||
//If player name was not set show login scene with player name
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Scene } from "phaser";
|
||||
|
||||
export const EmptySceneName = "EmptyScene";
|
||||
|
||||
export class EmptyScene extends Scene {
|
||||
constructor() {
|
||||
super({
|
||||
key: EmptySceneName,
|
||||
});
|
||||
}
|
||||
|
||||
preload() {}
|
||||
|
||||
create() {}
|
||||
|
||||
update(time: number, delta: number): void {}
|
||||
}
|
||||
@@ -28,7 +28,10 @@ export class LoginScene extends ResizableScene {
|
||||
gameManager.currentStartedRoom &&
|
||||
gameManager.currentStartedRoom.authenticationMandatory
|
||||
) {
|
||||
connectionManager.loadOpenIDScreen();
|
||||
const redirect = connectionManager.loadOpenIDScreen();
|
||||
if (redirect !== null) {
|
||||
window.location.assign(redirect.toString());
|
||||
}
|
||||
loginSceneVisibleIframeStore.set(true);
|
||||
}
|
||||
loginSceneVisibleStore.set(true);
|
||||
|
||||
Reference in New Issue
Block a user