| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- cc.Class({
- extends: require("BaseCharactor"),
- properties: {
-
- },
- onLoad () {
-
- this.armatureDisplay = this.node.getComponent(dragonBones.ArmatureDisplay);
- this.armature = this.armatureDisplay.armature();
- //添加动画事件监听
- this.armatureDisplay.addEventListener(dragonBones.EventObject.COMPLETE, this.animationEventHandler, this);
- },
- start () {
- },
- attack(bLeft){
- if(bLeft)
- {
- this.armature.animation.play("attack",1);
- }
- else
- {
- this.armature.animation.play("attack",1);
- }
- },
- animationEventHandler(event) {
- if (event.type === dragonBones.EventObject.COMPLETE) {
- if (event.animationState.name === "attack") {
- console.log("attack 动作播放完毕!!!");
- //TODO:
- this.armature.animation.play("idle",-1);
- }
- }
- }
- // update (dt) {},
- });
|