mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Merge branch 'v1.6' of github.com:cocos-creator/engine into v1.6
This commit is contained in:
@@ -878,9 +878,11 @@ cc.Director = Class.extend(/** @lends cc.Director# */{
|
||||
|
||||
/**
|
||||
* !#en
|
||||
* set color for clear screen.<br/>
|
||||
* Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js
|
||||
* !#zh 设置场景的默认擦除颜色(支持白色全透明,但不支持透明度为中间值)。
|
||||
* Set color for clear screen.<br/>
|
||||
* (Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js)
|
||||
* !#zh
|
||||
* 设置场景的默认擦除颜色。<br/>
|
||||
* 支持全透明,但不支持透明度为中间值。要支持全透明需手工开启 cc.macro.ENABLE_TRANSPARENT_CANVAS。
|
||||
* @method setClearColor
|
||||
* @param {Color} clearColor
|
||||
*/
|
||||
|
||||
@@ -489,16 +489,12 @@ var Label = cc.Class({
|
||||
__preload: function () {
|
||||
this._super();
|
||||
|
||||
var sgSizeInitialized = this._sgNode._isUseSystemFont;
|
||||
if (sgSizeInitialized) {
|
||||
this._updateNodeSize();
|
||||
}
|
||||
|
||||
// node should be resize whenever font changed, needed only on web
|
||||
if (!CC_JSB) {
|
||||
this._sgNode.on('load', this._updateNodeSize, this);
|
||||
}
|
||||
|
||||
this._updateNodeSize();
|
||||
},
|
||||
|
||||
_createSgNode: function () {
|
||||
|
||||
@@ -402,7 +402,9 @@ var Layout = cc.Class({
|
||||
this._N$padding = 0;
|
||||
},
|
||||
|
||||
__preload: function() {
|
||||
onEnable: function() {
|
||||
this._addEventListeners();
|
||||
|
||||
if(cc.sizeEqualToSize(this.node.getContentSize(), cc.size(0, 0))) {
|
||||
this.node.setContentSize(this._layoutSize);
|
||||
}
|
||||
@@ -411,23 +413,40 @@ var Layout = cc.Class({
|
||||
this._migratePaddingData();
|
||||
}
|
||||
|
||||
this.node.on('size-changed', this._resized, this);
|
||||
this._doLayoutDirty();
|
||||
},
|
||||
|
||||
onDisable: function () {
|
||||
this._removeEventListeners();
|
||||
},
|
||||
|
||||
_doLayoutDirty : function () {
|
||||
this._layoutDirty = true;
|
||||
},
|
||||
|
||||
_addEventListeners: function () {
|
||||
cc.director.on(cc.Director.EVENT_BEFORE_VISIT, this._updateLayout, this);
|
||||
this.node.on('size-changed', this._resized, this);
|
||||
this.node.on('anchor-changed', this._doLayoutDirty, this);
|
||||
this.node.on('child-added', this._childAdded, this);
|
||||
this.node.on('child-removed', this._childRemoved, this);
|
||||
this.node.on('child-reorder', this._doLayoutDirty, this);
|
||||
|
||||
this._updateChildrenEventListener();
|
||||
this._addChildrenEventListeners();
|
||||
},
|
||||
|
||||
_doLayoutDirty : function() {
|
||||
this._layoutDirty = true;
|
||||
_removeEventListeners: function () {
|
||||
cc.director.off(cc.Director.EVENT_BEFORE_VISIT, this._updateLayout, this);
|
||||
this.node.off('size-changed', this._resized, this);
|
||||
this.node.off('anchor-changed', this._doLayoutDirty, this);
|
||||
this.node.off('child-added', this._childAdded, this);
|
||||
this.node.off('child-removed', this._childRemoved, this);
|
||||
this.node.off('child-reorder', this._doLayoutDirty, this);
|
||||
this._removeChildrenEventListeners();
|
||||
},
|
||||
|
||||
_updateChildrenEventListener: function() {
|
||||
_addChildrenEventListeners: function() {
|
||||
var children = this.node.children;
|
||||
children.forEach(function(child) {
|
||||
children.forEach(function (child) {
|
||||
child.on('size-changed', this._doLayoutDirty, this);
|
||||
child.on('position-changed', this._doLayoutDirty, this);
|
||||
child.on('anchor-changed', this._doLayoutDirty, this);
|
||||
@@ -435,6 +454,16 @@ var Layout = cc.Class({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
_removeChildrenEventListeners: function () {
|
||||
var children = this.node.children;
|
||||
children.forEach(function (child) {
|
||||
child.off('size-changed', this._doLayoutDirty, this);
|
||||
child.off('position-changed', this._doLayoutDirty, this);
|
||||
child.off('anchor-changed', this._doLayoutDirty, this);
|
||||
child.off('active-in-hierarchy-changed', this._doLayoutDirty, this);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
_childAdded: function(event) {
|
||||
var child = event.detail;
|
||||
child.on('size-changed', this._doLayoutDirty, this);
|
||||
@@ -894,14 +923,6 @@ var Layout = cc.Class({
|
||||
}
|
||||
},
|
||||
|
||||
onEnable: function () {
|
||||
cc.director.on(cc.Director.EVENT_BEFORE_VISIT, this._updateLayout, this);
|
||||
},
|
||||
|
||||
onDisable: function () {
|
||||
cc.director.off(cc.Director.EVENT_BEFORE_VISIT, this._updateLayout, this);
|
||||
},
|
||||
|
||||
_updateLayout: function() {
|
||||
if (this._layoutDirty && this.node.children.length > 0) {
|
||||
this._doLayout();
|
||||
|
||||
@@ -505,23 +505,38 @@ var RichText = cc.Class({
|
||||
|
||||
var spriteRect = spriteFrame.getRect();
|
||||
var scaleFactor = 1;
|
||||
if(spriteRect.height > this.lineHeight) {
|
||||
scaleFactor = this.lineHeight / spriteRect.height;
|
||||
var spriteWidth = spriteRect.width;
|
||||
var spriteHeight = spriteRect.height;
|
||||
var expectWidth = richTextElement.style.imageWidth;
|
||||
var expectHeight = richTextElement.style.imageHeight;
|
||||
|
||||
//follow the original rule, expectHeight must less then lineHeight
|
||||
if(expectHeight > 0 && expectHeight < this.lineHeight ) {
|
||||
scaleFactor = expectHeight / spriteHeight;
|
||||
spriteWidth = spriteWidth * scaleFactor;
|
||||
spriteHeight = spriteHeight * scaleFactor;
|
||||
} else {
|
||||
scaleFactor = this.lineHeight / spriteHeight;
|
||||
spriteWidth = spriteWidth * scaleFactor;
|
||||
spriteHeight = spriteHeight * scaleFactor;
|
||||
}
|
||||
|
||||
if(expectWidth > 0) spriteWidth = expectWidth;
|
||||
|
||||
if(this.maxWidth > 0) {
|
||||
if(this._lineOffsetX + spriteRect.width * scaleFactor > this.maxWidth) {
|
||||
if(this._lineOffsetX + spriteWidth > this.maxWidth) {
|
||||
this._updateLineInfo();
|
||||
}
|
||||
this._lineOffsetX += spriteRect.width * scaleFactor;
|
||||
this._lineOffsetX += spriteWidth;
|
||||
|
||||
} else {
|
||||
this._lineOffsetX += spriteRect.width * scaleFactor;
|
||||
this._lineOffsetX += spriteWidth;
|
||||
if(this._lineOffsetX > this._labelWidth) {
|
||||
this._labelWidth = this._lineOffsetX;
|
||||
}
|
||||
}
|
||||
this._applySpriteFrame(spriteFrame);
|
||||
sprite.setContentSize(spriteRect.width * scaleFactor, spriteRect.height * scaleFactor);
|
||||
sprite.setContentSize(spriteWidth, spriteHeight);
|
||||
sprite._lineCount = this._lineCount;
|
||||
|
||||
if(richTextElement.style.event) {
|
||||
|
||||
@@ -151,7 +151,39 @@ var WebView = cc.Class({
|
||||
_onWebViewLoadError: function () {
|
||||
cc.Component.EventHandler.emitEvents(this.webviewEvents, this, EventType.ERROR);
|
||||
this.node.emit('error', this);
|
||||
},
|
||||
|
||||
/**
|
||||
* !#en
|
||||
* Set javascript interface scheme.
|
||||
* Note: only available on Android and iOS at the moment.
|
||||
* !#zh
|
||||
* 设置 javascript 接口方案。
|
||||
* 注意:目前只能在 Android 和 iOS 上使用。
|
||||
* @method setJavascriptInterfaceScheme
|
||||
* @param {String} scheme
|
||||
*/
|
||||
setJavascriptInterfaceScheme: function (scheme) {
|
||||
if (this._sgNode) {
|
||||
this._sgNode.setJavascriptInterfaceScheme(scheme);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* !#en
|
||||
* This callback called when load URL that start with javascript interface scheme.
|
||||
* Note: only available on Android and iOS at the moment.
|
||||
* !#zh
|
||||
* 当加载 URL 以 JavaScript 接口方案开始时调用这个回调函数。
|
||||
* 注意:目前只能在 Android 和 iOS 上使用。
|
||||
* @method setOnJSCallback
|
||||
* @param {Function} callback
|
||||
*/
|
||||
setOnJSCallback: function (callback) {
|
||||
if (this._sgNode) {
|
||||
this._sgNode.setOnJSCallback(callback);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
cc.WebView = module.exports = WebView;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
var eventRegx = /^(click)(\s)*=/;
|
||||
var imageAttrReg = /(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=/;
|
||||
/**
|
||||
* A utils class for parsing HTML texts. The parsed results will be an object array.
|
||||
*/
|
||||
@@ -123,38 +124,46 @@ cc.HtmlTextParser.prototype = {
|
||||
if(header && header[0].length > 0) {
|
||||
tagName = header[0].trim();
|
||||
if(tagName.startsWith("img") && tagName[tagName.length-1] === "/") {
|
||||
var srcBegin = tagName.indexOf('=');
|
||||
var remainingArgument = tagName.substring(srcBegin+1).trim();
|
||||
var imageSrc;
|
||||
var endQuotIndex = -1;
|
||||
header = attribute.match(imageAttrReg);
|
||||
var tagValue;
|
||||
var remainingArgument;
|
||||
var isValidImageTag = false;
|
||||
switch(remainingArgument[0]){
|
||||
case "'":
|
||||
endQuotIndex = remainingArgument.indexOf("'", 1);
|
||||
if(endQuotIndex > -1) {
|
||||
imageSrc = remainingArgument.substring(1, endQuotIndex);
|
||||
isValidImageTag = true;
|
||||
}
|
||||
break;
|
||||
case "\"":
|
||||
endQuotIndex = remainingArgument.indexOf("\"", 1);
|
||||
if(endQuotIndex > -1) {
|
||||
imageSrc = remainingArgument.substring(1, endQuotIndex);
|
||||
isValidImageTag = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//invalid tag
|
||||
break;
|
||||
}
|
||||
if(isValidImageTag) {
|
||||
obj.isImage = true;
|
||||
obj.src = imageSrc;
|
||||
eventHanlderString = remainingArgument.substring(endQuotIndex+1).trim();
|
||||
if(eventHanlderString.match(eventRegx)){
|
||||
eventObj = this._processEventHandler(eventHanlderString);
|
||||
obj.event = eventObj;
|
||||
while (header) {
|
||||
//skip the invalid tags at first
|
||||
attribute = attribute.substring(attribute.indexOf(header[0]));
|
||||
tagName = attribute.substr(0, header[0].length);
|
||||
//remove space and = character
|
||||
remainingArgument = attribute.substring(tagName.length).trim();
|
||||
nextSpace = remainingArgument.indexOf(' ');
|
||||
|
||||
tagValue = (nextSpace > -1) ? remainingArgument.substr(0, nextSpace) : remainingArgument;
|
||||
tagName = tagName.replace(/[^a-zA-Z]/g, "").trim();
|
||||
tagName = tagName.toLocaleLowerCase();
|
||||
|
||||
attribute = remainingArgument.substring(nextSpace).trim();
|
||||
if (tagName === "src") {
|
||||
obj.isImage = true
|
||||
if( tagValue.endsWith( '\/' ) ) tagValue = tagValue.substring( 0, tagValue.length - 1 );
|
||||
if( tagValue.indexOf('\'')===0 ) {
|
||||
isValidImageTag = true;
|
||||
tagValue = tagValue.substring( 1, tagValue.length - 1 );
|
||||
} else if( tagValue.indexOf('"')===0 ) {
|
||||
isValidImageTag = true;
|
||||
tagValue = tagValue.substring( 1, tagValue.length - 1 );
|
||||
}
|
||||
obj.src = tagValue;
|
||||
} else if (tagName === "height") {
|
||||
obj.imageHeight = parseInt(tagValue);
|
||||
} else if (tagName === "width") {
|
||||
obj.imageWidth = parseInt(tagValue);
|
||||
} else if (tagName === "click") {
|
||||
obj.event = this._processEventHandler(tagName + "=" + tagValue);
|
||||
}
|
||||
header = attribute.match(imageAttrReg);
|
||||
}
|
||||
|
||||
if( isValidImageTag && obj.isImage )
|
||||
{
|
||||
this._resultObjectArray.push({text: "", style: obj});
|
||||
}
|
||||
|
||||
|
||||
@@ -1307,7 +1307,6 @@ _ccsg.Label.pool.get = function (string, fontAsset) {
|
||||
label.enableBold(false);
|
||||
label.enableItalics(false);
|
||||
label.enableUnderline(false);
|
||||
label.setBlendFunc(cc.macro.SRC_ALPHA, cc.macro.ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -582,8 +582,11 @@ var _Deserializer = (function () {
|
||||
}
|
||||
|
||||
function _deserializeFireClass (self, obj, serialized, klass, target) {
|
||||
var deserialize = klass.__deserialize__;
|
||||
if (!deserialize) {
|
||||
var deserialize;
|
||||
if (klass.hasOwnProperty('__deserialize__')) {
|
||||
deserialize = klass.__deserialize__;
|
||||
}
|
||||
else {
|
||||
deserialize = compileDeserialize(self, klass);
|
||||
// if (CC_TEST && !isPhantomJS) {
|
||||
// cc.log(deserialize);
|
||||
|
||||
@@ -34,6 +34,7 @@ _ccsg.WebView = _ccsg.Node.extend(/** @lends _ccsg.WebView# */{
|
||||
}
|
||||
},
|
||||
|
||||
setOnJSCallback: function(callback){},
|
||||
setJavascriptInterfaceScheme: function(scheme){},
|
||||
loadData: function(data, MIMEType, encoding, baseURL){},
|
||||
loadHTMLString: function(string, baseURL){},
|
||||
|
||||
@@ -294,6 +294,11 @@ _ccsg.TMXLayer = _ccsg.Node.extend(/** @lends _ccsg.TMXLayer# */{
|
||||
} else {
|
||||
renderer.pushRenderCommand(cmd);
|
||||
}
|
||||
|
||||
if(cc._renderType === cc.game.RENDER_TYPE_WEBGL) {
|
||||
renderer.pushRenderCommand(this._renderCmd._disableDepthTestCmd);
|
||||
}
|
||||
|
||||
cmd._dirtyFlag = 0;
|
||||
},
|
||||
|
||||
|
||||
@@ -54,12 +54,22 @@ _ccsg.TMXLayer.WebGLRenderCmd = function(renderableObject){
|
||||
StaggerAxis = cc.TiledMap.StaggerAxis;
|
||||
StaggerIndex = cc.TiledMap.StaggerIndex;
|
||||
}
|
||||
|
||||
// disable DepthTest, local use DepthTest;
|
||||
this._disableDepthTestCmd = new cc.CustomRenderCmd(this, _disableDepthTest);
|
||||
};
|
||||
|
||||
function _disableDepthTest () {
|
||||
cc.renderer.setDepthTest(false);
|
||||
}
|
||||
|
||||
var proto = _ccsg.TMXLayer.WebGLRenderCmd.prototype = Object.create(_ccsg.Node.WebGLRenderCmd.prototype);
|
||||
proto.constructor = _ccsg.TMXLayer.WebGLRenderCmd;
|
||||
|
||||
proto.uploadData = function (f32buffer, ui32buffer, vertexDataOffset) {
|
||||
// enable Depth Test
|
||||
cc.renderer.setDepthTest(true);
|
||||
|
||||
var node = this._node, hasRotation = (node._rotationX || node._rotationY),
|
||||
layerOrientation = node.layerOrientation,
|
||||
tiles = node.tiles;
|
||||
@@ -167,6 +177,7 @@ proto.uploadData = function (f32buffer, ui32buffer, vertexDataOffset) {
|
||||
z = colOffset + col;
|
||||
// Skip sprite tiles
|
||||
if (spTiles[z]) {
|
||||
spTiles[z]._vertexZ = node._vertexZ + cc.renderer.assignedZStep * z / tiles.length;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -672,8 +672,12 @@ sp.Skeleton = cc.Class({
|
||||
},
|
||||
|
||||
/**
|
||||
* !#en Sets skeleton data to sp.Skeleton.
|
||||
* !#zh 设置 Skeleton 中的 Skeleton Data。
|
||||
* !#en
|
||||
* Sets runtime skeleton data to sp.Skeleton.<br>
|
||||
* This method is different from the `skeletonData` property. This method is passed in the raw data provided by the Spine runtime, and the skeletonData type is the asset type provided by Creator.
|
||||
* !#zh
|
||||
* 设置底层运行时用到的 SkeletonData。<br>
|
||||
* 这个接口有别于 `skeletonData` 属性,这个接口传入的是 Spine runtime 提供的原始数据,而 skeletonData 的类型是 Creator 提供的资源类型。
|
||||
* @method setSkeletonData
|
||||
* @param {sp.spine.SkeletonData} skeletonData
|
||||
* @param {sp.spine.SkeletonData} ownsSkeletonData
|
||||
|
||||
+26
-12
@@ -60,7 +60,7 @@ jsbLabel.prototype.getOverflow = function() {
|
||||
|
||||
jsbLabel.prototype._enableBold = jsbLabel.prototype.enableBold;
|
||||
jsbLabel.prototype.enableBold = function(enabled) {
|
||||
if(enabled) {
|
||||
if (enabled) {
|
||||
this._enableBold();
|
||||
} else {
|
||||
this.disableEffect(5);
|
||||
@@ -69,7 +69,7 @@ jsbLabel.prototype.enableBold = function(enabled) {
|
||||
|
||||
jsbLabel.prototype._enableItalics = jsbLabel.prototype.enableItalics;
|
||||
jsbLabel.prototype.enableItalics = function(enabled) {
|
||||
if(enabled) {
|
||||
if (enabled) {
|
||||
this._enableItalics();
|
||||
} else {
|
||||
this.disableEffect(4);
|
||||
@@ -78,7 +78,7 @@ jsbLabel.prototype.enableItalics = function(enabled) {
|
||||
|
||||
jsbLabel.prototype._enableUnderline = jsbLabel.prototype.enableUnderline;
|
||||
jsbLabel.prototype.enableUnderline = function(enabled) {
|
||||
if(enabled) {
|
||||
if (enabled) {
|
||||
this._enableUnderline();
|
||||
} else {
|
||||
this.disableEffect(6);
|
||||
@@ -117,7 +117,7 @@ jsbLabel.prototype.setLineHeight = function (height) {
|
||||
jsbLabel.prototype._setColor = jsbLabel.prototype.setColor;
|
||||
|
||||
jsbLabel.prototype.setColor = function(color) {
|
||||
if(this._labelType === _ccsg.Label.Type.BMFont) {
|
||||
if (this._labelType === _ccsg.Label.Type.BMFont) {
|
||||
this._setColor(color);
|
||||
} else {
|
||||
this.setTextColor(color);
|
||||
@@ -141,7 +141,7 @@ jsbLabel.prototype.setContentSize = function (size, height) {
|
||||
var newWidth = (typeof size.width === 'number') ? size.width : size;
|
||||
var newHeight = (typeof size.height === 'number') ? size.height : height;
|
||||
|
||||
if(this.getOverflow() === cc.Label.Overflow.NONE) {
|
||||
if (this.getOverflow() === cc.Label.Overflow.NONE) {
|
||||
newWidth = 0;
|
||||
newHeight = 0;
|
||||
} else {
|
||||
@@ -161,18 +161,22 @@ jsbLabel.prototype.setFontAsset = function (fontAsset) {
|
||||
var extName = cc.path.extname(fontHandle);
|
||||
|
||||
if (extName === '.ttf') {
|
||||
if(!this._ttfConfig) {
|
||||
var outlineWidth = this.isOutlined() ? this.getOutlineWidth() : 0;
|
||||
if (!this._ttfConfig) {
|
||||
this._ttfConfig = {
|
||||
fontFilePath: fontHandle,
|
||||
fontSize: this._fontSize,
|
||||
outlineSize: 0,
|
||||
outlineSize: outlineWidth,
|
||||
glyphs: 0,
|
||||
customGlyphs: "",
|
||||
distanceFieldEnable: false
|
||||
};
|
||||
}
|
||||
else {
|
||||
this._ttfConfig.outlineSize = outlineWidth;
|
||||
this._ttfConfig.fontFilePath = fontHandle;
|
||||
}
|
||||
this._labelType = _ccsg.Label.Type.TTF;
|
||||
this._ttfConfig.fontFilePath = fontHandle;
|
||||
this.setTTFConfig(this._ttfConfig);
|
||||
} else if (fontAsset.spriteFrame) {
|
||||
this._labelType = _ccsg.Label.Type.BMFont;
|
||||
@@ -194,7 +198,7 @@ jsbLabel.prototype.setFontFamily = function (fontFamily) {
|
||||
|
||||
jsbLabel.prototype.setOutlined = function(value) {
|
||||
this._outlined = !!value;
|
||||
if(this._outlined) {
|
||||
if (this._outlined) {
|
||||
this.enableOutline(this.getOutlineColor(), this.getOutlineWidth());
|
||||
} else {
|
||||
//1 equals cpp outline effect
|
||||
@@ -204,14 +208,24 @@ jsbLabel.prototype.setOutlined = function(value) {
|
||||
|
||||
jsbLabel.prototype.setOutlineWidth = function(value) {
|
||||
this._outlineWidth = value;
|
||||
if(this._outlined) {
|
||||
this.enableOutline(this.getOutlineColor(), this.getOutlineWidth());
|
||||
if (this._outlined) {
|
||||
var outlineWidth = this.getOutlineWidth();
|
||||
if (this._labelType === _ccsg.Label.Type.TTF) {
|
||||
var ttfConfig = this.getTTFConfig();
|
||||
if (ttfConfig.outlineSize !== outlineWidth) {
|
||||
ttfConfig.outlineSize = outlineWidth;
|
||||
this.setTTFConfig(ttfConfig);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.enableOutline(this.getOutlineColor(), outlineWidth);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
jsbLabel.prototype.setOutlineColor = function(value) {
|
||||
this._outlineColor = cc.color(value);
|
||||
if(this._outlined) {
|
||||
if (this._outlined) {
|
||||
this.enableOutline(this.getOutlineColor(), this.getOutlineWidth());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -843,4 +843,26 @@ largeModule('Class ES6');
|
||||
// }
|
||||
// expect(0);
|
||||
// });
|
||||
|
||||
if (TestEditorExtends) {
|
||||
test('deserialization of child class', function () {
|
||||
@ccclass('cc.Animal')
|
||||
class Animal {}
|
||||
|
||||
@ccclass('cc.Dog')
|
||||
class Dog extends Animal {
|
||||
@property
|
||||
name = '3';
|
||||
}
|
||||
|
||||
var ani = new Animal();
|
||||
cc.deserialize(Editor.serialize(ani));
|
||||
var dog = new Dog();
|
||||
dog.name = 'a';
|
||||
var cloneDog = cc.deserialize(Editor.serialize(dog));
|
||||
strictEqual(dog.name, cloneDog.name, 'property should be deserializable if super class also have been deserialized');
|
||||
|
||||
cc.js.unregisterClass(Animal, Dog);
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user