"use strict";
cc._RF.push(module, '0351bTJjr9LOJtauv2wywN6', 'Hero');
// script/Hero.js

"use strict";

var MAX_DIE_STATE = 3;
var Hero = cc.Class({
  "extends": cc.Component,
  properties: {
    defaultBoneAsset: dragonBones.DragonBonesAsset,
    //默认骨骼
    defaultBoneAtlas: dragonBones.DragonBonesAtlasAsset //默认骨骼纹理

  },
  onLoad: function onLoad() {
    this.DragonAnim = cc.find("DragonAnim", this.node);
    cc.error("初始化");
  },
  start: function start() {},
  onEnable: function onEnable() {},
  playBoneAnim: function playBoneAnim(animName, loop) {
    var armatureDisplay = this.DragonAnim.getComponent(dragonBones.ArmatureDisplay);
    armatureDisplay.dragonAsset = this.defaultBoneAsset;
    armatureDisplay.dragonAtlasAsset = this.defaultBoneAtlas;
    this.setAnimAction(animName, loop);
  },
  //设置当前动画
  setAnimAction: function setAnimAction() {
    var curAnim = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
    var loop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
    var armatureDisplay = this.DragonAnim.getComponent(dragonBones.ArmatureDisplay);

    if (armatureDisplay.dragonAsset && armatureDisplay.dragonAtlasAsset) {
      armatureDisplay.armatureName = "armatureName"; // armatureDisplay.on(dragonBones.EventObject.FRAME_EVENT, this.onAnimFrameEvent, this);

      armatureDisplay.on(dragonBones.EventObject.COMPLETE, this.onAnimCompleteEvent, this);
      armatureDisplay.playAnimation("stand", loop);
    } // cc.log("******************播放", this._heroName, curAnim)

  },
  setCompleteFunc: function setCompleteFunc(func) {
    this._animCompleteCallback = func;
  },
  onAnimCompleteEvent: function onAnimCompleteEvent() {
    this._animCompleteCallback();
  }
});
module.exports = Hero;

cc._RF.pop();