assetManager.assets.forEach((value: Asset, key: string) => {
if (typeString === “ImageAsset” && value instanceof ImageAsset) {
console.log(assetManager.assets.get(key));
count++;
} else if (typeString === “Texture2D” && value instanceof Texture2D) {
console.log(assetManager.assets.get(key));
count++;
} else if (typeString === “SpriteFrame” && value instanceof SpriteFrame) {
console.log(assetManager.assets.get(key));
count++;
}
})
console.log(类型:${typeString},当前资源总数:${count});
}
感觉自己TS水平太菜了,写得不优雅,请问有更优雅的写法吗?
