[]微信小游戏加载 BitmapFont 问题
IDE 版本:1.7.19.1beta
LayaAir 版本:1.7.19.1beta
------------------------
发布成微信小游戏之后,解析 BitmapFont 出错
------------------------
game.js 里面有添加这些
图片里的 type="font",最终执行的 tempData=data.data; tempData 直接就是button_font.fnt里面内容的字符串类型
-----------------------
这里是否需要添加这个判断?类型是 "font" 的时候也按 "xml" 类型解析?
-----------------------
上传的 demo 里面只加载里 button_font.fnt
LayaAir 版本:1.7.19.1beta
------------------------
发布成微信小游戏之后,解析 BitmapFont 出错
------------------------
game.js 里面有添加这些
require("weapp-adapter.js");在加载这个文件的时候
window.Parser = require("./js/dom_parser");
require("code.js");
Laya.loader.load([{ url: "button_font.fnt" }], Handler.create(null, onLoaded));
图片里的 type="font",最终执行的 tempData=data.data; tempData 直接就是button_font.fnt里面内容的字符串类型
MiniLoader.onReadNativeCallBack=function(encoding,url,type,cache,group,ignoreCache,thisLoader,errorCode,data){最终导致下图这个错误
(cache===void 0)&& (cache=true);
(ignoreCache===void 0)&& (ignoreCache=false);
(errorCode===void 0)&& (errorCode=0);
if (!errorCode){
var tempData;
if (type==/*laya.net.Loader.JSON*/"json" || type==/*laya.net.Loader.ATLAS*/"atlas"){
tempData=MiniAdpter.getJson(data.data);
}else if (type==/*laya.net.Loader.XML*/"xml"){
tempData=Utils.parseXMLFromString(data.data);
}
// else if (type==/*laya.net.Loader.XML*/"font"){
// tempData=Utils.parseXMLFromString(data.data);
// }
else {
tempData=data.data;
}
if(!MiniAdpter.isZiYu &&MiniAdpter.isPosMsgYu && type !=/*laya.net.Loader.BUFFER*/"arraybuffer"){
/*__JS__ */wx.postMessage({url:url,data:tempData,isLoad:"filedata"});
}
thisLoader.onLoaded(tempData);
}else if (errorCode==1){
MiniAdpter.EnvConfig.load.call(thisLoader,url,type,cache,group,ignoreCache);
}
}
-----------------------
这里是否需要添加这个判断?类型是 "font" 的时候也按 "xml" 类型解析?
-----------------------
上传的 demo 里面只加载里 button_font.fnt
没有找到相关结果
已邀请:
要回复问题请先登录
3 个回复
Aar0n
赞同来自:
JasonLu
赞同来自:
是有这个问题,我就是这么改的
David Chen
赞同来自: