【龙骨】dragonBones换装

19年了,方法一现在可行吗?

请问一下,方案1现在可以实现了么?

cocos官方文档上龙骨换肤就是方法一,不过在原生平台上会存在错位问题。

原生版本错位怎么解决?

最近项目升级到2.2.0 升级了下换装的代码,看论坛换装的帖子都是旧的,官方的文档那种方式太笨重了(需要创建龙骨节点) 就更新下帖子。
//先加载龙骨资源
let asset,atlas;
for (let i=0;i<assets.length;i++) {
if (assets[i] instanceof dragonBones.DragonBonesAsset) {
asset = assets[i];
}
else if (assets[i] instanceof dragonBones.DragonBonesAtlasAsset) {
atlas = assets[i];
}
}
if (asset && atlas && factory) {
atlas.init(factory);
let key = asset.init(factory,atlas._uuid);
factory.buildArmatureDisplay(armatureName , key, “”, atlas._uuid);
//替换骨架
factory.replaceSlotDisplay(key,armatureName,slotName,displayName,slot);
}

大佬能解释一下那个换装吗?
this.knife.getArmatureKey(),
“weapon”,
“weapon_r”,
“weapon_1004c_r”,
robotSlot

这一段我没看懂 我试了好多回 都是没换成功 请问这一段该怎么理解?

1赞

factory.replaceSlotDisplay(key,armatureName,slotName,displayName,slot);
} 请问这个函数里面的关键字能解释一下吗? 我根据龙骨动画换了好多组名字都不对

key龙骨ske文件的uuid,异步加载res也能拿到
,armatureName动画骨架名
,slotName插槽名
,displayName插槽下面的图片
,slot要替换的龙骨插槽