mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 03:22:39 +08:00
+1
-1
@@ -2609,7 +2609,7 @@ Wrong type arguments, 'filePath' must be a String.
|
||||
|
||||
### 8401
|
||||
|
||||
Since 1.10, `%s` accept cc.AudioClip instance directly, not a URL string. Please directly reference the AudioClip object in your script, or load cc.AudioClip by loader first. Don't use audio's URL anymore.
|
||||
Since 1.10, `%s` accept %s instance directly, not a URL string. Please directly reference the %s object in your script, or load %s by loader first. Don't use %s's URL anymore.
|
||||
|
||||
### 9000
|
||||
|
||||
|
||||
@@ -911,7 +911,7 @@ cc.easeCircleActionIn = function(){
|
||||
* 参考 easeOutCirc:http://www.zhihu.com/question/21981571/answer/19925418
|
||||
* @method easeCircleActionOut
|
||||
* @returns {Object}
|
||||
* @exampple
|
||||
* @example
|
||||
* //example
|
||||
* actioneasing(cc.easeCircleActionOut());
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,7 @@ var HashElement = function () {
|
||||
* - 当你想要运行一个动作,但目标不是 CCNode 类型时。 <br/>
|
||||
* - 当你想要暂停/恢复动作时。 <br/>
|
||||
* @class ActionManager
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/CCActionManager/ActionManager.js}
|
||||
* @example {@link cocos2d/core/CCActionManager/ActionManager.js}
|
||||
*/
|
||||
cc.ActionManager = function () {
|
||||
this._hashTargets = js.createMap(true);
|
||||
|
||||
@@ -85,7 +85,7 @@ var AnimationClip = cc.Class({
|
||||
* !#zh 曲线数据。
|
||||
* @property curveData
|
||||
* @type {Object}
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/animation-clip/curve-data.js}
|
||||
* @example {@link cocos2d/core/animation-clip/curve-data.js}
|
||||
*/
|
||||
curveData: {
|
||||
default: {},
|
||||
@@ -97,7 +97,7 @@ var AnimationClip = cc.Class({
|
||||
* !#zh 事件数据。
|
||||
* @property events
|
||||
* @type {Object[]}
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/animation-clip/event-data.js}
|
||||
* @example {@link cocos2d/core/animation-clip/event-data.js}
|
||||
* @typescript events: {frame: number, func: string, params: string[]}[]
|
||||
*/
|
||||
events: {
|
||||
|
||||
+22
-24
@@ -106,12 +106,18 @@ Audio.State = {
|
||||
// };
|
||||
|
||||
proto._onLoaded = function () {
|
||||
if (this._src.loadMode === LoadMode.DOM_AUDIO) {
|
||||
this._element = document.createElement('audio');
|
||||
this._element.src = this._src._nativeAsset.src;
|
||||
var elem = this._src._nativeAsset;
|
||||
if (CC_QQPLAY || CC_WECHATGAME) {
|
||||
this._element = elem;
|
||||
}
|
||||
else {
|
||||
this._element = new WebAudioElement(this._src._nativeAsset, this);
|
||||
if (this._src.loadMode === LoadMode.DOM_AUDIO) {
|
||||
this._element = document.createElement('audio');
|
||||
this._element.src = elem.src;
|
||||
}
|
||||
else {
|
||||
this._element = new WebAudioElement(elem, this);
|
||||
}
|
||||
}
|
||||
|
||||
this.setVolume(this._volume);
|
||||
@@ -138,7 +144,7 @@ Audio.State = {
|
||||
this._bindEnded();
|
||||
this._element.play();
|
||||
|
||||
if (sys.platform !== sys.WECHAT_GAME &&
|
||||
if (!(CC_QQPLAY || CC_WECHATGAME) &&
|
||||
this._src && this._src.loadMode === LoadMode.DOM_AUDIO &&
|
||||
this._element.paused) {
|
||||
touchPlayList.push({ instance: this, offset: 0, audio: this._element });
|
||||
@@ -157,9 +163,7 @@ Audio.State = {
|
||||
};
|
||||
|
||||
proto.destroy = function () {
|
||||
if (CC_WECHATGAME) {
|
||||
this._element && this._element.destroy();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
proto.pause = function () {
|
||||
@@ -178,17 +182,9 @@ Audio.State = {
|
||||
|
||||
proto.stop = function () {
|
||||
if (!this._element) return;
|
||||
if (CC_WECHATGAME) {
|
||||
setTimeout(function () {
|
||||
try {
|
||||
this._element.currentTime = 0;
|
||||
} catch (error) {}
|
||||
}.bind(this), 0);
|
||||
} else {
|
||||
try {
|
||||
this._element.currentTime = 0;
|
||||
} catch (error) {}
|
||||
}
|
||||
try {
|
||||
this._element.currentTime = 0;
|
||||
} catch (error) {}
|
||||
this._element.pause();
|
||||
// remove touchPlayList
|
||||
for (var i=0; i<touchPlayList.length; i++) {
|
||||
@@ -232,7 +228,7 @@ Audio.State = {
|
||||
}
|
||||
|
||||
this._unbindEnded();
|
||||
if (sys.platform !== sys.WECHAT_GAME) {
|
||||
if (!(CC_QQPLAY || CC_WECHATGAME)) {
|
||||
this._bindEnded(function () {
|
||||
this._bindEnded();
|
||||
}.bind(this));
|
||||
@@ -260,9 +256,11 @@ Audio.State = {
|
||||
};
|
||||
|
||||
proto.getState = function () {
|
||||
var elem = this._element;
|
||||
if (elem && Audio.State.PLAYING === this._state && elem.paused) {
|
||||
this._state = Audio.State.PAUSED;
|
||||
if (!CC_WECHATGAME) {
|
||||
var elem = this._element;
|
||||
if (elem && Audio.State.PLAYING === this._state && elem.paused) {
|
||||
this._state = Audio.State.PAUSED;
|
||||
}
|
||||
}
|
||||
return this._state;
|
||||
};
|
||||
@@ -384,7 +382,7 @@ var WebAudioElement = function (buffer, audio) {
|
||||
var self = this;
|
||||
clearTimeout(this._currextTimer);
|
||||
this._currextTimer = setTimeout(function () {
|
||||
if (sys.platform !== sys.WECHAT_GAME && self._context.currentTime === 0) {
|
||||
if (!(CC_QQPLAY || CC_WECHATGAME) && self._context.currentTime === 0) {
|
||||
touchPlayList.push({
|
||||
instance: self._audio,
|
||||
offset: offset,
|
||||
|
||||
@@ -106,7 +106,7 @@ var audioEngine = {
|
||||
var audio;
|
||||
if (typeof clip === 'string') {
|
||||
// backward compatibility since 1.10
|
||||
cc.warnID(8401, 'cc.audioEngine');
|
||||
cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
|
||||
path = clip;
|
||||
// load clip
|
||||
audio = getAudioFromPath(path);
|
||||
@@ -427,7 +427,7 @@ var audioEngine = {
|
||||
var filePath = clip;
|
||||
if (typeof clip === 'string') {
|
||||
// backward compatibility since 1.10
|
||||
cc.warnID(8401, 'cc.audioEngine');
|
||||
cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
|
||||
filePath = clip;
|
||||
}
|
||||
else {
|
||||
@@ -598,7 +598,7 @@ var audioEngine = {
|
||||
* !#en Resume playing background music.
|
||||
* !#zh 恢复播放背景音乐。
|
||||
* @method resumeMusic
|
||||
* //example
|
||||
* @example
|
||||
* cc.audioEngine.resumeMusic();
|
||||
*/
|
||||
resumeMusic: function () {
|
||||
@@ -730,7 +730,7 @@ var audioEngine = {
|
||||
* !#zh 恢复播放音效音频。
|
||||
* @method resumeEffect
|
||||
* @param {Number} audioID - The return value of function play.
|
||||
* //example
|
||||
* @example
|
||||
* cc.audioEngine.resumeEffect(audioID);
|
||||
*/
|
||||
resumeEffect: function (id) {
|
||||
|
||||
@@ -1769,7 +1769,7 @@ var Node = cc.Class({
|
||||
* @private
|
||||
* @param {String} type - the event type
|
||||
* @param {Array} array - the array to receive targets
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/event/_getCapturingTargets.js}
|
||||
* @example {@link cocos2d/core/event/_getCapturingTargets.js}
|
||||
*/
|
||||
_getCapturingTargets (type, array) {
|
||||
var parent = this.parent;
|
||||
@@ -1965,7 +1965,7 @@ var Node = cc.Class({
|
||||
* @method setPosition
|
||||
* @param {Vec2|Number} newPosOrX - X coordinate for position or the position (x, y) of the node in coordinates
|
||||
* @param {Number} [y] - Y coordinate for position
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/utils/base-node/setPosition.js}
|
||||
* @example {@link cocos2d/core/utils/base-node/setPosition.js}
|
||||
*/
|
||||
setPosition (newPosOrX, y) {
|
||||
var x;
|
||||
|
||||
@@ -481,8 +481,25 @@ cc.Scheduler.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* !#en The schedule
|
||||
* !#zh 定时器
|
||||
* !#en
|
||||
* <p>
|
||||
* The scheduled method will be called every 'interval' seconds.</br>
|
||||
* If paused is YES, then it won't be called until it is resumed.<br/>
|
||||
* If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.<br/>
|
||||
* If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.<br/>
|
||||
* repeat let the action be repeated repeat + 1 times, use cc.macro.REPEAT_FOREVER to let the action run continuously<br/>
|
||||
* delay is the amount of time the action will wait before it'll start<br/>
|
||||
* </p>
|
||||
* !#zh
|
||||
* 指定回调函数,调用对象等信息来添加一个新的定时器。</br>
|
||||
* 如果 paused 值为 true,那么直到 resume 被调用才开始计时。</br>
|
||||
* 当时间间隔达到指定值时,设置的回调函数将会被调用。</br>
|
||||
* 如果 interval 值为 0,那么回调函数每一帧都会被调用,但如果是这样,
|
||||
* 建议使用 scheduleUpdateForTarget 代替。</br>
|
||||
* 如果回调函数已经被定时器使用,那么只会更新之前定时器的时间间隔参数,不会设置新的定时器。<br/>
|
||||
* repeat 值可以让定时器触发 repeat + 1 次,使用 cc.macro.REPEAT_FOREVER
|
||||
* 可以让定时器一直循环触发。<br/>
|
||||
* delay 值指定延迟时间,定时器会在延迟指定的时间之后开始计时。
|
||||
* @method schedule
|
||||
* @param {Function} callback
|
||||
* @param {Object} target
|
||||
@@ -490,7 +507,7 @@ cc.Scheduler.prototype = {
|
||||
* @param {Number} [repeat=cc.macro.REPEAT_FOREVER]
|
||||
* @param {Number} [delay=0]
|
||||
* @param {Boolean} paused
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/CCScheduler/schedule.js}
|
||||
* @example {@link cocos2d/core/CCScheduler/schedule.js}
|
||||
* @typescript
|
||||
* schedule(callback: Function, target: any, interval: number, repeat: number, delay: number, paused?: boolean): void
|
||||
* schedule(callback: Function, target: any, interval: number, paused?: boolean): void
|
||||
|
||||
@@ -26,16 +26,15 @@
|
||||
|
||||
const misc = require('../utils/misc');
|
||||
const Component = require('./CCComponent');
|
||||
const Audio = require('../../audio/CCAudio');
|
||||
const AudioClip = require('../assets/CCAudioClip');
|
||||
require('../../audio/CCAudio');
|
||||
|
||||
/**
|
||||
* !#en Audio Source.
|
||||
* !#zh 音频源组件,能对音频剪辑。
|
||||
* @class AudioSource
|
||||
* @extends Component
|
||||
*/
|
||||
|
||||
|
||||
var AudioSource = cc.Class({
|
||||
name: 'cc.AudioSource',
|
||||
extends: Component,
|
||||
@@ -46,7 +45,7 @@ var AudioSource = cc.Class({
|
||||
},
|
||||
|
||||
ctor: function () {
|
||||
this.audio = new cc.Audio();
|
||||
this.audio = new Audio();
|
||||
},
|
||||
|
||||
properties: {
|
||||
@@ -96,7 +95,7 @@ var AudioSource = cc.Class({
|
||||
set: function (value) {
|
||||
if (typeof value === 'string') {
|
||||
// backward compatibility since 1.10
|
||||
cc.warnID(8401, 'cc.AudioSource');
|
||||
cc.warnID(8401, 'cc.AudioSource', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
|
||||
let self = this;
|
||||
AudioClip._loadByUrl(value, function (err, clip) {
|
||||
if (clip) {
|
||||
|
||||
@@ -193,10 +193,10 @@ var Layout = cc.Class({
|
||||
*/
|
||||
type: {
|
||||
type: Type,
|
||||
get: function() {
|
||||
get: function () {
|
||||
return this._N$layoutType;
|
||||
},
|
||||
set: function(value) {
|
||||
set: function (value) {
|
||||
this._N$layoutType = value;
|
||||
|
||||
if (CC_EDITOR && this.type !== Type.NONE && this._resize === ResizeMode.CONTAINER && !cc.engine.isPlaying) {
|
||||
@@ -224,10 +224,10 @@ var Layout = cc.Class({
|
||||
type: ResizeMode,
|
||||
tooltip: CC_DEV && 'i18n:COMPONENT.layout.resize_mode',
|
||||
animatable: false,
|
||||
get: function() {
|
||||
get: function () {
|
||||
return this._resize;
|
||||
},
|
||||
set: function(value) {
|
||||
set: function (value) {
|
||||
if (this.type === Type.NONE && value === ResizeMode.CHILDREN) {
|
||||
return;
|
||||
}
|
||||
@@ -253,7 +253,7 @@ var Layout = cc.Class({
|
||||
default: cc.size(40, 40),
|
||||
tooltip: CC_DEV && 'i18n:COMPONENT.layout.cell_size',
|
||||
type: cc.Size,
|
||||
notify: function() {
|
||||
notify: function () {
|
||||
this._doLayoutDirty();
|
||||
},
|
||||
},
|
||||
@@ -269,7 +269,7 @@ var Layout = cc.Class({
|
||||
default: AxisDirection.HORIZONTAL,
|
||||
tooltip: CC_DEV && 'i18n:COMPONENT.layout.start_axis',
|
||||
type: AxisDirection,
|
||||
notify: function() {
|
||||
notify: function () {
|
||||
if (CC_EDITOR && this._resize === ResizeMode.CONTAINER && !cc.engine.isPlaying) {
|
||||
var reLayouted = _Scene.DetectConflict.checkConflict_Layout(this);
|
||||
if (reLayouted) {
|
||||
@@ -343,7 +343,7 @@ var Layout = cc.Class({
|
||||
*/
|
||||
spacingX: {
|
||||
default: 0,
|
||||
notify: function() {
|
||||
notify: function () {
|
||||
this._doLayoutDirty();
|
||||
},
|
||||
tooltip: CC_DEV && 'i18n:COMPONENT.layout.space_x'
|
||||
@@ -356,7 +356,7 @@ var Layout = cc.Class({
|
||||
*/
|
||||
spacingY: {
|
||||
default: 0,
|
||||
notify: function() {
|
||||
notify: function () {
|
||||
this._doLayoutDirty();
|
||||
},
|
||||
tooltip: CC_DEV && 'i18n:COMPONENT.layout.space_y'
|
||||
@@ -372,7 +372,7 @@ var Layout = cc.Class({
|
||||
verticalDirection: {
|
||||
default: VerticalDirection.TOP_TO_BOTTOM,
|
||||
type: VerticalDirection,
|
||||
notify: function() {
|
||||
notify: function () {
|
||||
this._doLayoutDirty();
|
||||
},
|
||||
tooltip: CC_DEV && 'i18n:COMPONENT.layout.vertical_direction',
|
||||
@@ -389,7 +389,7 @@ var Layout = cc.Class({
|
||||
horizontalDirection: {
|
||||
default: HorizontalDirection.LEFT_TO_RIGHT,
|
||||
type: HorizontalDirection,
|
||||
notify: function() {
|
||||
notify: function () {
|
||||
this._doLayoutDirty();
|
||||
},
|
||||
tooltip: CC_DEV && 'i18n:COMPONENT.layout.horizontal_direction',
|
||||
@@ -413,14 +413,14 @@ var Layout = cc.Class({
|
||||
this._N$padding = 0;
|
||||
},
|
||||
|
||||
onEnable: function() {
|
||||
onEnable: function () {
|
||||
this._addEventListeners();
|
||||
|
||||
if(this.node.getContentSize().equals(cc.size(0, 0))) {
|
||||
if (this.node.getContentSize().equals(cc.size(0, 0))) {
|
||||
this.node.setContentSize(this._layoutSize);
|
||||
}
|
||||
|
||||
if(this._N$padding !== 0) {
|
||||
if (this._N$padding !== 0) {
|
||||
this._migratePaddingData();
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ var Layout = cc.Class({
|
||||
this._removeEventListeners();
|
||||
},
|
||||
|
||||
_doLayoutDirty : function () {
|
||||
_doLayoutDirty: function () {
|
||||
this._layoutDirty = true;
|
||||
},
|
||||
|
||||
@@ -455,27 +455,29 @@ var Layout = cc.Class({
|
||||
this._removeChildrenEventListeners();
|
||||
},
|
||||
|
||||
_addChildrenEventListeners: function() {
|
||||
_addChildrenEventListeners: function () {
|
||||
var children = this.node.children;
|
||||
children.forEach(function (child) {
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var child = children[i];
|
||||
child.on(NodeEvent.SIZE_CHANGED, this._doLayoutDirty, this);
|
||||
child.on(NodeEvent.POSITION_CHANGED, this._doLayoutDirty, this);
|
||||
child.on(NodeEvent.ANCHOR_CHANGED, this._doLayoutDirty, this);
|
||||
child.on('active-in-hierarchy-changed', this._doLayoutDirty, this);
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
_removeChildrenEventListeners: function () {
|
||||
var children = this.node.children;
|
||||
children.forEach(function (child) {
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var child = children[i];
|
||||
child.off(NodeEvent.SIZE_CHANGED, this._doLayoutDirty, this);
|
||||
child.off(NodeEvent.POSITION_CHANGED, this._doLayoutDirty, this);
|
||||
child.off(NodeEvent.ANCHOR_CHANGED, this._doLayoutDirty, this);
|
||||
child.off('active-in-hierarchy-changed', this._doLayoutDirty, this);
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
_childAdded: function(event) {
|
||||
_childAdded: function (event) {
|
||||
var child = event.detail;
|
||||
child.on(NodeEvent.SIZE_CHANGED, this._doLayoutDirty, this);
|
||||
child.on(NodeEvent.POSITION_CHANGED, this._doLayoutDirty, this);
|
||||
@@ -485,7 +487,7 @@ var Layout = cc.Class({
|
||||
this._doLayoutDirty();
|
||||
},
|
||||
|
||||
_childRemoved: function(event) {
|
||||
_childRemoved: function (event) {
|
||||
var child = event.detail;
|
||||
child.off(NodeEvent.SIZE_CHANGED, this._doLayoutDirty, this);
|
||||
child.off(NodeEvent.POSITION_CHANGED, this._doLayoutDirty, this);
|
||||
@@ -495,12 +497,12 @@ var Layout = cc.Class({
|
||||
this._doLayoutDirty();
|
||||
},
|
||||
|
||||
_resized: function() {
|
||||
_resized: function () {
|
||||
this._layoutSize = this.node.getContentSize();
|
||||
this._doLayoutDirty();
|
||||
},
|
||||
|
||||
_doLayoutHorizontally: function(baseWidth, rowBreak, fnPositionY, applyChildren) {
|
||||
_doLayoutHorizontally: function (baseWidth, rowBreak, fnPositionY, applyChildren) {
|
||||
var layoutAnchor = this.node.getAnchorPoint();
|
||||
var children = this.node.children;
|
||||
|
||||
@@ -522,14 +524,23 @@ var Layout = cc.Class({
|
||||
|
||||
var maxHeightChildAnchorY = 0;
|
||||
|
||||
var newChildWidth = this.cellSize.width;
|
||||
if (this.type !== Type.GRID && this.resizeMode === ResizeMode.CHILDREN) {
|
||||
newChildWidth = (baseWidth - (this.paddingLeft + this.paddingRight) - (children.length - 1) * this.spacingX) / children.length;
|
||||
var activeChildCount = 0;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var child = children[i];
|
||||
if (child.activeInHierarchy) {
|
||||
activeChildCount++;
|
||||
}
|
||||
}
|
||||
|
||||
children.forEach(function(child) {
|
||||
var newChildWidth = this.cellSize.width;
|
||||
if (this.type !== Type.GRID && this.resizeMode === ResizeMode.CHILDREN) {
|
||||
newChildWidth = (baseWidth - (this.paddingLeft + this.paddingRight) - (activeChildCount - 1) * this.spacingX) / activeChildCount;
|
||||
}
|
||||
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var child = children[i];
|
||||
if (!child.activeInHierarchy) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
//for resizing children
|
||||
if (this._resize === ResizeMode.CHILDREN) {
|
||||
@@ -578,13 +589,13 @@ var Layout = cc.Class({
|
||||
secondMaxHeight = childBoundingBoxHeight;
|
||||
tempMaxHeight = 0;
|
||||
}
|
||||
nextX = leftBoundaryOfLayout + sign * (paddingX + anchorX * childBoundingBoxWidth);
|
||||
nextX = leftBoundaryOfLayout + sign * (paddingX + anchorX * child.width);
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
||||
var finalPositionY = fnPositionY(child, rowMaxHeight, row);
|
||||
if(baseWidth >= (childBoundingBoxWidth + this.paddingLeft + this.paddingRight)) {
|
||||
if (baseWidth >= (child.width + this.paddingLeft + this.paddingRight)) {
|
||||
if (applyChildren) {
|
||||
child.setPosition(cc.v2(nextX, finalPositionY));
|
||||
}
|
||||
@@ -597,21 +608,21 @@ var Layout = cc.Class({
|
||||
if (this.verticalDirection === VerticalDirection.TOP_TO_BOTTOM) {
|
||||
containerResizeBoundary = containerResizeBoundary || this.node._contentSize.height;
|
||||
signX = -1;
|
||||
tempFinalPositionY = finalPositionY + signX * (topMarign * maxHeightChildAnchorY + this.paddingBottom);
|
||||
tempFinalPositionY = finalPositionY + signX * (topMarign * maxHeightChildAnchorY + this.paddingBottom);
|
||||
if (tempFinalPositionY < containerResizeBoundary) {
|
||||
containerResizeBoundary = tempFinalPositionY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
containerResizeBoundary = containerResizeBoundary || -this.node._contentSize.height;
|
||||
tempFinalPositionY = finalPositionY + signX * (topMarign * maxHeightChildAnchorY + this.paddingTop);
|
||||
tempFinalPositionY = finalPositionY + signX * (topMarign * maxHeightChildAnchorY + this.paddingTop);
|
||||
if (tempFinalPositionY > containerResizeBoundary) {
|
||||
containerResizeBoundary = tempFinalPositionY;
|
||||
}
|
||||
}
|
||||
|
||||
nextX += rightBoundaryOfChild;
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
return containerResizeBoundary;
|
||||
},
|
||||
@@ -620,13 +631,13 @@ var Layout = cc.Class({
|
||||
var newHeight = 0;
|
||||
var activeChildCount = 0;
|
||||
if (this.resizeMode === ResizeMode.CONTAINER) {
|
||||
children.forEach(function(child) {
|
||||
if (!child.activeInHierarchy) {
|
||||
return;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var child = children[i];
|
||||
if (child.activeInHierarchy) {
|
||||
activeChildCount++;
|
||||
newHeight += child.height * child.scaleY;
|
||||
}
|
||||
activeChildCount++;
|
||||
newHeight += child.height * child.scaleY;
|
||||
});
|
||||
}
|
||||
|
||||
newHeight += (activeChildCount - 1) * this.spacingY + this.paddingBottom + this.paddingTop;
|
||||
}
|
||||
@@ -636,7 +647,7 @@ var Layout = cc.Class({
|
||||
return newHeight;
|
||||
},
|
||||
|
||||
_doLayoutVertically: function(baseHeight, columnBreak, fnPositionX, applyChildren) {
|
||||
_doLayoutVertically: function (baseHeight, columnBreak, fnPositionX, applyChildren) {
|
||||
var layoutAnchor = this.node.getAnchorPoint();
|
||||
var children = this.node.children;
|
||||
|
||||
@@ -657,14 +668,23 @@ var Layout = cc.Class({
|
||||
var containerResizeBoundary = 0;
|
||||
var maxWidthChildAnchorX = 0;
|
||||
|
||||
var newChildHeight = this.cellSize.height;
|
||||
if (this.type !== Type.GRID && this.resizeMode === ResizeMode.CHILDREN) {
|
||||
newChildHeight = (baseHeight - (this.paddingTop + this.paddingBottom) - (children.length - 1) * this.spacingY) / children.length;
|
||||
var activeChildCount = 0;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var child = children[i];
|
||||
if (child.activeInHierarchy) {
|
||||
activeChildCount++;
|
||||
}
|
||||
}
|
||||
|
||||
children.forEach(function(child) {
|
||||
var newChildHeight = this.cellSize.height;
|
||||
if (this.type !== Type.GRID && this.resizeMode === ResizeMode.CHILDREN) {
|
||||
newChildHeight = (baseHeight - (this.paddingTop + this.paddingBottom) - (activeChildCount - 1) * this.spacingY) / activeChildCount;
|
||||
}
|
||||
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var child = children[i];
|
||||
if (!child.activeInHierarchy) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
//for resizing children
|
||||
@@ -748,27 +768,26 @@ var Layout = cc.Class({
|
||||
}
|
||||
|
||||
nextY += topBoundaryOfChild;
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
return containerResizeBoundary;
|
||||
},
|
||||
|
||||
_doLayoutBasic: function() {
|
||||
_doLayoutBasic: function () {
|
||||
var children = this.node.children;
|
||||
|
||||
var allChildrenBoundingBox = null;
|
||||
|
||||
children.forEach(function(child){
|
||||
if (!child.activeInHierarchy) {
|
||||
return;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var child = children[i];
|
||||
if (child.activeInHierarchy) {
|
||||
if (!allChildrenBoundingBox) {
|
||||
allChildrenBoundingBox = child.getBoundingBoxToWorld();
|
||||
} else {
|
||||
allChildrenBoundingBox.union(allChildrenBoundingBox, child.getBoundingBoxToWorld());
|
||||
}
|
||||
}
|
||||
|
||||
if(!allChildrenBoundingBox){
|
||||
allChildrenBoundingBox = child.getBoundingBoxToWorld();
|
||||
} else {
|
||||
allChildrenBoundingBox.union(allChildrenBoundingBox, child.getBoundingBoxToWorld());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (allChildrenBoundingBox) {
|
||||
var leftBottomInParentSpace = this.node.parent.convertToNodeSpaceAR(cc.v2(allChildrenBoundingBox.x, allChildrenBoundingBox.y));
|
||||
@@ -803,8 +822,8 @@ var Layout = cc.Class({
|
||||
paddingY = this.paddingTop;
|
||||
}
|
||||
|
||||
var fnPositionY = function(child, topOffset, row) {
|
||||
return bottomBoundaryOfLayout + sign * (topOffset + child.anchorY * child.height *child.scaleY + paddingY + row * this.spacingY);
|
||||
var fnPositionY = function (child, topOffset, row) {
|
||||
return bottomBoundaryOfLayout + sign * (topOffset + child.anchorY * child.height * child.scaleY + paddingY + row * this.spacingY);
|
||||
}.bind(this);
|
||||
|
||||
|
||||
@@ -844,7 +863,7 @@ var Layout = cc.Class({
|
||||
paddingX = this.paddingRight;
|
||||
}
|
||||
|
||||
var fnPositionX = function(child, leftOffset, column) {
|
||||
var fnPositionX = function (child, leftOffset, column) {
|
||||
return leftBoundaryOfLayout + sign * (leftOffset + child.anchorX * child.width * child.scaleX + paddingX + column * this.spacingX);
|
||||
}.bind(this);
|
||||
|
||||
@@ -871,7 +890,7 @@ var Layout = cc.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_doLayoutGrid: function() {
|
||||
_doLayoutGrid: function () {
|
||||
var layoutAnchor = this.node.getAnchorPoint();
|
||||
var layoutSize = this.node.getContentSize();
|
||||
|
||||
@@ -879,7 +898,7 @@ var Layout = cc.Class({
|
||||
this._doLayoutGridAxisHorizontal(layoutAnchor, layoutSize);
|
||||
|
||||
}
|
||||
else if(this.startAxis === AxisDirection.VERTICAL) {
|
||||
else if (this.startAxis === AxisDirection.VERTICAL) {
|
||||
this._doLayoutGridAxisVertical(layoutAnchor, layoutSize);
|
||||
}
|
||||
|
||||
@@ -889,13 +908,13 @@ var Layout = cc.Class({
|
||||
var newWidth = 0;
|
||||
var activeChildCount = 0;
|
||||
if (this.resizeMode === ResizeMode.CONTAINER) {
|
||||
children.forEach(function(child) {
|
||||
if(!child.activeInHierarchy) {
|
||||
return;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var child = children[i];
|
||||
if (child.activeInHierarchy) {
|
||||
activeChildCount++;
|
||||
newWidth += child.width * child.scaleX;
|
||||
}
|
||||
activeChildCount++;
|
||||
newWidth += child.width * child.scaleX;
|
||||
});
|
||||
}
|
||||
newWidth += (activeChildCount - 1) * this.spacingX + this.paddingLeft + this.paddingRight;
|
||||
}
|
||||
else {
|
||||
@@ -904,23 +923,23 @@ var Layout = cc.Class({
|
||||
return newWidth;
|
||||
},
|
||||
|
||||
_doLayout: function() {
|
||||
_doLayout: function () {
|
||||
|
||||
if (this.type === Type.HORIZONTAL) {
|
||||
var newWidth = this._getHorizontalBaseWidth(this.node.children);
|
||||
|
||||
var fnPositionY = function(child) {
|
||||
var fnPositionY = function (child) {
|
||||
return child.y;
|
||||
};
|
||||
|
||||
this._doLayoutHorizontally( newWidth, false, fnPositionY, true);
|
||||
this._doLayoutHorizontally(newWidth, false, fnPositionY, true);
|
||||
|
||||
this.node.width = newWidth;
|
||||
}
|
||||
else if (this.type === Type.VERTICAL) {
|
||||
var newHeight = this._getVerticalBaseHeight(this.node.children);
|
||||
|
||||
var fnPositionX = function(child) {
|
||||
var fnPositionX = function (child) {
|
||||
return child.x;
|
||||
};
|
||||
|
||||
@@ -933,7 +952,7 @@ var Layout = cc.Class({
|
||||
this._doLayoutBasic();
|
||||
}
|
||||
}
|
||||
else if(this.type === Type.GRID) {
|
||||
else if (this.type === Type.GRID) {
|
||||
this._doLayoutGrid();
|
||||
}
|
||||
},
|
||||
@@ -951,7 +970,7 @@ var Layout = cc.Class({
|
||||
* layout.updateLayout();
|
||||
* cc.log(childNode.x); // changed
|
||||
*/
|
||||
updateLayout: function() {
|
||||
updateLayout: function () {
|
||||
if (this._layoutDirty && this.node.children.length > 0) {
|
||||
this._doLayout();
|
||||
this._layoutDirty = false;
|
||||
|
||||
@@ -216,7 +216,7 @@ var EditBox = cc.Class({
|
||||
|
||||
/**
|
||||
* !#en The font color of placeholder.
|
||||
* !#zh 输入框最大允许输入的字符个数。
|
||||
* !#zh 输入框占位符的字体颜色。
|
||||
* @property {Color} placeholderFontColor
|
||||
*/
|
||||
placeholderFontColor: {
|
||||
|
||||
@@ -524,7 +524,7 @@ js.mixin(Keyboard.prototype, {
|
||||
* @param {Object} argObj a json object
|
||||
* @returns {EventListener}
|
||||
* @static
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/event-manager/CCEventListener/create.js}
|
||||
* @example {@link cocos2d/core/event-manager/CCEventListener/create.js}
|
||||
*/
|
||||
cc.EventListener.create = function (argObj) {
|
||||
cc.assertID(argObj&&argObj.event, 1900);
|
||||
|
||||
@@ -102,7 +102,7 @@ var __getListenerID = function (event) {
|
||||
*
|
||||
* @class eventManager
|
||||
* @static
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/event-manager/CCEventManager/addListener.js}
|
||||
* @example {@link cocos2d/core/event-manager/CCEventManager/addListener.js}
|
||||
* @deprecated
|
||||
*/
|
||||
var eventManager = {
|
||||
@@ -793,7 +793,7 @@ var eventManager = {
|
||||
* !#zh 移除一个已添加的监听器。
|
||||
* @method removeListener
|
||||
* @param {EventListener} listener - an event listener or a registered node target
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/event-manager/CCEventManager/removeListener.js}
|
||||
* @example {@link cocos2d/core/event-manager/CCEventManager/removeListener.js}
|
||||
*/
|
||||
removeListener: function (listener) {
|
||||
if (listener == null)
|
||||
|
||||
@@ -124,35 +124,35 @@ function checkCircleReference(owner, item, recursiveCall) {
|
||||
|
||||
/**
|
||||
* !#en
|
||||
* LoadingItems is the queue of items which can flow them into the loading pipeline.
|
||||
* Please don't construct it directly, use {{#crossLink "LoadingItems.create"}}LoadingItems.create{{/crossLink}} instead, because we use an internal pool to recycle the queues.
|
||||
* It hold a map of items, each entry in the map is a url to object key value pair.
|
||||
* Each item always contains the following property:
|
||||
* - id: The identification of the item, usually it's identical to url
|
||||
* - url: The url
|
||||
* - type: The type, it's the extension name of the url by default, could be specified manually too.
|
||||
* - error: The error happened in pipeline will be stored in this property.
|
||||
* - content: The content processed by the pipeline, the final result will also be stored in this property.
|
||||
* - complete: The flag indicate whether the item is completed by the pipeline.
|
||||
* - states: An object stores the states of each pipe the item go through, the state can be: Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE
|
||||
*
|
||||
* Item can hold other custom properties.
|
||||
* Each LoadingItems object will be destroyed for recycle after onComplete callback
|
||||
* LoadingItems is the queue of items which can flow them into the loading pipeline.</br>
|
||||
* Please don't construct it directly, use {{#crossLink "LoadingItems.create"}}cc.LoadingItems.create{{/crossLink}} instead, because we use an internal pool to recycle the queues.</br>
|
||||
* It hold a map of items, each entry in the map is a url to object key value pair.</br>
|
||||
* Each item always contains the following property:</br>
|
||||
* - id: The identification of the item, usually it's identical to url</br>
|
||||
* - url: The url </br>
|
||||
* - type: The type, it's the extension name of the url by default, could be specified manually too.</br>
|
||||
* - error: The error happened in pipeline will be stored in this property.</br>
|
||||
* - content: The content processed by the pipeline, the final result will also be stored in this property.</br>
|
||||
* - complete: The flag indicate whether the item is completed by the pipeline.</br>
|
||||
* - states: An object stores the states of each pipe the item go through, the state can be: Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE</br>
|
||||
* </br>
|
||||
* Item can hold other custom properties.</br>
|
||||
* Each LoadingItems object will be destroyed for recycle after onComplete callback</br>
|
||||
* So please don't hold its reference for later usage, you can copy properties in it though.
|
||||
* !#zh
|
||||
* LoadingItems 是一个加载对象队列,可以用来输送加载对象到加载管线中。
|
||||
* 请不要直接使用 new 构造这个类的对象,你可以使用 {{#crossLink "LoadingItems.create"}}LoadingItems.create{{/crossLink}} 来创建一个新的加载队列,这样可以允许我们的内部对象池回收并重利用加载队列。
|
||||
* 它有一个 map 属性用来存放加载项,在 map 对象中已 url 为 key 值。
|
||||
* 每个对象都会包含下列属性:
|
||||
* - id:该对象的标识,通常与 url 相同。
|
||||
* - url:路径
|
||||
* - type: 类型,它这是默认的 URL 的扩展名,可以手动指定赋值。
|
||||
* - error:pipeline 中发生的错误将被保存在这个属性中。
|
||||
* - content: pipeline 中处理的临时结果,最终的结果也将被存储在这个属性中。
|
||||
* - complete:该标志表明该对象是否通过 pipeline 完成。
|
||||
* - states:该对象存储每个管道中对象经历的状态,状态可以是 Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE
|
||||
*
|
||||
* 对象可容纳其他自定义属性。
|
||||
* LoadingItems 是一个加载对象队列,可以用来输送加载对象到加载管线中。</br>
|
||||
* 请不要直接使用 new 构造这个类的对象,你可以使用 {{#crossLink "LoadingItems.create"}}cc.LoadingItems.create{{/crossLink}} 来创建一个新的加载队列,这样可以允许我们的内部对象池回收并重利用加载队列。
|
||||
* 它有一个 map 属性用来存放加载项,在 map 对象中已 url 为 key 值。</br>
|
||||
* 每个对象都会包含下列属性:</br>
|
||||
* - id:该对象的标识,通常与 url 相同。</br>
|
||||
* - url:路径 </br>
|
||||
* - type: 类型,它这是默认的 URL 的扩展名,可以手动指定赋值。</br>
|
||||
* - error:pipeline 中发生的错误将被保存在这个属性中。</br>
|
||||
* - content: pipeline 中处理的临时结果,最终的结果也将被存储在这个属性中。</br>
|
||||
* - complete:该标志表明该对象是否通过 pipeline 完成。</br>
|
||||
* - states:该对象存储每个管道中对象经历的状态,状态可以是 Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE</br>
|
||||
* </br>
|
||||
* 对象可容纳其他自定义属性。</br>
|
||||
* 每个 LoadingItems 对象都会在 onComplete 回调之后被销毁,所以请不要持有它的引用并在结束回调之后依赖它的内容执行任何逻辑,有这种需求的话你可以提前复制它的内容。
|
||||
*
|
||||
* @class LoadingItems
|
||||
@@ -299,7 +299,7 @@ LoadingItems.ItemState = new cc.Enum(ItemState);
|
||||
* @param {Function} onComplete The completion callback, refer to {{#crossLink "LoadingItems.onComplete"}}{{/crossLink}}
|
||||
* @return {LoadingItems} The LoadingItems queue object
|
||||
* @example
|
||||
* LoadingItems.create(cc.loader, ['a.png', 'b.plist'], function (completedCount, totalCount, item) {
|
||||
* cc.LoadingItems.create(cc.loader, ['a.png', 'b.plist'], function (completedCount, totalCount, item) {
|
||||
* var progress = (100 * completedCount / totalCount).toFixed(2);
|
||||
* cc.log(progress + '%');
|
||||
* }, function (errors, items) {
|
||||
|
||||
@@ -44,7 +44,7 @@ MD5Pipe.prototype.handle = function(item) {
|
||||
return item;
|
||||
};
|
||||
|
||||
MD5Pipe.prototype.transformURL = function (url) {
|
||||
MD5Pipe.prototype.transformURL = function (url, hashPatchInFolder = false) {
|
||||
var index = url.indexOf('?');
|
||||
var key = url;
|
||||
if (index !== -1) {
|
||||
@@ -59,13 +59,19 @@ MD5Pipe.prototype.transformURL = function (url) {
|
||||
}
|
||||
let hashValue = this.md5AssetsMap[key];
|
||||
if (hashValue) {
|
||||
var matched = false;
|
||||
url = url.replace(ExtnameRegex, function(match, p1) {
|
||||
matched = true;
|
||||
return '.' + hashValue + p1;
|
||||
});
|
||||
if (!matched) {
|
||||
url = url + '.' + hashValue;
|
||||
if (hashPatchInFolder) {
|
||||
var dirname = cc.path.dirname(url);
|
||||
var basename = cc.path.basename(url);
|
||||
url = `${dirname}.${hashValue}/${basename}`;
|
||||
} else {
|
||||
var matched = false;
|
||||
url = url.replace(ExtnameRegex, (function(match, p1) {
|
||||
matched = true;
|
||||
return "." + hashValue + p1;
|
||||
}));
|
||||
if (!matched) {
|
||||
url = url + "." + hashValue
|
||||
}
|
||||
}
|
||||
}
|
||||
return url;
|
||||
|
||||
@@ -91,13 +91,15 @@ module.exports = {
|
||||
},
|
||||
|
||||
_doPreload (packUuid, packJson) {
|
||||
var unpacker = globalUnpackers[packUuid];
|
||||
if (!unpacker) {
|
||||
unpacker = globalUnpackers[packUuid] = new JsonUnpacker();
|
||||
var unpackerData = globalUnpackers[packUuid];
|
||||
if (!unpackerData) {
|
||||
unpackerData = globalUnpackers[packUuid] = new UnpackerData();
|
||||
unpackerData.state = PackState.Downloading;
|
||||
}
|
||||
if (unpacker.state !== PackState.Loaded) {
|
||||
unpacker.read(packIndices[packUuid], packJson);
|
||||
unpacker.state = PackState.Loaded;
|
||||
if (unpackerData.state !== PackState.Loaded) {
|
||||
unpackerData.unpacker = new Unpackers.JsonUnpacker();
|
||||
unpackerData.unpacker.load(packIndices[packUuid], packJson);
|
||||
unpackerData.state = PackState.Loaded;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ PhysicsContact.prototype.getWorldManifold = function () {
|
||||
* !#en
|
||||
* Get the manifold.
|
||||
* !#zh
|
||||
* 获取世界坐标系下的碰撞信息。
|
||||
* 获取本地(局部)坐标系下的碰撞信息。
|
||||
* @method getManifold
|
||||
* @return {Manifold}
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ var js = require('./js');
|
||||
* @method Enum
|
||||
* @param {object} obj - a JavaScript literal object containing enum names and values, or a TypeScript enum type
|
||||
* @return {object} the defined enum type
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/platform/CCEnum/Enum.js}
|
||||
* @example {@link cocos2d/core/platform/CCEnum/Enum.js}
|
||||
* @typescript Enum<T>(obj: T): T
|
||||
*/
|
||||
function Enum (obj) {
|
||||
|
||||
@@ -354,7 +354,7 @@ js.getset(cc.macro, 'ENABLE_3D', function () {
|
||||
* !#en Key map for keyboard event
|
||||
* !#zh 键盘事件的按键值
|
||||
* @enum KEY
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/platform/CCCommon/KEY.js}
|
||||
* @example {@link cocos2d/core/platform/CCCommon/KEY.js}
|
||||
*/
|
||||
cc.macro.KEY = {
|
||||
/**
|
||||
|
||||
@@ -599,6 +599,15 @@ function initSys () {
|
||||
else if (env.platform === "ios") {
|
||||
sys.os = sys.OS_IOS;
|
||||
}
|
||||
else if (env.platform === 'devtools') {
|
||||
var system = env.system.toLowerCase();
|
||||
if (system.indexOf('android') > -1) {
|
||||
sys.os = sys.OS_ANDROID;
|
||||
}
|
||||
else if (system.indexOf('ios') > -1) {
|
||||
sys.os = sys.OS_IOS;
|
||||
}
|
||||
}
|
||||
|
||||
var version = /[\d\.]+/.exec(env.system);
|
||||
sys.osVersion = version[0];
|
||||
@@ -629,19 +638,29 @@ function initSys () {
|
||||
};
|
||||
}
|
||||
else if (CC_QQPLAY) {
|
||||
var env = window["BK"]["Director"]["queryDeviceInfo"]();
|
||||
sys.isMobile = true;
|
||||
sys.platform = sys.QQ_PLAY;
|
||||
sys.language = sys.LANGUAGE_UNKNOWN;
|
||||
sys.os = sys.OS_UNKNOWN;
|
||||
if (env.platform === "android") {
|
||||
sys.os = sys.OS_ANDROID;
|
||||
}
|
||||
else if (env.platform === "ios") {
|
||||
sys.os = sys.OS_IOS;
|
||||
}
|
||||
else {
|
||||
sys.os = sys.OS_UNKNOWN;
|
||||
}
|
||||
|
||||
sys.osVersion = 0;
|
||||
sys.osMainVersion = 0;
|
||||
var version = /[\d\.]+/.exec(env.version);
|
||||
sys.osVersion = version[0];
|
||||
sys.osMainVersion = parseInt(sys.osVersion.split('.')[0]);
|
||||
sys.browserType = sys.BROWSER_TYPE_QQ_PLAY;
|
||||
sys.browserVersion = 0;
|
||||
|
||||
var w = 960;
|
||||
var h = 640;
|
||||
var ratio = 1;
|
||||
var w = env.screenWidth;
|
||||
var h = env.screenHeight;
|
||||
var ratio = env.pixelRatio || 1;
|
||||
|
||||
sys.windowPixelResolution = {
|
||||
width: ratio * w,
|
||||
|
||||
@@ -69,7 +69,7 @@ cc.url = {
|
||||
* @method raw
|
||||
* @param {String} url
|
||||
* @return {String}
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/platform/url/raw.js}
|
||||
* @example {@link cocos2d/core/platform/url/raw.js}
|
||||
*/
|
||||
raw: function (url) {
|
||||
if (CC_EDITOR && !this._rawAssets) {
|
||||
@@ -103,7 +103,7 @@ cc.url = {
|
||||
* @method builtinRaw
|
||||
* @param {String} url
|
||||
* @return {String}
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/platform/url/builtinRaw.js}
|
||||
* @example {@link cocos2d/core/platform/url/builtinRaw.js}
|
||||
*/
|
||||
builtinRaw: CC_EDITOR && function (url) {
|
||||
if ( !this._builtinRawAssets ) {
|
||||
|
||||
@@ -41,7 +41,7 @@ cc.path = /** @lends cc.path# */{
|
||||
* !#en Join strings to be a path.
|
||||
* !#zh 拼接字符串为 Path
|
||||
* @method join
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/utils/CCPath/join.js}
|
||||
* @example {@link cocos2d/core/utils/CCPath/join.js}
|
||||
* @returns {String}
|
||||
*/
|
||||
join: function () {
|
||||
@@ -57,7 +57,7 @@ cc.path = /** @lends cc.path# */{
|
||||
* !#en Get the ext name of a path including '.', like '.png'.
|
||||
* !#zh 返回 Path 的扩展名,包括 '.',例如 '.png'。
|
||||
* @method extname
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/utils/CCPath/extname.js}
|
||||
* @example {@link cocos2d/core/utils/CCPath/extname.js}
|
||||
* @param {String} pathStr
|
||||
* @returns {*}
|
||||
*/
|
||||
@@ -87,7 +87,7 @@ cc.path = /** @lends cc.path# */{
|
||||
* !#en Get the file name of a file path.
|
||||
* !#zh 获取文件路径的文件名。
|
||||
* @method basename
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/utils/CCPath/basename.js}
|
||||
* @example {@link cocos2d/core/utils/CCPath/basename.js}
|
||||
* @param {String} pathStr
|
||||
* @param {String} [extname]
|
||||
* @returns {*}
|
||||
@@ -108,7 +108,7 @@ cc.path = /** @lends cc.path# */{
|
||||
* !#en Get dirname of a file path.
|
||||
* !#zh 获取文件路径的目录名。
|
||||
* @method dirname
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/utils/CCPath/dirname.js}
|
||||
* @example {@link cocos2d/core/utils/CCPath/dirname.js}
|
||||
* @param {String} pathStr
|
||||
* @returns {*}
|
||||
*/
|
||||
@@ -121,7 +121,7 @@ cc.path = /** @lends cc.path# */{
|
||||
* !#en Change extname of a file path.
|
||||
* !#zh 更改文件路径的扩展名。
|
||||
* @method changeExtname
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/utils/CCPath/changeExtname.js}
|
||||
* @example {@link cocos2d/core/utils/CCPath/changeExtname.js}
|
||||
* @param {String} pathStr
|
||||
* @param {String} [extname]
|
||||
* @returns {String}
|
||||
@@ -141,7 +141,7 @@ cc.path = /** @lends cc.path# */{
|
||||
/**
|
||||
* !#en Change file name of a file path.
|
||||
* !#zh 更改文件路径的文件名。
|
||||
* @example {@link utils/api/engine/docs/cocos2d/core/utils/CCPath/changeBasename.js}
|
||||
* @example {@link cocos2d/core/utils/CCPath/changeBasename.js}
|
||||
* @param {String} pathStr
|
||||
* @param {String} basename
|
||||
* @param {Boolean} [isSameExt]
|
||||
|
||||
@@ -669,6 +669,7 @@ cc.TMXMapInfo.prototype = {
|
||||
|
||||
var image = selTileset.getElementsByTagName('image')[0];
|
||||
var imagename = image.getAttribute('source');
|
||||
imagename.replace(/\\/g, '\/');
|
||||
tileset.sourceImage = this._textures[imagename];
|
||||
if (!tileset.sourceImage) {
|
||||
cc.errorID(7221, imagename);
|
||||
|
||||
@@ -42,6 +42,7 @@ function searchDependFiles(tmxFile, tmxFileData, cb) {
|
||||
|
||||
var textures = [];
|
||||
var tsxFiles = [];
|
||||
var textureNames = [];
|
||||
function parseTilesetImages(tilesetNode, sourcePath) {
|
||||
var images = tilesetNode.getElementsByTagName('image');
|
||||
for (var i = 0, n = images.length; i < n ; i++) {
|
||||
@@ -49,6 +50,9 @@ function searchDependFiles(tmxFile, tmxFileData, cb) {
|
||||
if (imageCfg) {
|
||||
var imgPath = Path.join(Path.dirname(sourcePath), imageCfg);
|
||||
textures.push(imgPath);
|
||||
let textureName = Path.relative(Path.dirname(sourcePath), imgPath);
|
||||
textureName = textureName.replace(/\\/g, '\/');
|
||||
textureNames.push(textureName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +81,7 @@ function searchDependFiles(tmxFile, tmxFileData, cb) {
|
||||
parseTilesetImages(tileset, tmxFile);
|
||||
}
|
||||
|
||||
cb(null, { textures: textures, tsxFiles: tsxFiles });
|
||||
cb(null, { textures, tsxFiles, textureNames });
|
||||
}
|
||||
|
||||
const AssetRootUrl = 'db://assets/';
|
||||
@@ -88,9 +92,10 @@ class TiledMapMeta extends CustomAssetMeta {
|
||||
this._tmxData = '';
|
||||
this._textures = [];
|
||||
this._tsxFiles = [];
|
||||
this._textureNames = [];
|
||||
}
|
||||
|
||||
static version () { return '2.0.0'; }
|
||||
static version () { return '2.0.1'; }
|
||||
static defaultType() { return 'tiled-map'; }
|
||||
|
||||
import (fspath, cb) {
|
||||
@@ -107,6 +112,7 @@ class TiledMapMeta extends CustomAssetMeta {
|
||||
|
||||
this._textures = info.textures;
|
||||
this._tsxFiles = info.tsxFiles;
|
||||
this._textureNames = info.textureNames;
|
||||
|
||||
cb();
|
||||
});
|
||||
@@ -122,7 +128,7 @@ class TiledMapMeta extends CustomAssetMeta {
|
||||
var uuid = db.fspathToUuid(p);
|
||||
return uuid ? Editor.serialize.asAsset(uuid) : null;
|
||||
});
|
||||
asset.textureNames = this._textures.map(p => Path.basename(p));
|
||||
asset.textureNames = this._textureNames;
|
||||
asset.tsxFiles = this._tsxFiles.map(p => {
|
||||
var tsxPath = Path.join(Path.dirname(fspath), p);
|
||||
var uuid = db.fspathToUuid(tsxPath);
|
||||
|
||||
@@ -288,16 +288,17 @@ let VideoPlayer = cc.Class({
|
||||
},
|
||||
|
||||
_updateVideoSource () {
|
||||
let impl = this._impl;
|
||||
let url = '';
|
||||
if (this.resourceType === ResourceType.REMOTE) {
|
||||
if (cc.loader.md5Pipe) {
|
||||
this.remoteURL = cc.loader.md5Pipe.transformURL(this.remoteURL);
|
||||
}
|
||||
impl.setURL(this.remoteURL);
|
||||
url = this.remoteURL;
|
||||
}
|
||||
else {
|
||||
impl.setURL(this._clip.nativeUrl || '');
|
||||
else if (this._clip) {
|
||||
url = this._clip.nativeUrl || '';
|
||||
}
|
||||
if (url && cc.loader.md5Pipe) {
|
||||
url = cc.loader.md5Pipe.transformURL(url);
|
||||
}
|
||||
this._impl.setURL(url);
|
||||
},
|
||||
|
||||
onLoad () {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
[
|
||||
"./index.js",
|
||||
"./predefine.js",
|
||||
"./CCDebugger.js",
|
||||
"./CCBoot.js",
|
||||
"./extensions/ccpool/*.js",
|
||||
"./extensions/spine/*.js",
|
||||
"./cocos2d/core/load-pipeline/*.js",
|
||||
"!./cocos2d/core/load-pipeline/asset-table.js",
|
||||
"./cocos2d/core/CCNode.js",
|
||||
"./cocos2d/core/CCActionManager.js",
|
||||
"./cocos2d/core/CCScene.js",
|
||||
"./cocos2d/core/CCGame.js",
|
||||
"./cocos2d/core/CCDirector.js",
|
||||
"./cocos2d/core/CCScheduler.js",
|
||||
"./cocos2d/core/sprites/CCSpriteFrame.js",
|
||||
"./cocos2d/core/utils/find.js",
|
||||
"./cocos2d/core/utils/base-node.js",
|
||||
"./cocos2d/animation/bezier.js",
|
||||
"./cocos2d/animation/types.js",
|
||||
"./cocos2d/animation/animation-clip.js",
|
||||
"./cocos2d/animation/animators.js",
|
||||
"./cocos2d/animation/animation-manager.js",
|
||||
"./cocos2d/animation/animation-state.js",
|
||||
"./cocos2d/animation/animation-animator.js",
|
||||
"./cocos2d/animation/playable.js",
|
||||
"./cocos2d/core/platform/**.*",
|
||||
"!./cocos2d/core/platform/_CCClass.js",
|
||||
"!./cocos2d/core/platform/CCAssetLibrary.js",
|
||||
"!./cocos2d/core/platform/CCSAXParser.js",
|
||||
"!./cocos2d/core/platform/load-manager.js",
|
||||
"!./cocos2d/core/platform/prefab-helper.js",
|
||||
"!./cocos2d/core/platform/preprocess-attrs.js",
|
||||
"!./cocos2d/core/platform/requiring-frame.js",
|
||||
"!./cocos2d/core/platform/utils.js",
|
||||
"!./cocos2d/core/platform/id-generater.js",
|
||||
"./cocos2d/core/value-types/**/*",
|
||||
"./cocos2d/core/event/**/*",
|
||||
"./cocos2d/core/assets/**/*",
|
||||
"./cocos2d/core/components/**/*",
|
||||
"./cocos2d/core/support/**/*",
|
||||
"!./cocos2d/core/support/TransformUtils.js",
|
||||
"./cocos2d/core/event-manager/**/*",
|
||||
"./cocos2d/core/textures/**/*",
|
||||
"./cocos2d/actions/**/*",
|
||||
"!./cocos2d/actions/CCActionCamera.js",
|
||||
"!./cocos2d/actions/CCActionTween.js",
|
||||
"./cocos2d/audio/*",
|
||||
"./cocos2d/particle/CCParticleSystem.js",
|
||||
"./cocos2d/tilemap/CCTiledMap.js",
|
||||
"./cocos2d/tilemap/CCTiledLayer.js",
|
||||
"./cocos2d/tilemap/CCSGTMXObject.js",
|
||||
"./cocos2d/tilemap/CCTiledObjectGroup.js",
|
||||
"./cocos2d/tilemap/CCTiledMapAsset.js",
|
||||
"./cocos2d/motion-streak/CCMotionStreak.js",
|
||||
"./cocos2d/core/collider/**/*",
|
||||
"./cocos2d/core/graphics/**/*",
|
||||
"./extensions/anysdk/*",
|
||||
"./extensions/dragonbones/*.js",
|
||||
"./cocos2d/core/physics/**/*",
|
||||
"./cocos2d/core/camera/CCCamera.js"
|
||||
]
|
||||
+6
-3
@@ -113,7 +113,7 @@ cc.Audio = function (src) {
|
||||
var path;
|
||||
if (typeof clip === 'string') {
|
||||
// backward compatibility since 1.10
|
||||
cc.warnID(8401, 'cc.audioEngine');
|
||||
cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
|
||||
path = clip;
|
||||
}
|
||||
else {
|
||||
@@ -122,7 +122,10 @@ cc.Audio = function (src) {
|
||||
}
|
||||
path = clip._nativeAsset;
|
||||
}
|
||||
path = cc.loader.md5Pipe ? cc.loader.md5Pipe.transformURL(path) : path;
|
||||
var md5Pipe = cc.loader.md5Pipe;
|
||||
if (md5Pipe) {
|
||||
path = md5Pipe.transformURL(path);
|
||||
}
|
||||
return audioEngine.play2d(path, loop, volume);
|
||||
};
|
||||
audioEngine.playMusic = function (clip, loop) {
|
||||
@@ -203,7 +206,7 @@ cc.Audio = function (src) {
|
||||
var path;
|
||||
if (typeof clip === 'string') {
|
||||
// backward compatibility since 1.10
|
||||
cc.warnID(8401, 'cc.audioEngine');
|
||||
cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
|
||||
path = clip;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
"name": "ParticleSystem",
|
||||
"entries": [
|
||||
"./cocos2d/particle/index.js",
|
||||
"./cocos2d/core/platform/CCSAXParser.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+2
-2
@@ -132,8 +132,8 @@ defineMacro('CC_DEV', true); // (CC_EDITOR && !CC_BUILD) || CC_PREVIEW || CC_
|
||||
defineMacro('CC_DEBUG', true); // CC_DEV || Debug Build
|
||||
defineMacro('CC_JSB', defined('jsb'));
|
||||
defineMacro('CC_BUILD', false);
|
||||
defineMacro('CC_WECHATGAME', false);
|
||||
defineMacro('CC_QQPLAY', false);
|
||||
defineMacro('CC_WECHATGAME', defined('wx') && wx.getSystemInfoSync);
|
||||
defineMacro('CC_QQPLAY', defined('bk'));
|
||||
if (CC_JSB) {
|
||||
defineMacro('CC_SUPPORT_JIT', true); //FIXME: cjh close it since safety issues.
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user