diff --git a/cocos2d/core/CCDirector.js b/cocos2d/core/CCDirector.js index 4db5380964..d8ed84957d 100644 --- a/cocos2d/core/CCDirector.js +++ b/cocos2d/core/CCDirector.js @@ -540,6 +540,7 @@ cc.Director = Class.extend(/** @lends cc.Director# */{ if (onLaunched) { onLaunched(null, scene); } + cc.renderer.clear(); this.emit(cc.Director.EVENT_AFTER_SCENE_LAUNCH, scene); }, diff --git a/cocos2d/core/editbox/CCSGEditBox.js b/cocos2d/core/editbox/CCSGEditBox.js index 05858a9604..3ddd557ed2 100644 --- a/cocos2d/core/editbox/CCSGEditBox.js +++ b/cocos2d/core/editbox/CCSGEditBox.js @@ -742,8 +742,8 @@ _ccsg.EditBox = _ccsg.Node.extend({ _updateEditBoxSize: function(size, height) { this._oldSetContentSize(size, height); - var newWidth = size.width || size; - var newHeight = size.height || height; + var newWidth = (typeof size.width === 'number') ? size.width : size; + var newHeight = (typeof size.height === 'number') ? size.height : height; this._updateBackgroundSpriteSize(newWidth, newHeight); this._nativeControl.setSize(newWidth, newHeight); diff --git a/cocos2d/core/label/CCSGLabel.js b/cocos2d/core/label/CCSGLabel.js index 26404e359a..94f855c41f 100644 --- a/cocos2d/core/label/CCSGLabel.js +++ b/cocos2d/core/label/CCSGLabel.js @@ -632,8 +632,8 @@ cc.BMFontHelper = { }, _setDimensions: function(size, height) { - var newWidth = size.width || size; - var newHeight = size.height || height; + var newWidth = (typeof size.width === 'number') ? size.width : size; + var newHeight = (typeof size.height === 'number') ? size.height : height; _ccsg.Node.prototype.setContentSize.call(this, size, height); @@ -1088,7 +1088,6 @@ cc.BMFontHelper = { this._fontHandle = filename; var self = this; if (this._labelType === _ccsg.Label.Type.BMFont) { - this._resetBMFont(); var texture; @@ -1113,7 +1112,9 @@ cc.BMFontHelper = { self.emit("load"); }, self); } else { - self._createSpriteBatchNode(texture); + if (!self._spriteBatchNode) { + self._createSpriteBatchNode(texture); + } } }); } diff --git a/cocos2d/core/load-pipeline/CCLoader.js b/cocos2d/core/load-pipeline/CCLoader.js index 1e5ff7e3ae..1dee19afc4 100644 --- a/cocos2d/core/load-pipeline/CCLoader.js +++ b/cocos2d/core/load-pipeline/CCLoader.js @@ -144,10 +144,14 @@ JS.mixin(cc.loader, { singleRes = true; } // Return directly if no resources - if (resources.length === 0 && completeCallback) { - callInNextTick(function () { - completeCallback.call(self, null, self._items); - }); + if (resources.length === 0) { + if (completeCallback) { + callInNextTick(function () { + completeCallback.call(self, null, self._items); + completeCallback = null; + }); + } + return; } // Resolve callback @@ -181,6 +185,7 @@ JS.mixin(cc.loader, { completeCallback.call(self, error, self._items); } } + completeCallback = null; } // Add loaded listeners @@ -205,14 +210,17 @@ JS.mixin(cc.loader, { if (totalCount === completedCount) { var id = resources[0].id || resources[0]; var result = this._items.map[id]; - callInNextTick(function () { - if (singleRes) { - completeCallback.call(self, result.error, result.content); - } - else { - completeCallback.call(self, null, self._items); - } - }); + if (completeCallback) { + callInNextTick(function () { + if (singleRes) { + completeCallback.call(self, result.error, result.content); + } + else { + completeCallback.call(self, null, self._items); + } + completeCallback = null; + }); + } } else { this.flowIn(resources); diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index 75d0749f44..3e8f4931fb 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -941,12 +941,10 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ * @method cleanup */ cleanup: function () { - //// actions - //this.stopAllActions(); - //this.unscheduleAllCallbacks(); - // - //// event - //cc.eventManager.removeListeners(this); + // actions + cc.director.getActionManager().removeAllActionsFromTarget(this); + // event + cc.eventManager.removeListeners(this); // children var i, len = this._children.length, node; diff --git a/jsb/jsb-label.js b/jsb/jsb-label.js index 1c36d20923..4369f282e5 100644 --- a/jsb/jsb-label.js +++ b/jsb/jsb-label.js @@ -47,6 +47,17 @@ if (!jsbLabel.prototype.getOverflow) { jsbLabel.prototype.getOverflow = function(){}; } +//fix jsb system font overflow +jsbLabel.prototype._setOverflow = jsbLabel.prototype.setOverflow; +jsbLabel.prototype.setOverflow = function(overflow) { + this._overFlow = overflow; + this._setOverflow(this._overFlow); +}; + +jsbLabel.prototype.getOverflow = function() { + return this._overFlow; +}; + if (!jsbLabel.prototype.isSystemFontUsed) { jsbLabel.prototype.isSystemFontUsed = function() { return this._isSystemFontUsed; @@ -93,17 +104,20 @@ jsbLabel.prototype.setTTFConfig = function (config) { this._setTTFConfig(config); this._ttfConfig = config; }; + jsbLabel.prototype.getTTFConfig = function () { return this._ttfConfig; }; jsbLabel.prototype.setContentSize = function (size, height) { - if(height !== undefined){ - this.setDimensions(size, height); - } - else{ - this.setDimensions(size.width, size.height); + var newWidth = (typeof size.width === 'number') ? size.width : size; + var newHeight = (typeof size.height === 'number') ? size.height : height; + + if(this.getOverflow() === cc.Label.Overflow.NONE) { + newWidth = 0; + newHeight = 0; } + this.setDimensions(newWidth, newHeight); }; jsbLabel.prototype.setFontFileOrFamily = function (fontHandle) { diff --git a/jsb/jsb-loader.js b/jsb/jsb-loader.js index f425537841..388d513451 100644 --- a/jsb/jsb-loader.js +++ b/jsb/jsb-loader.js @@ -41,7 +41,7 @@ function downloadText (item, callback) { url = cc.Pipeline.UrlResolver.getRawUrl(url); var result = jsb.fileUtils.getStringFromFile(url); - if (typeof result === 'string') { + if (result && typeof result === 'string') { callback(null, result); } else {