pause loading tileset on fly

This commit is contained in:
GRL 2021-05-25 10:15:56 +02:00
parent 36f0cd1a23
commit d4bc999c54
4 changed files with 11 additions and 11 deletions

View File

@ -43,7 +43,7 @@ export type IframeEventMap = {
setProperty: SetPropertyEvent
getDataLayer: undefined
getTag: undefined
tilsetEvent: TilesetEvent
//tilsetEvent: TilesetEvent
}
export interface IframeEvent<T extends keyof IframeEventMap> {
type: T;

View File

@ -20,7 +20,7 @@ import type { DataLayerEvent } from "./Events/DataLayerEvent";
import { isMenuItemRegisterEvent } from './Events/MenuItemRegisterEvent';
import type { MenuItemClickedEvent } from './Events/MenuItemClickedEvent';
import type { TagEvent } from "./Events/TagEvent";
import { isTilesetEvent, TilesetEvent } from "./Events/TilesetEvent";
//import { isTilesetEvent, TilesetEvent } from "./Events/TilesetEvent";
/**
@ -83,8 +83,8 @@ class IframeListener {
private readonly _tagListStream: Subject<void> = new Subject();
public readonly tagListStream = this._tagListStream.asObservable();
private readonly _tilesetLoaderStream: Subject<TilesetEvent> = new Subject();
public readonly tilesetLoaderStream = this._tilesetLoaderStream.asObservable();
/* private readonly _tilesetLoaderStream: Subject<TilesetEvent> = new Subject();
public readonly tilesetLoaderStream = this._tilesetLoaderStream.asObservable();*/
private readonly iframes = new Set<HTMLIFrameElement>();
private readonly scripts = new Map<string, HTMLIFrameElement>();
@ -156,8 +156,8 @@ class IframeListener {
this._registerMenuCommandStream.next(payload.data.menutItem)
} else if (payload.type == "getTag") {
this._tagListStream.next();
} else if (payload.type == "tilsetEvent" && isTilesetEvent(payload.data)) {
this._tilesetLoaderStream.next(payload.data);
/* } else if (payload.type == "tilsetEvent" && isTilesetEvent(payload.data)) {
this._tilesetLoaderStream.next(payload.data);*/
}
}
}, false);

View File

@ -910,12 +910,12 @@ ${escapedMessage}
iframeListener.sendUserTagList({list: this.connection.getAllTag()});
}))
this.iframeSubscriptionList.push(iframeListener.tilesetLoaderStream.subscribe((tileset) => {
/* this.iframeSubscriptionList.push(iframeListener.tilesetLoaderStream.subscribe((tileset) => {
//this.load.tilemapTiledJSON('logo', tileset.imgUrl);
this.load.image('logo', tileset.imgUrl);
this.Terrains.push(this.Map.addTilesetImage(tileset.name, tileset.imgUrl, tileset.tilewidth, tileset.tileheight, tileset.margin, tileset.spacing));
this.gameMap.addTerrain(this.Terrains[this.Terrains.length - 1]);
}))
}))*/
}

View File

@ -49,7 +49,7 @@ interface WorkAdventureApi {
getNickName(): Promise<string | null>;
getTagUser(): Promise<string[]>;
getMap(): Promise<ITiledMap>
loadTileset(name: string, imgUrl : string, tilewidth : number, tileheight : number, margin : number, spacing : number): void;
//loadTileset(name: string, imgUrl : string, tilewidth : number, tileheight : number, margin : number, spacing : number): void;
onPlayerMove(callback: (playerMovedEvent: HasPlayerMovedEvent) => void): void
}
@ -165,7 +165,7 @@ window.WA = {
})
},
loadTileset(name: string, imgUrl : string, tilewidth : number, tileheight : number, margin : number, spacing : number): void {
/* loadTileset(name: string, imgUrl : string, tilewidth : number, tileheight : number, margin : number, spacing : number): void {
postToParent({
type: "tilsetEvent",
data: {
@ -177,7 +177,7 @@ window.WA = {
spacing: spacing
} as TilesetEvent
})
},
},*/
getTagUser(): Promise<string[]> {
return getTag().then((res) => {