mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-25 00:23:25 +08:00
资源压缩
This commit is contained in:
parent
7a196b5922
commit
7cc7fe375b
@ -221,7 +221,7 @@ function main() {
|
|||||||
|
|
||||||
// 远程资源地址,在线游戏中,塔本体不包含任何资源,只包含源码,从而可以降低游戏本体的体积并平均分担资源包体积
|
// 远程资源地址,在线游戏中,塔本体不包含任何资源,只包含源码,从而可以降低游戏本体的体积并平均分担资源包体积
|
||||||
// 从而可以优化加载并避免网站发布的大小限制
|
// 从而可以优化加载并避免网站发布的大小限制
|
||||||
this.USE_RESORCE = false;
|
this.USE_RESOURCE = false;
|
||||||
this.RESOURCE_URL = '';
|
this.RESOURCE_URL = '';
|
||||||
this.RESOURCE_SYMBOL = '';
|
this.RESOURCE_SYMBOL = '';
|
||||||
this.RESOURCE_INDEX = {};
|
this.RESOURCE_INDEX = {};
|
||||||
|
@ -178,9 +178,20 @@ const compress = !!Number(process.argv[4]);
|
|||||||
await splitResorce(compress);
|
await splitResorce(compress);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7. 压缩本体
|
// 7. 压缩
|
||||||
if (compress) {
|
if (compress) {
|
||||||
await fs.ensureDir('./out');
|
await fs.ensureDir('./out');
|
||||||
await compressing.zip.compressDir('./dist', './out/dist.zip');
|
await compressing.zip.compressDir('./dist', './out/dist.zip');
|
||||||
|
|
||||||
|
// 压缩资源
|
||||||
|
if (resorce) {
|
||||||
|
const resources = await fs.readdir('./dist-resource');
|
||||||
|
for await (const index of resources) {
|
||||||
|
await compressing.zip.compressDir(
|
||||||
|
`./dist-resource/${index}`,
|
||||||
|
`./out/${index}.zip`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user