[LayaNative 2.0]Laya2.6.0 升级至Laya2.8.0 Native环境 加载ttf 字体不生效
Laya2.6.0 升级至Laya2.8.0 Native环境 加载ttf 字体不生效
之前 2.6.0 好好的 2.8.0 一样的代码 就不生效了。。。。。。
代码如下:
let font1Req = new Promise((resolve => {
Laya.loader.load("res/fonts/OPPOSANS-R.TTF", Laya.Handler.create(this, (success: boolean) => {
if (!success) {
console.error("OPPOSANS-R ttf 字体加载失败");
} else {
console.log("OPPOSANS-R ttf 字体加载成功");
}
return resolve(success);
}), Laya.Handler.create(this, (pro) => {
console.log("lobby ttf 字体加载进度:" + pro);
}, null, false), Laya.Loader.TTF)
}));
let font2Req = new Promise((resolve => {
Laya.loader.load("res/fonts/OPPOSANS-H.TTF", Laya.Handler.create(this, (success: boolean) => {
if (!success) {
console.error("OPPOSANS-H.ttf ttf 字体加载失败");
} else {
console.log("OPPOSANS-H.ttf ttf 字体加载成功");
}
return resolve(success);
}), Laya.Handler.create(this, (pro) => {
console.log("lobby ttf 字体加载进度:" + pro);
}, null, false), Laya.Loader.TTF)
}));
之前 2.6.0 好好的 2.8.0 一样的代码 就不生效了。。。。。。
代码如下:
let font1Req = new Promise((resolve => {
Laya.loader.load("res/fonts/OPPOSANS-R.TTF", Laya.Handler.create(this, (success: boolean) => {
if (!success) {
console.error("OPPOSANS-R ttf 字体加载失败");
} else {
console.log("OPPOSANS-R ttf 字体加载成功");
}
return resolve(success);
}), Laya.Handler.create(this, (pro) => {
console.log("lobby ttf 字体加载进度:" + pro);
}, null, false), Laya.Loader.TTF)
}));
let font2Req = new Promise((resolve => {
Laya.loader.load("res/fonts/OPPOSANS-H.TTF", Laya.Handler.create(this, (success: boolean) => {
if (!success) {
console.error("OPPOSANS-H.ttf ttf 字体加载失败");
} else {
console.log("OPPOSANS-H.ttf ttf 字体加载成功");
}
return resolve(success);
}), Laya.Handler.create(this, (pro) => {
console.log("lobby ttf 字体加载进度:" + pro);
}, null, false), Laya.Loader.TTF)
}));
没有找到相关结果
已邀请:
要回复问题请先登录
4 个回复
lv
赞同来自:
AILHC
赞同来自:
AILHC
赞同来自:
IXgSoul
赞同来自: