ClickAni.js 652 B

1234567891011121314151617181920212223
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. },
  5. onLoad: function () {
  6. this.m_Ani = this.getComponent(dragonBones.ArmatureDisplay);
  7. this.m_Ani.addEventListener(dragonBones.EventObject.COMPLETE, this.animationEventHandler, this);
  8. },
  9. onEnable :function(){
  10. this.m_Ani.playAnimation('newAnimation', 1);
  11. },
  12. reuse(hook) {
  13. this.m_Hook = hook; // get 中传入的管理类实例
  14. },
  15. animationEventHandler: function (event) {
  16. if (event.type === dragonBones.EventObject.COMPLETE) {
  17. this.m_Hook.onClickAniKilled(this.node);
  18. }
  19. }
  20. });