Permalink
Browse files

fixed #1463 correct an error when set a number to string of LabelTTF.

  • Loading branch information...
1 parent 90c700f commit d80301fc0bbb6e08d7f95c741d749a7605fe6c9b @dingpinglv dingpinglv committed Nov 22, 2012
View
@@ -172,7 +172,7 @@ cc.HASH_FIND_INT = function (arr, findInt) {
return null;
}
for (var i = 0; i < arr.length; i++) {
- if (arr[i].target == findInt) {
+ if (arr[i].target === findInt) {
return arr[i];
}
}
@@ -100,7 +100,7 @@ cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{
*/
setString:function (string) {
if (this._string != string) {
- this._string = string;
+ this._string = string + "";
// Force update
if (this._string.length > 0) {
@@ -307,11 +307,14 @@ cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{
} else if (this._dimensions.width == 0) {
context.textBaseline = "bottom";
context.textAlign = "left";
- if (this._string.indexOf("\n") > -1)
+ if(!this._string.indexOf){
+ var z = 0;
+ }
+
+ if (this._string.indexOf("\n") > -1)
this._multiLineText(context);
- else {
+ else
context.fillText(this._string, -this._contentSize.width * this._anchorPoint.x, this._contentSize.height * this._anchorPoint.y);
- }
} else {
context.textBaseline = cc.LabelTTF._textBaseline[this._vAlignment];
context.textAlign = cc.LabelTTF._textAlign[this._hAlignment];
@@ -1848,8 +1848,8 @@ cc.ParticleSystem.create = function (plistFile) {
};
cc.ParticleSystem.createWithTotalParticles = function (number_of_particles) {
- var emitter = cc.ParticleSystemQuad.create();
- emitter.initWithTotalParticles(number_of_particles);
+ var emitter = cc.ParticleSystemQuad.create(number_of_particles);
+ //emitter.initWithTotalParticles(number_of_particles);
return emitter;
};
@@ -768,9 +768,10 @@ cc.ParticleSystemQuad = cc.ParticleSystem.extend(/** @lends cc.ParticleSystemQua
*/
cc.ParticleSystemQuad.create = function (pListFile) {
var ret = new cc.ParticleSystemQuad();
- if (!pListFile) {
+ if (!pListFile || typeof(pListFile) === "number") {
+ var ton = pListFile || 100;
ret.setDrawMode(cc.PARTICLE_TEXTURE_MODE);
- ret.initWithTotalParticles(100);
+ ret.initWithTotalParticles(ton);
return ret;
}

0 comments on commit d80301f

Please sign in to comment.