mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
Merge pull request #657 from pandamicro/v1.0
Fix setSiblingIndex and some code cleanup
This commit is contained in:
@@ -205,8 +205,8 @@ var AudioSource = cc.Class({
|
||||
if ( this._clip ) {
|
||||
var volume = this._mute ? 0 : this._volume;
|
||||
if (cc.sys.isNative) {
|
||||
audioEngine.setEffectsVolume(volume);
|
||||
audioEngine.playEffect(this._clip, this._loop);
|
||||
cc.audioEngine.setEffectsVolume(volume);
|
||||
}
|
||||
else {
|
||||
this.audio = audioEngine.playEffect(this._clip, this._loop);
|
||||
|
||||
@@ -132,13 +132,11 @@ if (_ccsg.Node.WebGLRenderCmd) {
|
||||
|
||||
proto._updateDisplayOpacity = function(parentOpacity){
|
||||
_ccsg.Node.WebGLRenderCmd.prototype._updateDisplayOpacity.call(this, parentOpacity);
|
||||
var node = this._node;
|
||||
this._colorOpacityDirty = true;
|
||||
};
|
||||
|
||||
proto._updateDisplayColor = function(parentColor){
|
||||
_ccsg.Node.WebGLRenderCmd.prototype._updateDisplayColor.call(this, parentColor);
|
||||
var node = this._node;
|
||||
this._colorOpacityDirty = true;
|
||||
};
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
uuid = Editor.UuidCache.urlToUuid(url);
|
||||
}
|
||||
}
|
||||
var capInsets = undefined;
|
||||
var capInsets;
|
||||
if (this.insetLeft !== 0 ||
|
||||
this.insetTop !== 0 ||
|
||||
this.insetRight !== 0 ||
|
||||
|
||||
@@ -1813,16 +1813,24 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
}
|
||||
|
||||
// update rendering scene graph, sort them by arrivalOrder
|
||||
var siblings = this._parent._children;
|
||||
var parent = this._parent;
|
||||
var siblings = parent._children;
|
||||
for (var i = 0, len = siblings.length; i < len; i++) {
|
||||
var sibling = siblings[i];
|
||||
sibling._sgNode.arrivalOrder = i;
|
||||
}
|
||||
if ( !CC_JSB ) {
|
||||
cc.renderer.childrenOrderDirty = true;
|
||||
this._parent._sgNode._reorderChildDirty = true;
|
||||
this._parent._reorderChildDirty = true;
|
||||
this._parent._delaySort();
|
||||
var sibling = siblings[i]._sgNode;
|
||||
if (CC_JSB) {
|
||||
// Reset zorder to update their arrival order
|
||||
var zOrder = sibling.getLocalZOrder();
|
||||
sibling.setLocalZOrder(zOrder+1);
|
||||
sibling.setLocalZOrder(zOrder);
|
||||
}
|
||||
else {
|
||||
sibling.arrivalOrder = i;
|
||||
cc.renderer.childrenOrderDirty = true;
|
||||
parent._sgNode._reorderChildDirty = true;
|
||||
parent._reorderChildDirty = true;
|
||||
parent._delaySort();
|
||||
cc.eventManager._setDirtyForNode(siblings[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user