pause loading tileset on fly
This commit is contained in:
parent
36f0cd1a23
commit
d4bc999c54
@ -43,7 +43,7 @@ export type IframeEventMap = {
|
|||||||
setProperty: SetPropertyEvent
|
setProperty: SetPropertyEvent
|
||||||
getDataLayer: undefined
|
getDataLayer: undefined
|
||||||
getTag: undefined
|
getTag: undefined
|
||||||
tilsetEvent: TilesetEvent
|
//tilsetEvent: TilesetEvent
|
||||||
}
|
}
|
||||||
export interface IframeEvent<T extends keyof IframeEventMap> {
|
export interface IframeEvent<T extends keyof IframeEventMap> {
|
||||||
type: T;
|
type: T;
|
||||||
|
@ -20,7 +20,7 @@ import type { DataLayerEvent } from "./Events/DataLayerEvent";
|
|||||||
import { isMenuItemRegisterEvent } from './Events/MenuItemRegisterEvent';
|
import { isMenuItemRegisterEvent } from './Events/MenuItemRegisterEvent';
|
||||||
import type { MenuItemClickedEvent } from './Events/MenuItemClickedEvent';
|
import type { MenuItemClickedEvent } from './Events/MenuItemClickedEvent';
|
||||||
import type { TagEvent } from "./Events/TagEvent";
|
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();
|
private readonly _tagListStream: Subject<void> = new Subject();
|
||||||
public readonly tagListStream = this._tagListStream.asObservable();
|
public readonly tagListStream = this._tagListStream.asObservable();
|
||||||
|
|
||||||
private readonly _tilesetLoaderStream: Subject<TilesetEvent> = new Subject();
|
/* private readonly _tilesetLoaderStream: Subject<TilesetEvent> = new Subject();
|
||||||
public readonly tilesetLoaderStream = this._tilesetLoaderStream.asObservable();
|
public readonly tilesetLoaderStream = this._tilesetLoaderStream.asObservable();*/
|
||||||
|
|
||||||
private readonly iframes = new Set<HTMLIFrameElement>();
|
private readonly iframes = new Set<HTMLIFrameElement>();
|
||||||
private readonly scripts = new Map<string, HTMLIFrameElement>();
|
private readonly scripts = new Map<string, HTMLIFrameElement>();
|
||||||
@ -156,8 +156,8 @@ class IframeListener {
|
|||||||
this._registerMenuCommandStream.next(payload.data.menutItem)
|
this._registerMenuCommandStream.next(payload.data.menutItem)
|
||||||
} else if (payload.type == "getTag") {
|
} else if (payload.type == "getTag") {
|
||||||
this._tagListStream.next();
|
this._tagListStream.next();
|
||||||
} else if (payload.type == "tilsetEvent" && isTilesetEvent(payload.data)) {
|
/* } else if (payload.type == "tilsetEvent" && isTilesetEvent(payload.data)) {
|
||||||
this._tilesetLoaderStream.next(payload.data);
|
this._tilesetLoaderStream.next(payload.data);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
@ -910,12 +910,12 @@ ${escapedMessage}
|
|||||||
iframeListener.sendUserTagList({list: this.connection.getAllTag()});
|
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.tilemapTiledJSON('logo', tileset.imgUrl);
|
||||||
this.load.image('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.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]);
|
this.gameMap.addTerrain(this.Terrains[this.Terrains.length - 1]);
|
||||||
}))
|
}))*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ interface WorkAdventureApi {
|
|||||||
getNickName(): Promise<string | null>;
|
getNickName(): Promise<string | null>;
|
||||||
getTagUser(): Promise<string[]>;
|
getTagUser(): Promise<string[]>;
|
||||||
getMap(): Promise<ITiledMap>
|
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
|
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({
|
postToParent({
|
||||||
type: "tilsetEvent",
|
type: "tilsetEvent",
|
||||||
data: {
|
data: {
|
||||||
@ -177,7 +177,7 @@ window.WA = {
|
|||||||
spacing: spacing
|
spacing: spacing
|
||||||
} as TilesetEvent
|
} as TilesetEvent
|
||||||
})
|
})
|
||||||
},
|
},*/
|
||||||
|
|
||||||
getTagUser(): Promise<string[]> {
|
getTagUser(): Promise<string[]> {
|
||||||
return getTag().then((res) => {
|
return getTag().then((res) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user