From b5de707bbd4e0fed44e9947815f03bb2f6d8e1db Mon Sep 17 00:00:00 2001 From: zhangbin Date: Tue, 20 Sep 2016 15:38:31 +0800 Subject: [PATCH] Improve the implementation of DragonBones. --- extensions/dragonbones/ArmatureDisplay.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/extensions/dragonbones/ArmatureDisplay.js b/extensions/dragonbones/ArmatureDisplay.js index aa4ea3db36..cfa215f4ea 100644 --- a/extensions/dragonbones/ArmatureDisplay.js +++ b/extensions/dragonbones/ArmatureDisplay.js @@ -180,7 +180,6 @@ dragonBones.ArmatureDisplay = cc.Class({ type: DefaultArmaturesEnum, visible: true, editorOnly: true, - serializable: false, displayName: "Armature", tooltip: 'i18n:COMPONENT.dragon_bones.armature_name' }, @@ -214,7 +213,6 @@ dragonBones.ArmatureDisplay = cc.Class({ type: DefaultAnimsEnum, visible: true, editorOnly: true, - serializable: false, displayName: 'Animation', tooltip: 'i18n:COMPONENT.dragon_bones.animation_name' }, @@ -321,10 +319,10 @@ dragonBones.ArmatureDisplay = cc.Class({ if (this.dragonAtlasAsset) { if (CC_JSB) { // TODO parse the texture atlas data from json string & texture path - //this._factory.parseTextureAtlasData(this.dragonAtlasAsset.atlasJson, this.dragonAtlasAsset.texture); + this._factory.parseTextureAtlasData(this.dragonAtlasAsset.atlasJson, this.dragonAtlasAsset.texture); } else { var atlasJsonObj = JSON.parse(this.dragonAtlasAsset.atlasJson); - var texture = cc.loader.getRes(this.dragonAtlasAsset.texture); + var texture = cc.textureCache.getTextureForKey(this.dragonAtlasAsset.texture); this._factory.parseTextureAtlasData(atlasJsonObj, texture); } } @@ -427,12 +425,15 @@ dragonBones.ArmatureDisplay = cc.Class({ * @method playAnimation * @param {String} animName * @param {Number} playTimes + * @return {dragonBones.AnimationState} */ playAnimation: function(animName, playTimes) { if (this._sgNode) { this.animationName = animName; - this._sgNode.animation().play(animName, playTimes); + return this._sgNode.animation().play(animName, playTimes); } + + return null; }, /**