多添加一种纹理类型,
ctor: function (textureName, percentage , texType) {
texType = texType || ccui.Widget.LOCAL_TEXTURE;
this._direction = ccui.LoadingBar.TYPE_LEFT;
this._barRendererTextureSize = cc.size(0, 0);
this._capInsets = cc.rect(0, 0, 0, 0);
ccui.Widget.prototype.ctor.call(this);
if(textureName !== undefined)
this.loadTexture(textureName,texType);
if(percentage !== undefined)
this.setPercent(percentage);
},
如 LoadingBar.loadTexture()下的这段代码
switch (this._renderBarTexType) {
case ccui.Widget.LOCAL_TEXTURE:
barRenderer.initWithFile(texture);
break;
case ccui.Widget.PLIST_TEXTURE:
barRenderer.initWithSpriteFrameName(texture);
break;
case 2: //为了可以加载Texture2D的纹理
barRenderer.initWithTexture(texture);
break;
default:
break;
}