fairygui / FairyGUI-cocoscreator

A flexible UI framework for Cocos Creator
MIT License
548 stars 193 forks source link

版本2.1.2。 多个不同的bmfont,会默认全部使用其中一个 #23

Closed shenxiyou closed 5 years ago

HuangYuGH commented 5 years ago

直接给到代码你: ` UIPackage.prototype.loadFont = function (item) { var font = new cc.LabelAtlas(); item.asset = font; font._fntConfig = { atlasName: item.name, //change by MixMarvel commonHeight: 0, fontSize: 0, kerningDict: {}, fontDefDictionary: {} };

`

parkycai commented 5 years ago

直接给到代码你: ` UIPackage.prototype.loadFont = function (item) { var font = new cc.LabelAtlas(); item.asset = font; font._fntConfig = { atlasName: item.name, //change by MixMarvel commonHeight: 0, fontSize: 0, kerningDict: {}, fontDefDictionary: {} };

`

这是加了一行 atlasName: item.name 吗? 似乎并没有用, 请教一下该怎么改?

HuangYuGH commented 5 years ago

对的,可以调试其源码,应该会发现,新版本引擎以atlasName为Key去找bmfont字体,FGUI里面没有声明该属性,默认Key会变成undefined,后面的bmfont因为Key也是undefined,所以会出现只会默认使用第一个的情况。我这边如上改动是修复了该现象。

xiaoguzhu commented 5 years ago

我测试了2.1.3,2.2.0,没发现需要加这句话。你再用最新代码试试。

shenxiyou commented 5 years ago

cose