diff --git a/cocos2d/core/CCGame.js b/cocos2d/core/CCGame.js index b79280f93a..30b1efdd2c 100644 --- a/cocos2d/core/CCGame.js +++ b/cocos2d/core/CCGame.js @@ -305,7 +305,9 @@ var game = { }, /** - * End game, it will close the game window + * !#en End game, it will close the game window + * !#zh 退出游戏 + * @method end */ end: function () { close(); diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 3a928d006d..d15f781ba9 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -524,7 +524,7 @@ var Node = cc.Class({ } // Actions - this.stopAllActions(); + cc.director.getActionManager().removeAllActionsFromTarget(this); this._releaseAllActions(); // Remove Node.currentHovered diff --git a/cocos2d/core/base-nodes/BaseNodesPropertyDefine.js b/cocos2d/core/base-nodes/BaseNodesPropertyDefine.js index ef525bdaa7..f788df4b5b 100644 --- a/cocos2d/core/base-nodes/BaseNodesPropertyDefine.js +++ b/cocos2d/core/base-nodes/BaseNodesPropertyDefine.js @@ -48,7 +48,7 @@ cc._tmp.PrototypeCCNode = function () { cc.defineGetterSetter(_p, "parent", _p.getParent, _p.setParent); cc.defineGetterSetter(_p, "visible", _p.isVisible, _p.setVisible); cc.defineGetterSetter(_p, "running", _p.isRunning); - cc.defineGetterSetter(_p, "ignoreAnchor", _p.isIgnoreAnchorPointForPosition, _p.ignoreAnchorPointForPosition); + cc.defineGetterSetter(_p, "ignoreAnchor", _p.isIgnoreAnchorPointForPosition, _p.setIgnoreAnchorPointForPosition); cc.defineGetterSetter(_p, "actionManager", _p.getActionManager, _p.setActionManager); cc.defineGetterSetter(_p, "scheduler", _p.getScheduler, _p.setScheduler); //cc.defineGetterSetter(_p, "boundingBox", _p.getBoundingBox); diff --git a/cocos2d/core/base-nodes/CCSGNode.js b/cocos2d/core/base-nodes/CCSGNode.js index d910e429a5..ad34d5dada 100644 --- a/cocos2d/core/base-nodes/CCSGNode.js +++ b/cocos2d/core/base-nodes/CCSGNode.js @@ -161,7 +161,7 @@ _ccsg.Node = cc.Class({ this._running = false; this._reorderChildDirty = false; this._shaderProgram = null; - this.arrivalOrder = 0; + this._arrivalOrder = 0; this._additionalTransformDirty = false; this._isTransitionFinished = false; @@ -892,7 +892,7 @@ _ccsg.Node = cc.Class({ * @function * @param {Boolean} newValue true if anchor point will be ignored when you position this node */ - ignoreAnchorPointForPosition: function (newValue) { + setIgnoreAnchorPointForPosition: function (newValue) { if (newValue !== this._ignoreAnchorPointForPosition) { this._ignoreAnchorPointForPosition = newValue; this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.transformDirty); @@ -958,28 +958,18 @@ _ccsg.Node = cc.Class({ return this._name; }, - /** - * Returns the arrival order, indicates which children should be added previously. - * @function - * @return {Number} The arrival order. - */ - getOrderOfArrival: function () { - return this.arrivalOrder; - }, - /** *

- * Sets the arrival order when this node has a same ZOrder with other children.
+ * Update the arrival order.
*
* A node which called addChild subsequently will take a larger arrival order,
* If two children have the same Z order, the child with larger arrival order will be drawn later. *

* @function - * @warning This method is used internally for zOrder sorting, don't change this manually - * @param {Number} Var The arrival order. + * @warning This method is used internally for zOrder sorting, don't call this method manually */ - setOrderOfArrival: function (Var) { - this.arrivalOrder = Var; + updateOrderOfArrival: function () { + this._arrivalOrder = ++cc.s_globalOrderOfArrival; }, /** @@ -1154,7 +1144,7 @@ _ccsg.Node = cc.Class({ child.setName(name); child.setParent(this); - child.setOrderOfArrival(cc.s_globalOrderOfArrival++); + child.updateOrderOfArrival(); if( this._running ){ child.onEnter(); @@ -1319,8 +1309,7 @@ _ccsg.Node = cc.Class({ reorderChild: function (child, zOrder) { cc.assert(child, cc._LogInfos.Node.reorderChild); cc.renderer.childrenOrderDirty = this._reorderChildDirty = true; - child.arrivalOrder = cc.s_globalOrderOfArrival; - cc.s_globalOrderOfArrival++; + child.updateOrderOfArrival(); child._setLocalZOrder(zOrder); this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.orderDirty); }, @@ -1347,7 +1336,7 @@ _ccsg.Node = cc.Class({ while(j >= 0){ if(tmp._localZOrder < _children[j]._localZOrder){ _children[j+1] = _children[j]; - }else if(tmp._localZOrder === _children[j]._localZOrder && tmp.arrivalOrder < _children[j].arrivalOrder){ + }else if(tmp._localZOrder === _children[j]._localZOrder && tmp._arrivalOrder < _children[j]._arrivalOrder){ _children[j+1] = _children[j]; }else{ break; diff --git a/cocos2d/core/components/CCRendererInSG.js b/cocos2d/core/components/CCRendererInSG.js index 57476afe85..d2b212914f 100644 --- a/cocos2d/core/components/CCRendererInSG.js +++ b/cocos2d/core/components/CCRendererInSG.js @@ -123,8 +123,8 @@ var RendererInSG = cc.Class({ if (parentNode) { parentNode.removeChild(replaced); parentNode.addChild(sgNode); - sgNode.arrivalOrder = replaced.arrivalOrder; if ( !CC_JSB ) { + sgNode._arrivalOrder = replaced._arrivalOrder; cc.renderer.childrenOrderDirty = parentNode._reorderChildDirty = true; } } diff --git a/cocos2d/core/components/CCRendererUnderSG.js b/cocos2d/core/components/CCRendererUnderSG.js index fbbee4c901..54e71fdc4f 100644 --- a/cocos2d/core/components/CCRendererUnderSG.js +++ b/cocos2d/core/components/CCRendererUnderSG.js @@ -93,7 +93,7 @@ var RendererUnderSG = cc.Class({ } sgNode.setAnchorPoint(node._anchorPoint); - sgNode.ignoreAnchorPointForPosition(node.__ignoreAnchor); + sgNode.setIgnoreAnchorPointForPosition(node.__ignoreAnchor); sgNode.setOpacityModifyRGB(node._opacityModifyRGB); diff --git a/cocos2d/core/sprites/CCSGSprite.js b/cocos2d/core/sprites/CCSGSprite.js index f7d6488693..c0bde3d40a 100644 --- a/cocos2d/core/sprites/CCSGSprite.js +++ b/cocos2d/core/sprites/CCSGSprite.js @@ -400,12 +400,12 @@ _ccsg.Sprite = _ccsg.Node.extend({ * @param {Boolean} relative * @override */ - ignoreAnchorPointForPosition:function (relative) { + setIgnoreAnchorPointForPosition:function (relative) { if(this._batchNode){ - cc.log(cc._LogInfos.Sprite.ignoreAnchorPointForPosition); + cc.log(cc._LogInfos.Sprite.setIgnoreAnchorPointForPosition); return; } - _ccsg.Node.prototype.ignoreAnchorPointForPosition.call(this, relative); + _ccsg.Node.prototype.setIgnoreAnchorPointForPosition.call(this, relative); }, /** @@ -975,7 +975,7 @@ Object.defineProperty(spritePro, 'visible', { Object.defineProperty(spritePro, 'ignoreAnchor', { get: _ccsg.Node.prototype.isIgnoreAnchorPointForPosition, - set: spritePro.ignoreAnchorPointForPosition + set: spritePro.setIgnoreAnchorPointForPosition }); Object.defineProperty(spritePro, 'opacityModifyRGB', { diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index 2e727fd3b3..35cbc414bf 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -1886,7 +1886,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ sibling.setLocalZOrder(zOrder); } else { - sibling.arrivalOrder = i; + sibling._arrivalOrder = i; cc.eventManager._setDirtyForNode(siblings[i]); } } @@ -1943,7 +1943,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ if (child._localZOrder < _children[j]._localZOrder) { _children[j+1] = _children[j]; } else if (child._localZOrder === _children[j]._localZOrder && - child._sgNode.arrivalOrder < _children[j]._sgNode.arrivalOrder) { + child._sgNode._arrivalOrder < _children[j]._sgNode._arrivalOrder) { _children[j+1] = _children[j]; } else { break; @@ -1972,11 +1972,11 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ sgNode.setScale(self._scaleX, self._scaleY); sgNode.setSkewX(self._skewX); sgNode.setSkewY(self._skewY); - sgNode.ignoreAnchorPointForPosition(self.__ignoreAnchor); + sgNode.setIgnoreAnchorPointForPosition(self.__ignoreAnchor); - var arrivalOrder = sgNode.arrivalOrder; + var arrivalOrder = sgNode._arrivalOrder; sgNode.setLocalZOrder(self._localZOrder); - sgNode.arrivalOrder = arrivalOrder; // revert arrivalOrder changed in setLocalZOrder + sgNode._arrivalOrder = arrivalOrder; // revert arrivalOrder changed in setLocalZOrder sgNode.setGlobalZOrder(self._globalZOrder); diff --git a/cocos2d/deprecated.js b/cocos2d/deprecated.js index c36d786f4f..e2cc099b37 100644 --- a/cocos2d/deprecated.js +++ b/cocos2d/deprecated.js @@ -398,6 +398,8 @@ if (CC_DEV && typeof eruda === 'undefined') { 'transform', 'getCamera', 'grid', + 'getOrderOfArrival', + 'setOrderOfArrival', 'getGrid', 'setGrid', 'getShaderProgram', @@ -428,8 +430,6 @@ if (CC_DEV && typeof eruda === 'undefined') { _detachChild: 'removeChild', getZOrder: 'getLocalZOrder', setZOrder: 'setLocalZOrder', - getOrderOfArrival: 'getSiblingIndex', - setOrderOfArrival: 'setSiblingIndex', boundingBox: 'getBoundingBox', removeFromParentAndCleanup: 'removeFromParent', removeAllChildrenWithCleanup: 'removeAllChildren', @@ -573,6 +573,7 @@ if (CC_DEV && typeof eruda === 'undefined') { 'setCameraMask', 'getCameraMask' ], '_ccsg.Node'); + js.obsolete(_ccsg.Node.prototype, '_ccsg.Node.ignoreAnchorPointForPosition', 'setIgnoreAnchorPointForPosition'); js.obsoletes(cc.Scale9Sprite.prototype, 'cc.Scale9Sprite', { setPreferredSize: 'setContentSize', diff --git a/jsb/index.js b/jsb/index.js index a840eab77a..091abb149e 100644 --- a/jsb/index.js +++ b/jsb/index.js @@ -58,9 +58,7 @@ if (_engineNumberVersion) { cc.initEngine = function (config, cb) { require('script/jsb.js'); cc._renderType = cc.game.RENDER_TYPE_OPENGL; - if (config) { - cc._initDebugSetting(config[cc.game.CONFIG_KEY.debugMode]); - } + cc._initDebugSetting(config ? config[cc.game.CONFIG_KEY.debugMode] : 0); cc._engineLoaded = true; cc.log(cc.ENGINE_VERSION); if (cb) cb(); diff --git a/jsb/jsb-action.js b/jsb/jsb-action.js index f48501f545..a0dd2ecafd 100644 --- a/jsb/jsb-action.js +++ b/jsb/jsb-action.js @@ -343,9 +343,7 @@ function syncColorUpdate (dt) { // Sub classes must be registered before their super class. // Otherwise, JSB there will be internal Error: "too much recursion". var actionUpdate = { - 'MoveTo': syncPositionUpdate, 'MoveBy': syncPositionUpdate, - 'JumpTo': syncPositionUpdate, 'JumpBy': syncPositionUpdate, 'Place': syncPositionUpdate, 'CardinalSplineTo': syncPositionUpdate, diff --git a/jsb/jsb-etc.js b/jsb/jsb-etc.js index 853258faa5..047694e187 100644 --- a/jsb/jsb-etc.js +++ b/jsb/jsb-etc.js @@ -89,7 +89,6 @@ cc.Scheduler.prototype.unschedule = function (callback, target) { // Node var nodeProto = cc.Node.prototype; -cc.defineGetterSetter(nodeProto, "arrivalOrder", nodeProto.getOrderOfArrival, nodeProto.setOrderOfArrival); cc.defineGetterSetter(nodeProto, "_parent", nodeProto.getParent, nodeProto.setParent); // TextureCache addImage