Merge pull request #2928 from pandamicro/next

Merge master into next (subpackage support)
This commit is contained in:
pandamicro
2018-07-02 10:34:49 +08:00
committed by GitHub
7 changed files with 60 additions and 33 deletions
@@ -183,7 +183,10 @@ let EditBoxImpl = cc.Class({
textTransform = 'capitalize';
}
this._edTxt.style.textTransform = textTransform;
if (this._edTxt) {
this._edTxt.style.textTransform = textTransform;
this._edTxt.value = this._text;
}
},
setReturnType (returnType) {
@@ -256,7 +259,7 @@ let EditBoxImpl = cc.Class({
if (cc.sys.isMobile && !this._editing) {
// Pre adaptation and
this._beginEditingOnMobile(this._editBox);
this._beginEditingOnMobile();
}
this._editing = true;
},
+32
View File
@@ -286,6 +286,8 @@ var Downloader = function (extMap) {
this._curConcurrent = 0;
this._loadQueue = [];
this._subpackages = {};
this.extMap = js.mixin(extMap, defaultMap);
};
Downloader.ID = ID;
@@ -349,4 +351,34 @@ Downloader.prototype.handle = function (item, callback) {
}
};
/**
* !#en
* Load subpackage with name.
* !#zh
* 通过子包名加载子包代码。
* @method loadSubpackage
* @param {String} name - Subpackage name
* @param {Function} [completeCallback] - Callback invoked when subpackage loaded
* @param {Error} completeCallback.error - error information
*/
Downloader.prototype.loadSubpackage = function (name, completeCallback) {
let pac = this._subpackages[name];
if (pac) {
if (pac.loaded) {
if (completeCallback) completeCallback();
}
else {
downloadScript({url: pac.path}, function (err) {
if (!err) {
pac.loaded = true;
}
if (completeCallback) completeCallback(err);
});
}
}
else if (completeCallback) {
completeCallback(new Error(`Can't find subpackage ${name}`));
}
};
Pipeline.Downloader = module.exports = Downloader;
+1 -3
View File
@@ -604,6 +604,4 @@ let inputManager = {
}
};
_cc.inputManager = inputManager;
module.exports = inputManager;
module.exports = _cc.inputManager = inputManager;
+2 -2
View File
@@ -84,7 +84,7 @@ cc.screen = /** @lends cc.screen# */{
var i, l, val, map = this._fnMap, valL;
for (i = 0, l = map.length; i < l; i++) {
val = map[i];
if (val && val[1] in document) {
if (val && (typeof document[val[1]] !== 'undefined')) {
for (i = 0, valL = val.length; i < valL; i++) {
this._fn[map[0][i]] = val[i];
}
@@ -102,7 +102,7 @@ cc.screen = /** @lends cc.screen# */{
* @returns {Boolean}
*/
fullScreen: function () {
if(!this._supportsFullScreen) return false;
if(!this._supportsFullScreen) return false;
else if( document[this._fn.fullscreenElement] === undefined || document[this._fn.fullscreenElement] === null )
return false;
else
+1
View File
@@ -199,6 +199,7 @@ misc.clamp01 = function (value) {
* @param {Number} a number A
* @param {Number} b number B
* @param {Number} r ratio between 0 and 1
* @return {Number}
* @example {@link utils/api/engine/docs/cocos2d/core/platform/CCMacro/lerp.js}
*/
misc.lerp = function (a, b, r) {
+2 -2
View File
@@ -328,7 +328,7 @@ proto.scale = function (vector, out) {
* !#en Divides by a number. If you want to save result to another vector, use div() instead.
* !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
* @method divSelf
* @param {Vec2} vector
* @param {Vec2} divisor
* @return {Vec2} returns this
* @chainable
* @example
@@ -345,7 +345,7 @@ proto.divSelf = function (num) {
* !#en Divides by a number, and returns the new result.
* !#zh 向量除法,并返回新的结果。
* @method div
* @param {Vec2} vector
* @param {Vec2} divisor
* @param {Vec2} [out] - optional, the receiving vector
* @return {Vec2} the result
* @example
+17 -24
View File
@@ -102,32 +102,25 @@ var DragonBonesAsset = cc.Class({
}
}
else {
if (CC_JSB) {
// The 'factory' create a new one every time in JSB, they can't use getDragonBonesData
// to get cached data, and don't need to merge armatures.
this._dragonBonesData = factory.parseDragonBonesData(this._dragonBonesJson);
let _dragonBonesJson = JSON.parse(this.dragonBonesJson);
let sameNamedDragonBonesData = factory.getDragonBonesData(_dragonBonesJson.name);
if (sameNamedDragonBonesData) {
// already added asset, see #2002
let dragonBonesData;
for (let i = 0; i < _dragonBonesJson.armature.length; i++) {
let armatureName = _dragonBonesJson.armature[i].name;
if (!sameNamedDragonBonesData.armatures[armatureName]) {
// add new armature
if (!dragonBonesData) {
dragonBonesData = factory._dataParser.parseDragonBonesData(_dragonBonesJson);
}
sameNamedDragonBonesData.addArmature(dragonBonesData.armatures[armatureName]);
}
}
this._dragonBonesData = sameNamedDragonBonesData;
}
else {
let jsonObj = JSON.parse(this._dragonBonesJson);
let sameNamedDragonBonesData = factory.getDragonBonesData(jsonObj.name);
if (sameNamedDragonBonesData) {
// already added asset, see #2002
let dragonBonesData;
for (let i = 0; i < jsonObj.armature.length; i++) {
let armatureName = jsonObj.armature[i].name;
if (!sameNamedDragonBonesData.armatures[armatureName]) {
// add new armature
if (!dragonBonesData) {
dragonBonesData = factory._dataParser.parseDragonBonesData(jsonObj);
}
sameNamedDragonBonesData.addArmature(dragonBonesData.armatures[armatureName]);
}
}
this._dragonBonesData = sameNamedDragonBonesData;
}
else {
this._dragonBonesData = factory.parseDragonBonesData(jsonObj);
}
this._dragonBonesData = factory.parseDragonBonesData(_dragonBonesJson);
}
}
},