Merge remote-tracking branch 'origin/master' into next

This commit is contained in:
pandamicro
2018-05-29 18:59:36 +08:00
6 changed files with 24 additions and 14 deletions
+1 -1
View File
@@ -174,7 +174,7 @@ Audio.State = {
};
proto.resume = function () {
if (!this._element || this._element.currentTime === 0) return;
if (!this._element || this._state === Audio.State.PLAYING) return;
this._bindEnded();
this._element.play();
this._state = Audio.State.PLAYING;
+1 -6
View File
@@ -328,12 +328,7 @@ var audioEngine = {
resume: function (audioID) {
var audio = getAudioFromId(audioID);
if (audio) {
if (audio.getCurrentTime() === 0) {
audio.play();
}
else {
audio.resume();
}
audio.resume();
}
},
+8
View File
@@ -263,6 +263,14 @@ var Animation = cc.Class({
animator.playState(state, startTime);
}
// Animation cannot be played when the component is not enabledInHierarchy.
// That would cause an error for the animation lost the reference after destroying the node.
// If users play the animation when the component is not enabledInHierarchy,
// we pause the animator here so that it will automatically resume the animation when users enable the component.
if (!this.enabledInHierarchy) {
animator.pause();
}
this.currentClip = state.clip;
}
return state;
+1 -5
View File
@@ -1249,7 +1249,7 @@ var ScrollView = cc.Class({
}
var contentPos = newPosition.sub(this.getContentPosition());
this._moveContent(contentPos, reachedEnd);
this._moveContent(this._clampDelta(deltaMove), reachedEnd);
this._dispatchEvent('scrolling');
if (!this._autoScrolling) {
@@ -1337,7 +1337,6 @@ var ScrollView = cc.Class({
this._autoScrollBraking = true;
}
}
},
_calculateTouchMoveVelocity: function() {
@@ -1368,7 +1367,6 @@ var ScrollView = cc.Class({
_moveContent: function(deltaMove, canStartBounceBack) {
var adjustedMove = this._flattenVectorByDirection(deltaMove);
var newPosition = this.getContentPosition().add(adjustedMove);
this.setContentPosition(newPosition);
@@ -1379,10 +1377,8 @@ var ScrollView = cc.Class({
if (this.elastic && canStartBounceBack) {
this._startBounceBackIfNeeded();
}
},
_getContentLeftBoundary: function() {
var contentPos = this.getContentPosition();
var leftBoundary = contentPos.x - this.content.getAnchorPoint().x * this.content.getContentSize().width;
+8
View File
@@ -681,6 +681,14 @@ function initSys () {
format: ['.mp3']
};
}
var version = /[\d\.]+/.exec(env.system);
sys.osVersion = version[0];
sys.osMainVersion = parseInt(sys.osVersion);
// wechagame subdomain
if (!wx.getFileSystemManager) {
sys.browserType = sys.BROWSER_TYPE_WECHAT_GAME_SUB;
}
else {
// browser or runtime
var win = window, nav = win.navigator, doc = document, docEle = doc.documentElement;
+5 -2
View File
@@ -1155,8 +1155,11 @@ var BaseNode = cc.Class({
var myPrefabInfo = this._prefab;
if (myPrefabInfo) {
if (newPrefabRoot) {
// change prefab
_Scene.PrefabUtils.linkPrefab(newPrefabRoot._prefab.asset, newPrefabRoot, this);
if (myPrefabInfo.root !== newPrefabRoot) {
// change prefab
_Scene.PrefabUtils.unlinkPrefab(this);
_Scene.PrefabUtils.linkPrefab(newPrefabRoot._prefab.asset, newPrefabRoot, this);
}
}
else if (myPrefabInfo.root !== this) {
// detach from prefab