Closed scott20145 closed 4 years ago
Finally, I found the solution:
const slot = armatureDisplay.armature.getSlot('head');
(armatureDisplay as any).factory.replaceSlotDisplay("Dragon", "Dragon", 'head', 'head2', slot);
But I just can't found BaseFactory
, so I export to armatureDisplay
object.
Has any standard way to access BaseFactory
?
yes to access the factory
instance, you'd better to call this.[dbPluginName].factory
(assume that your code is right in the scene class).
for example, in your game config you inject the dbplugin with name 'dragonbone':
cfg = {
....
plugins: {
scene: [
{ key: "DragonBones", plugin: dragonBones.phaser.plugin.DragonBonesScenePlugin, mapping: "dragonbone" } // setup DB scene plugin
]
},
....
}
new Phaser.Game(cfg);
and in your scene class, you need to define a type definition to avoid the error 'dragonbone is not defined'. for example
class myScene extends Phaser.Scene {
dragonbone: dragonBones.phaser.plugin.DragonBonesScenePlugin;
create(): void { this.dragonbone.factory.... }
}
I'd like to know does there have any document or pseudo code to show how to change the skin on the runtime?
Thanks for the help.
The example I found is for Laya: