From faa37ebacb5c94a624d24300ed7e33651d6b20ed Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 15 Mar 2022 04:47:43 -0400 Subject: [PATCH] Updates --- .../communication/messages/MessageClassManager.ts | 8 -------- .../visualization/utils/GraphicAssetCollection.ts | 14 +++++++++++++- .../visualization/utils/IGraphicAssetCollection.ts | 4 +++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/core/communication/messages/MessageClassManager.ts b/src/core/communication/messages/MessageClassManager.ts index 838dc187..839f9b66 100644 --- a/src/core/communication/messages/MessageClassManager.ts +++ b/src/core/communication/messages/MessageClassManager.ts @@ -34,10 +34,6 @@ export class MessageClassManager { if(!header || !handler) return; - const existing = this._messageIdByEvent.get(handler); - - if(existing) return; - this._messageIdByEvent.set(handler, header); } @@ -45,10 +41,6 @@ export class MessageClassManager { if(!header || !handler) return; - const existing = this._messageIdByComposer.get(handler); - - if(existing) return; - this._messageIdByComposer.set(handler, header); } diff --git a/src/room/object/visualization/utils/GraphicAssetCollection.ts b/src/room/object/visualization/utils/GraphicAssetCollection.ts index 00a78930..bdea02f0 100644 --- a/src/room/object/visualization/utils/GraphicAssetCollection.ts +++ b/src/room/object/visualization/utils/GraphicAssetCollection.ts @@ -1,4 +1,4 @@ -import { Resource, Texture } from '@pixi/core'; +import { BaseTexture, Resource, Texture } from '@pixi/core'; import { Spritesheet } from '@pixi/spritesheet'; import { Dict } from '@pixi/utils'; import { AssetManager } from '../../../../core/asset/AssetManager'; @@ -17,6 +17,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection private _referenceTimestamp: number; private _name: string; + private _baseTexture: BaseTexture; private _data: IAssetData; private _textures: Map>; private _assets: Map; @@ -28,6 +29,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection if(!data) throw new Error('invalid_collection'); this._name = data.name; + this._baseTexture = ((spritesheet && spritesheet.baseTexture) || null); this._data = data; this._textures = new Map(); this._assets = new Map(); @@ -230,6 +232,11 @@ export class GraphicAssetCollection implements IGraphicAssetCollection return asset; } + public getTexture(name: string): Texture + { + return this._textures.get(name); + } + public getPaletteNames(): string[] { return Array.from(this._palettes.keys()); @@ -357,6 +364,11 @@ export class GraphicAssetCollection implements IGraphicAssetCollection return this._name; } + public get baseTexture(): BaseTexture + { + return this._baseTexture; + } + public get data(): IAssetData { return this._data; diff --git a/src/room/object/visualization/utils/IGraphicAssetCollection.ts b/src/room/object/visualization/utils/IGraphicAssetCollection.ts index 853befe1..5e6a5603 100644 --- a/src/room/object/visualization/utils/IGraphicAssetCollection.ts +++ b/src/room/object/visualization/utils/IGraphicAssetCollection.ts @@ -1,4 +1,4 @@ -import { Resource, Texture } from '@pixi/core'; +import { BaseTexture, Resource, Texture } from '@pixi/core'; import { IAssetData } from '../../../../core/asset/interfaces'; import { GraphicAssetPalette } from './GraphicAssetPalette'; import { IGraphicAsset } from './IGraphicAsset'; @@ -11,6 +11,7 @@ export interface IGraphicAssetCollection define(data: IAssetData): void; getAsset(name: string): IGraphicAsset; getAssetWithPalette(name: string, paletteName: string): IGraphicAsset; + getTexture(name: string): Texture; getPaletteNames(): string[]; getPaletteColors(paletteName: string): number[]; getPalette(name: string): GraphicAssetPalette; @@ -19,5 +20,6 @@ export interface IGraphicAssetCollection referenceCount: number; referenceTimestamp: number; name: string; + baseTexture: BaseTexture; data: IAssetData; }