cc.find("dailyNode/upper/icon1", this._nodeRoot).active = false;
cc.find("dailyNode/upper/infor", this._nodeRoot).active = false;
let n = cc.find("dailyNode/upper", this._nodeRoot);
gg.creator.loadSpriteFrame(gg.caseTexture + "mark_pztj", function (spriteFrame, fullPath) {
let richText = n.addComponent(cc.RichText);
let atlas = new cc.SpriteAtlas();
atlas["_spriteFrames"]["cocosSrc"] = spriteFrame;
richText.imageAtlas = atlas;
richText.string = "<img src='cocosSrc' height=50/> " + "<color=#4A5C6F>" + str + "</color>";
richText.maxWidth = 1196;
richText.lineHeight=50
});
//-- 加载纹理精灵
CreatorHelper.loadSpriteFrame = function (fullPath, cb) {
this.loadRes(fullPath, cc.SpriteFrame, function (err, spriteFrame) {
if (err) {
// cc.log("加载文件失败path = ", fullPath);
cb();
return;
}
cb(spriteFrame, fullPath);
});
}
RichText 换行,使用单个img图片进行图文混编
最新推荐文章于 2023-06-03 12:31:31 发布