Skip to content

Commit

Permalink
fix dragonBones parseDragonBonesData bug in jsb (cocos#2890)
Browse files Browse the repository at this point in the history
* fix dragonBones parseDragonBonesData bug in jsb

* remove code comments
  • Loading branch information
knoxHuang authored and pandamicro committed Jun 25, 2018
1 parent 306bb94 commit 8238e0d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions extensions/dragonbones/ArmatureDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,10 @@ dragonBones.ArmatureDisplay = cc.Class({

_parseDragonAsset: function () {
if (this.dragonAsset) {
if (CC_JSB) {
// The '_factory' create a new one every time in JSB, they can't use getDragonBonesData
// to get cached data, and only parse data every time
this._dragonBonesData = this._factory.parseDragonBonesData(this.dragonAsset.dragonBonesJson);
}
else {
var jsonObj = JSON.parse(this.dragonAsset.dragonBonesJson);
var data = this._factory.getDragonBonesData(jsonObj.name);
if (data) {
var jsonObj = JSON.parse(this.dragonAsset.dragonBonesJson);
var data = this._factory.getDragonBonesData(jsonObj.name);
if (data) {
if (!CC_JSB) {
// already added asset
var armature, dragonBonesData;
for (var i = 0, len = jsonObj.armature.length; i < len; i++) {
Expand All @@ -352,10 +347,16 @@ dragonBones.ArmatureDisplay = cc.Class({
data.addArmature(dragonBonesData.armatures[armature.name]);
}
}
this._dragonBonesData = data;
return;
}
this._dragonBonesData = this._factory.parseDragonBonesData(jsonObj);
this._dragonBonesData = data;
}
else {
if (CC_JSB) {
this._dragonBonesData = this._factory.parseDragonBonesData(this.dragonAsset.dragonBonesJson);
}
else {
this._dragonBonesData = this._factory.parseDragonBonesData(jsonObj);
}
}
}
},
Expand Down

0 comments on commit 8238e0d

Please sign in to comment.