quick-cocos2d-x踩坑记(2)
原文请猛戳,原文将不时更新: CocoStudio的文字标签加描边后字体颜色会改变现象给CocoStudio的 建议我用了如下的workaround去拿到编辑器中设置的字体颜色,并重置node本身的颜色: function MyPackage.formatUIText(label,formatFunc) local color = label:getColor() color.a = 255 label:setColor(cc.c3b(0xff,0xff,0xff)) label:setTextColor(color) formatFunc(label) end 这样就可以用来正常设置描边了,例如: MyPackage.formatUIText(testLabel,function(label) label:setOutline(cc.color.BLUE,2) end) 当UI的字体较多时,对每一个 --[[ format all labels under root layout ]] function MyPackage.formatAllLabels(layout,formatFunc) local children = layout:getChildren() local childCount = layout:getChildrenCount() if childCount < 1 then return end for i = 1,childCount do if tolua.type(children[i]) == "ccui.Text" then MyPackage.formatUIText(children[i],formatFunc) end MyPackage.formatAllLabels(children[i],formatFunc) end end NOTE:关于 quickx按钮显示异常现象quickx的按钮在某些清理 建议本渣改了quickx (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |