Skip to content

Commit 1087bb4

Browse files
HuangYoungpandamicro
HuangYoung
authored and
pandamicro
committed
More adaptive ccui.Button API
1 parent 37eecbc commit 1087bb4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

extensions/ccui/uiwidgets/UIButton.js

+9
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
253253
break;
254254
case ccui.Widget.PLIST_TEXTURE:
255255
//SetTexture cannot load resource
256+
if (normal[0] === "#") {
257+
normal = normal.substr(1, normal.length - 1);
258+
}
256259
normalRenderer.initWithSpriteFrameName(normal);
257260
break;
258261
default:
@@ -302,6 +305,9 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
302305
break;
303306
case ccui.Widget.PLIST_TEXTURE:
304307
//SetTexture cannot load resource
308+
if (selected[0] === "#") {
309+
selected = selected.substr(1, selected.length - 1);
310+
}
305311
clickedRenderer.initWithSpriteFrameName(selected);
306312
break;
307313
default:
@@ -347,6 +353,9 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
347353
break;
348354
case ccui.Widget.PLIST_TEXTURE:
349355
//SetTexture cannot load resource
356+
if (disabled[0] === "#") {
357+
disabled = disabled.substr(1, disabled.length - 1);
358+
}
350359
disabledRenderer.initWithSpriteFrameName(disabled);
351360
break;
352361
default:

0 commit comments

Comments
 (0)