This commit is contained in:
Bill 2022-03-15 04:47:43 -04:00
parent 0d805b3b36
commit faa37ebacb
3 changed files with 16 additions and 10 deletions

View File

@ -34,10 +34,6 @@ export class MessageClassManager
{ {
if(!header || !handler) return; if(!header || !handler) return;
const existing = this._messageIdByEvent.get(handler);
if(existing) return;
this._messageIdByEvent.set(handler, header); this._messageIdByEvent.set(handler, header);
} }
@ -45,10 +41,6 @@ export class MessageClassManager
{ {
if(!header || !handler) return; if(!header || !handler) return;
const existing = this._messageIdByComposer.get(handler);
if(existing) return;
this._messageIdByComposer.set(handler, header); this._messageIdByComposer.set(handler, header);
} }

View File

@ -1,4 +1,4 @@
import { Resource, Texture } from '@pixi/core'; import { BaseTexture, Resource, Texture } from '@pixi/core';
import { Spritesheet } from '@pixi/spritesheet'; import { Spritesheet } from '@pixi/spritesheet';
import { Dict } from '@pixi/utils'; import { Dict } from '@pixi/utils';
import { AssetManager } from '../../../../core/asset/AssetManager'; import { AssetManager } from '../../../../core/asset/AssetManager';
@ -17,6 +17,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
private _referenceTimestamp: number; private _referenceTimestamp: number;
private _name: string; private _name: string;
private _baseTexture: BaseTexture;
private _data: IAssetData; private _data: IAssetData;
private _textures: Map<string, Texture<Resource>>; private _textures: Map<string, Texture<Resource>>;
private _assets: Map<string, GraphicAsset>; private _assets: Map<string, GraphicAsset>;
@ -28,6 +29,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
if(!data) throw new Error('invalid_collection'); if(!data) throw new Error('invalid_collection');
this._name = data.name; this._name = data.name;
this._baseTexture = ((spritesheet && spritesheet.baseTexture) || null);
this._data = data; this._data = data;
this._textures = new Map(); this._textures = new Map();
this._assets = new Map(); this._assets = new Map();
@ -230,6 +232,11 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
return asset; return asset;
} }
public getTexture(name: string): Texture<Resource>
{
return this._textures.get(name);
}
public getPaletteNames(): string[] public getPaletteNames(): string[]
{ {
return Array.from(this._palettes.keys()); return Array.from(this._palettes.keys());
@ -357,6 +364,11 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
return this._name; return this._name;
} }
public get baseTexture(): BaseTexture
{
return this._baseTexture;
}
public get data(): IAssetData public get data(): IAssetData
{ {
return this._data; return this._data;

View File

@ -1,4 +1,4 @@
import { Resource, Texture } from '@pixi/core'; import { BaseTexture, Resource, Texture } from '@pixi/core';
import { IAssetData } from '../../../../core/asset/interfaces'; import { IAssetData } from '../../../../core/asset/interfaces';
import { GraphicAssetPalette } from './GraphicAssetPalette'; import { GraphicAssetPalette } from './GraphicAssetPalette';
import { IGraphicAsset } from './IGraphicAsset'; import { IGraphicAsset } from './IGraphicAsset';
@ -11,6 +11,7 @@ export interface IGraphicAssetCollection
define(data: IAssetData): void; define(data: IAssetData): void;
getAsset(name: string): IGraphicAsset; getAsset(name: string): IGraphicAsset;
getAssetWithPalette(name: string, paletteName: string): IGraphicAsset; getAssetWithPalette(name: string, paletteName: string): IGraphicAsset;
getTexture(name: string): Texture<Resource>;
getPaletteNames(): string[]; getPaletteNames(): string[];
getPaletteColors(paletteName: string): number[]; getPaletteColors(paletteName: string): number[];
getPalette(name: string): GraphicAssetPalette; getPalette(name: string): GraphicAssetPalette;
@ -19,5 +20,6 @@ export interface IGraphicAssetCollection
referenceCount: number; referenceCount: number;
referenceTimestamp: number; referenceTimestamp: number;
name: string; name: string;
baseTexture: BaseTexture;
data: IAssetData; data: IAssetData;
} }