|
380 | 380 | widget.setBackGroundColorType(colorType); |
381 | 381 |
|
382 | 382 | var bgColorOpacity = getParam(json["BackColorAlpha"], 255); |
383 | | - widget.setBackGroundColorOpacity(bgColorOpacity); |
| 383 | + if(bgColorOpacity != null) |
| 384 | + widget.setBackGroundColorOpacity(bgColorOpacity); |
384 | 385 |
|
385 | 386 | var backGroundScale9Enabled = json["Scale9Enable"]; |
386 | 387 | if(backGroundScale9Enabled != null) |
|
490 | 491 | if(isCustomSize != null) |
491 | 492 | widget.ignoreContentAdaptWithSize(!isCustomSize); |
492 | 493 |
|
493 | | - //todo check it |
494 | 494 | var fontResource = json["FontResource"]; |
495 | 495 | if(fontResource != null){ |
496 | 496 | var path = fontResource["Path"]; |
|
647 | 647 | widget.setBackGroundColorType(colorType); |
648 | 648 |
|
649 | 649 | var bgColorOpacity = json["BackColorAlpha"]; |
650 | | - if(bgColorOpacity) |
| 650 | + if(bgColorOpacity != null) |
651 | 651 | widget.setBackGroundColorOpacity(bgColorOpacity); |
652 | 652 |
|
653 | 653 | var backGroundScale9Enabled = json["Scale9Enable"]; |
654 | 654 | if(backGroundScale9Enabled){ |
655 | 655 | widget.setBackGroundImageScale9Enabled(true); |
656 | | - } |
657 | 656 |
|
658 | | - var scale9OriginX = json["Scale9OriginX"] || 0; |
659 | | - var scale9OriginY = json["Scale9OriginY"] || 0; |
660 | 657 |
|
661 | | - var scale9Width = json["Scale9Width"] || 0; |
662 | | - var scale9Height = json["Scale9Height"] || 0; |
663 | | - |
664 | | - //todo please check it |
665 | | - setContentSize(widget, json["Size"]); |
| 658 | + var scale9OriginX = json["Scale9OriginX"] || 0; |
| 659 | + var scale9OriginY = json["Scale9OriginY"] || 0; |
| 660 | + var scale9Width = json["Scale9Width"] || 0; |
| 661 | + var scale9Height = json["Scale9Height"] || 0; |
| 662 | + widget.setBackGroundImageCapInsets(cc.rect( |
| 663 | + scale9OriginX, scale9OriginY, scale9Width, scale9Height |
| 664 | + )); |
| 665 | + setContentSize(widget, json["Size"]); |
| 666 | + }else if(!widget.isIgnoreContentAdaptWithSize()){ |
| 667 | + setContentSize(widget, json["Size"]); |
| 668 | + } |
666 | 669 |
|
667 | 670 | var firstColor = json["FirstColor"]; |
668 | 671 | var endColor = json["EndColor"]; |
|
857 | 860 | var colorVector = json["ColorVector"]; |
858 | 861 | if(colorVector != null && colorVector["ScaleX"] != null && colorVector["ScaleY"] != null) |
859 | 862 | widget.setBackGroundColorVector(colorVector["ScaleX"], colorVector["ScaleY"]); |
860 | | - widget.setBackGroundColorOpacity(bgColorOpacity); |
| 863 | + if(bgColorOpacity != null) |
| 864 | + widget.setBackGroundColorOpacity(bgColorOpacity); |
861 | 865 |
|
862 | 866 | loadTexture(json["FileData"], resourcePath, function(path, type){ |
863 | 867 | widget.setBackGroundImage(path, type); |
|
952 | 956 | var colorVector = json["ColorVector"]; |
953 | 957 | if(colorVector != null && colorVector["ScaleX"] != null && colorVector["ScaleY"] != null) |
954 | 958 | widget.setBackGroundColorVector(colorVector["ScaleX"], colorVector["ScaleY"]); |
955 | | - widget.setBackGroundColorOpacity(bgColorOpacity); |
| 959 | + if(bgColorOpacity != null) |
| 960 | + widget.setBackGroundColorOpacity(bgColorOpacity); |
956 | 961 |
|
957 | 962 |
|
958 | 963 | loadTexture(json["FileData"], resourcePath, function(path, type){ |
|
1078 | 1083 | if(color != null) |
1079 | 1084 | widget.setTextColor(getColor(color)); |
1080 | 1085 |
|
1081 | | - if (!widget.isIgnoreContentAdaptWithSize()) |
| 1086 | + if (!widget.isIgnoreContentAdaptWithSize()){ |
1082 | 1087 | setContentSize(widget, json["Size"]); |
| 1088 | + if (cc.sys.isNative) |
| 1089 | + widget.getVirtualRenderer().setLineBreakWithoutSpace(true); |
| 1090 | + } |
1083 | 1091 |
|
1084 | | - if (cc.sys.isNative) |
1085 | | - widget.getVirtualRenderer().setLineBreakWithoutSpace(true); |
1086 | 1092 |
|
1087 | 1093 | return widget; |
1088 | 1094 |
|
|
0 commit comments