高级黑科技来了:
// 解压获得文件内容
let zipData = {"res/aaa.scene":{scene:"xxxx"}, "res/bbb.json":{test:[1,2,3,4,5]}};
// 构造数据
let data = {json:{}, text:{}}; // 默认只支持json和text。其他要另外处理。
data.json["res/aaa.scene"] = zipData["res/aaa.scene"];
data.json["res/bbb.json"] = zipData["res/bbb.json"];
// 设置数据
let func = Laya.Loader.prototype["parsePLFData"];
func.call(Laya.Loader, data);
// 要先加载一遍,才能使用。基本底层都是调用的loader,那就不用处理了。
Laya.loader.load("res/aaa.scene", Laya.Handler.create(null, (content)=>{console.log(content)}));
Laya.loader.load("res/bbb.json", Laya.Handler.create(null, (content)=>{console.log(content)}));