终于找到这个问题的原因了。
proto自己会调用原生http下载,所以如果是远程的,要加上域名。
Laya.Browser.window.protobuf.load(Laya.URL.basePath+url)
proto会把https://变成https:/,微信下载就报错了。
在protobuf.js的function fetch_xhr方法最后把fileName改成//就可以load成功,
var names=filename.split('/');
if(names[0]=="http:"||names[0]=="https:"){
filename=names[0]+"/";
for(var i=1;i<names.length;i++){
filename+=('/'+names[i]);
}
}
xhr.open("GET", filename);
xhr.send();我是这么改的,可以成功把消息发出去了,但是解析又出了问题
gameThirdScriptError
Cannot read property 'apply' of undefined;at api request success callback function
TypeError: Cannot read property 'apply' of undefined
at Function.eof (http://127.0.0.1:34822/game/code.js:52215:69)
at Class (http://127.0.0.1:34822/game/code.js:52729:37)
at Type.get (http://127.0.0.1:34822/game/code.js:57693:48)
at Type.create (http://127.0.0.1:34822/game/code.js:57856:20)
at Proto.EncodeMessage (http://127.0.0.1:34822/game/code.js:63461:31)
at NetManager.HttpPostProto (http://127.0.0.1:34822/game/code.js:63513:33)
at NetController.login (http://127.0.0.1:34822/game/code.js:63611:25)
at NetController.loginCommon (http://127.0.0.1:34822/game/code.js:63597:18)
at NetController.Login (http://127.0.0.1:34822/game/code.js:63582:22)
at Main.login ([url]http://127.0.0.1:34822/game/code.js:63904:22)[/url]