Merge pull request #1079 from pandamicro/master

Upgrade engine API with v3.13
This commit is contained in:
Wang Nan
2016-09-01 15:24:53 +08:00
committed by GitHub
12 changed files with 29 additions and 42 deletions
+3 -1
View File
@@ -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();
+1 -1
View File
@@ -524,7 +524,7 @@ var Node = cc.Class({
}
// Actions
this.stopAllActions();
cc.director.getActionManager().removeAllActionsFromTarget(this);
this._releaseAllActions();
// Remove Node.currentHovered
@@ -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);
+9 -20
View File
@@ -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;
},
/**
* <p>
* Sets the arrival order when this node has a same ZOrder with other children. <br/>
* Update the arrival order. <br/>
* <br/>
* A node which called addChild subsequently will take a larger arrival order, <br/>
* If two children have the same Z order, the child with larger arrival order will be drawn later.
* </p>
* @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;
+1 -1
View File
@@ -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;
}
}
+1 -1
View File
@@ -93,7 +93,7 @@ var RendererUnderSG = cc.Class({
}
sgNode.setAnchorPoint(node._anchorPoint);
sgNode.ignoreAnchorPointForPosition(node.__ignoreAnchor);
sgNode.setIgnoreAnchorPointForPosition(node.__ignoreAnchor);
sgNode.setOpacityModifyRGB(node._opacityModifyRGB);
+4 -4
View File
@@ -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', {
+5 -5
View File
@@ -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);
+3 -2
View File
@@ -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',
+1 -3
View File
@@ -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();
-2
View File
@@ -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,
-1
View File
@@ -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