//转换Armature private DragonBonesJsonArmature ConversionArmature(JoyLandlordsJsonArmature joyLandlordsJsonArmature) { DragonBonesJsonArmature bonesJsonArmatures = new DragonBonesJsonArmature(); bonesJsonArmatures.aabb = new DragonBonesJsonAabb(); bonesJsonArmatures.aabb.x = -177.98; bonesJsonArmatures.aabb.y = -209.1; bonesJsonArmatures.aabb.width = 370.36; bonesJsonArmatures.aabb.height = 230.81; bonesJsonArmatures.defaultActions = new DragonBonesDefaultActions[1] { new DragonBonesDefaultActions() }; bonesJsonArmatures.defaultActions[0].gotoAndPlay = "idle"; bonesJsonArmatures.name = joyLandlordsJsonArmature.name; bonesJsonArmatures.type = "Armature"; bonesJsonArmatures.frameRate = DragonCurrBonesRoot.frameRate; //-------------------------转换Bone----------------------------- if (joyLandlordsJsonArmature.bone != null) { bonesJsonArmatures.bone = new DragonBonesJsonBone[1]; bonesJsonArmatures.bone[0] = ConversionBone(joyLandlordsJsonArmature.bone); } else { bonesJsonArmatures.bone = new DragonBonesJsonBone[joyLandlordsJsonArmature.bones.Length]; int i = 0; foreach (var bone in joyLandlordsJsonArmature.bones) { bonesJsonArmatures.bone[i++] = ConversionBone(bone); } } //-------------------------转换Skin----------------------------- bonesJsonArmatures.skin = new DragonBonesJsonSkin[1] { ConversionSkin(joyLandlordsJsonArmature.skin) }; //-------------------------转换Animation----------------------------- if (joyLandlordsJsonArmature.animation != null) { bonesJsonArmatures.animation = new DragonBonesJsonAnimation[1] { ConversionAnimation(joyLandlordsJsonArmature.animation) }; } else { bonesJsonArmatures.animation = new DragonBonesJsonAnimation[joyLandlordsJsonArmature.animations.Length]; int i = 0; foreach (var animation in joyLandlordsJsonArmature.animations) { bonesJsonArmatures.animation[i++] = ConversionAnimation(animation); } } //-------------------------获取Slot----------------------------- bonesJsonArmatures.slot = GetDragonBonesSlot(); return(bonesJsonArmatures); }
//转换Armature数组节点 private DragonBonesJsonArmature[] ConversionArmatureArray(JoyLandlordsJsonArmature[] joyLandlordsJsonArmatures) { DragonBonesJsonArmature[] bonesJsonArmatures = new DragonBonesJsonArmature[joyLandlordsJsonArmatures.Length]; int i = 0; foreach (var joyLandlordsJsonArmature in joyLandlordsJsonArmatures) { bonesJsonArmatures[i++] = ConversionArmature(joyLandlordsJsonArmature); } return(bonesJsonArmatures); }