chore: buildAssets 只能调用一次

This commit is contained in:
unanmed 2025-10-27 10:36:21 +08:00
parent b3ed39f800
commit 21a1842352
2 changed files with 9 additions and 2 deletions

View File

@ -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<IMaterialAssetData> {
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[] = [];

View File

@ -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."
}