merge latest dev

This commit is contained in:
_Bastler
2021-05-18 15:04:35 +02:00
35 changed files with 641 additions and 200 deletions
+15 -8
View File
@@ -189,6 +189,7 @@ export class GameScene extends DirtyScene implements CenterListener {
private popUpElements : Map<number, DOMElement> = new Map<number, Phaser.GameObjects.DOMElement>();
private originalMapUrl: string|undefined;
private pinchManager: PinchManager|undefined;
private physicsEnabled: boolean = true;
private mapTransitioning: boolean = false; //used to prevent transitions happenning at the same time.
private onVisibilityChangeCallback: () => void;
@@ -810,7 +811,7 @@ export class GameScene extends DirtyScene implements CenterListener {
let html = `<div id="container" hidden><div class="nes-container with-title is-centered">`;
html += escapedMessage;
if (openPopupEvent.input) {
html += `<input id="popupinput-${openPopupEvent.popupId}" class="nes-input" \>`
html += `<input id="popupinput-${openPopupEvent.popupId}" class="nes-input" />`
}
html += `</div> `;
const buttonContainer = `<div class="buttonContainer"</div>`;
@@ -913,11 +914,13 @@ export class GameScene extends DirtyScene implements CenterListener {
}));
this.iframeSubscriptionList.push(iframeListener.exitUrlStream.subscribe((url:string)=>{
this.loadNextGame(url).then(()=>{
const {roomId, hash} = Room.getIdFromIdentifier(url, this.MapUrlFile, this.instance);
const room = new Room(roomId);
gameManager.loadMap(room, this.scene).then(()=>{
this.events.once(EVENT_TYPE.POST_UPDATE,()=>{
this.onMapExit(url);
})
})
}).catch(() => {});
}));
}
@@ -1080,10 +1083,10 @@ export class GameScene extends DirtyScene implements CenterListener {
}
//todo: push that into the gameManager
private async loadNextGame(exitSceneIdentifier: string){
private loadNextGame(exitSceneIdentifier: string): void {
const {roomId, hash} = Room.getIdFromIdentifier(exitSceneIdentifier, this.MapUrlFile, this.instance);
const room = new Room(roomId);
await gameManager.loadMap(room, this.scene);
gameManager.loadMap(room, this.scene).catch(() => {});
}
private startUser(layer: ITiledMapTileLayer): PositionInterface {
@@ -1126,6 +1129,7 @@ export class GameScene extends DirtyScene implements CenterListener {
createCollisionWithPlayer() {
this.physics.disableUpdate();
this.physicsEnabled = false;
//add collision layer
this.Layers.forEach((Layer: Phaser.Tilemaps.TilemapLayer) => {
this.physics.add.collider(this.CurrentPlayer, Layer, (object1: GameObject, object2: GameObject) => {
@@ -1265,12 +1269,15 @@ export class GameScene extends DirtyScene implements CenterListener {
this.CurrentPlayer.moveUser(delta);
if (this.CurrentPlayer.isMoving()) {
this.dirty = true;
this.physics.enableUpdate();
} else {
if (!this.physicsEnabled) {
this.physics.enableUpdate();
this.physicsEnabled = true;
}
} else if (this.physicsEnabled) {
this.physics.disableUpdate();
this.physicsEnabled = false;
}
// Let's handle all events
while (this.pendingEvents.length !== 0) {
this.dirty = true;
+2
View File
@@ -9,6 +9,7 @@ import {connectionManager} from "../../Connexion/ConnectionManager";
import {GameConnexionTypes} from "../../Url/UrlManager";
import {WarningContainer, warningContainerHtml, warningContainerKey} from "../Components/WarningContainer";
import {worldFullWarningStream} from "../../Connexion/WorldFullWarningStream";
import {menuIconVisible} from "../../Stores/MenuStore";
export const MenuSceneName = 'MenuScene';
const gameMenuKey = 'gameMenu';
@@ -53,6 +54,7 @@ export class MenuScene extends Phaser.Scene {
}
create() {
menuIconVisible.set(true);
this.menuElement = this.add.dom(closedSideMenuX, 30).createFromCache(gameMenuKey);
this.menuElement.setOrigin(0);
MenuScene.revealMenusAfterInit(this.menuElement, 'gameMenu');