diff --git a/packages-user/client-base/src/material/manager.ts b/packages-user/client-base/src/material/manager.ts index b2b97c6..6648d09 100644 --- a/packages-user/client-base/src/material/manager.ts +++ b/packages-user/client-base/src/material/manager.ts @@ -57,6 +57,8 @@ export class MaterialManager implements IMaterialManager { private nowTilesetIndex: number = -1; /** 当前 tileset 偏移 */ private nowTilesetOffset: number = 0; + /** 是否已经构建过素材 */ + private built: boolean = false; constructor() { this.assetBuilder.pipe(this.assetStore); @@ -303,7 +305,11 @@ export class MaterialManager implements IMaterialManager { } buildAssets(): Iterable { - this.assetBuilder.pipe(this.assetStore); + if (this.built) { + logger.warn(79); + return []; + } + this.built = true; const data = this.assetBuilder.addTextureList(this.tileStore.values()); const arr = [...data]; const res: IMaterialAssetData[] = []; diff --git a/packages/common/src/logger.json b/packages/common/src/logger.json index b3f6ea2..4a37224 100644 --- a/packages/common/src/logger.json +++ b/packages/common/src/logger.json @@ -107,9 +107,10 @@ "73": "Consistent size is needed when using WebGL2 composer.", "74": "Frame size not match texture's size, incomplete data will be skipped.", "75": "Material count splitted by grid does not match alias count, some material may have no alias or some alias may not map to a texture. Splitted: $1, alias: $2.", - "76": "Cannot pipe texture store when asset builder is started.", + "76": "Cannot pipe texture store when asset builder has been started.", "77": "Texture is clipped to an area of 0. Ensure that the texture contains your clip rect and clip rect's area is not zero.", "78": "Adding tileset source must follow index order.", + "79": "Assets can only be built once.", "1001": "Item-detail extension needs 'floor-binder' and 'floor-damage' extension as dependency.", "1101": "Cannot add new effect to point effect instance, for there's no more reserve space for it. Please increase the max count of the instance." }