Merge pull request #2411 from pandamicro/next

Fix wechat game HTMLVideoElement issue and deserialize issue
This commit is contained in:
pandamicro
2018-03-08 11:49:30 +08:00
committed by GitHub
2 changed files with 21 additions and 5 deletions
+17 -5
View File
@@ -551,7 +551,7 @@ var _Deserializer = (function () {
}
else {
var defaultType = typeof defaultValue;
isPrimitiveType = (defaultType === 'string' && !attrs[propName + SAVE_URL_AS_ASSET]) ||
isPrimitiveType = (defaultType === 'string' && !stillUseUrl) ||
defaultType === 'number' ||
defaultType === 'boolean';
}
@@ -580,6 +580,7 @@ var _Deserializer = (function () {
}
return Function('s', 'o', 'd', 'k', 't', sources.join(''));
} : function (self, klass) {
var TYPE = Attr.DELIMETER + 'type';
var EDITOR_ONLY = Attr.DELIMETER + 'editorOnly';
var SERIALIZABLE = Attr.DELIMETER + 'serializable';
var DEFAULT = Attr.DELIMETER + 'default';
@@ -616,10 +617,21 @@ var _Deserializer = (function () {
// function undefined object(null) string boolean number
var defaultValue = CCClass.getDefault(attrs[propName + DEFAULT]);
if (fastMode) {
var defaultType = typeof defaultValue;
var isPrimitiveType = (defaultType === 'string' && !stillUseUrl) ||
defaultType === 'number' ||
defaultType === 'boolean';
var isPrimitiveType;
var userType = attrs[propName + TYPE];
if (defaultValue === undefined && userType) {
isPrimitiveType = userType === cc.String ||
userType === cc.Integer ||
userType === cc.Float ||
userType === cc.Boolean;
}
else {
var defaultType = typeof defaultValue;
isPrimitiveType = (defaultType === 'string' && !stillUseUrl) ||
defaultType === 'number' ||
defaultType === 'boolean';
}
if (isPrimitiveType) {
o[propName] = prop;
}
+4
View File
@@ -164,6 +164,10 @@ require('./polyfill/array');
if (!(CC_EDITOR && Editor.isMainProcess)) {
require('./polyfill/typescript');
}
// empty polyfill HTMLVideoElement
if (CC_WECHATGAME) {
_global.HTMLVideoElement = function () {};
}
require('./cocos2d/core/predefine');