Merge pull request #2271 from dumganhar/fix/dragonbones-factory

Resolve a FIXME in AramatureDisplay.js, CCFactory is a singlton for JSB either now.
This commit is contained in:
Jare Guo
2018-01-18 14:31:27 +08:00
committed by GitHub
3 changed files with 6 additions and 10 deletions
+4
View File
@@ -682,4 +682,8 @@ if (CC_DEV) {
},
});
if (typeof dragonBones !== 'undefined') {
js.obsolete(dragonBones.CCFactory, 'dragonBones.CCFactory.getFactory', 'getInstance');
}
}
+1 -9
View File
@@ -284,15 +284,7 @@ dragonBones.ArmatureDisplay = cc.Class({
// IMPLEMENT
ctor: function () {
if (CC_JSB) {
// TODO Fix me
// If using the getFactory in JSB.
// There may be throw errors when close the application.
this._factory = new dragonBones.CCFactory();
}
else {
this._factory = dragonBones.CCFactory.getFactory();
}
this._factory = dragonBones.CCFactory.getInstance();
},
__preload: function () {
+1 -1
View File
@@ -154,7 +154,7 @@ dragonBones.CCFactory = cc.Class({
});
dragonBones.CCFactory._factory = null;
dragonBones.CCFactory.getFactory = function() {
dragonBones.CCFactory.getInstance = function() {
if (!dragonBones.CCFactory._factory) {
dragonBones.CCFactory._factory = new dragonBones.CCFactory();
}