-
Notifications
You must be signed in to change notification settings - Fork 117
Move from V2.2 to V2.3
The difference between V2.2 and V2.3 is not so small. If you have some project developed in middle and hope to upgrade DragonBones from V2.2 to V2.3, this document will be useful for you.
Data Format
Data format is different. V2.2's library cannot parse V2.3's data. If you use V2.3's designpanel, then you must also use V2.3's library.
Good news is V2.3's Library can parse V2.2's data format. If you already have some data exported by V2.2's design panel, feel free to upgrade to V2.3. You don't need to re-export these data.
If you want to re-export V2.2's data, V2.3's design panel is able to do it. Just import these data directly (choose "Exported Data" option in import panel) and export it. Everything will be OK.
API
There are some API change between V2.2 and V2.3:
- Animation.gotoAndPlay's parameter list is changed.
- BaseFactory was changed to abstract class. If you want to render animation by Flash display list instead of Starling's, use NativeFactory instead.
- Add Slot data structure into Bone. Slot is specifically for texture container, which will be very useful for changing skin feature in future. Currently Flash pro cannot create multiple skins but Spine can.
- zOrder,pivotX, pivotY properties was removed from Bone and was added into Slot. Currently, Bone.origin is the pivot of the bone and it is calculated from the position of the MovieClip stand for the bone in Flash Pro. In Slot, there is a origin property, it is stand for the position of the content of Bone's MovieClip. Basically, the Slot's origin equals to V2.2's provitX/provitY.
- Factory.buildArmature's parameter list is changed. Add skinName in the End. Currently DragonBones don't support changing skin on the fly, so you have to choose one skin to create a armature. In future, when DragonBones support dynamically changing skin, the skinName parameter will be removed.
BTW, by default armatures created by FlashPro, there is only one skin called "" which is the default value, so you don't need to change any code for your game created by V2.2. - BoneTransform class was changed to DBRransform class. Remove pivotX, pivotY and z property from Transform.
- How to use JSON data:
_textureAtlas = new StarlingTextureAtlas(texture, JSON.parse(new TextureJSON));