a4c6d34f27d57ec64ddd4d49977d504c5db0b4ef.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, dragonBones, AnimatorBase, _dec, _dec2, _dec3, _class, _crd, ccclass, property, requireComponent, disallowMultiple, menu, help, AnimatorDragonBones;
  4. function _reportPossibleCrUseOfAnimatorBase(extras) {
  5. _reporterNs.report("AnimatorBase", "./core/AnimatorBase", _context.meta, extras);
  6. }
  7. function _reportPossibleCrUseOfAnimationPlayer(extras) {
  8. _reporterNs.report("AnimationPlayer", "./core/AnimatorBase", _context.meta, extras);
  9. }
  10. function _reportPossibleCrUseOfAnimatorStateLogic(extras) {
  11. _reporterNs.report("AnimatorStateLogic", "./core/AnimatorStateLogic", _context.meta, extras);
  12. }
  13. return {
  14. setters: [function (_unresolved_) {
  15. _reporterNs = _unresolved_;
  16. }, function (_cc) {
  17. _cclegacy = _cc.cclegacy;
  18. __checkObsolete__ = _cc.__checkObsolete__;
  19. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  20. _decorator = _cc._decorator;
  21. dragonBones = _cc.dragonBones;
  22. }, function (_unresolved_2) {
  23. AnimatorBase = _unresolved_2.default;
  24. }],
  25. execute: function () {
  26. _crd = true;
  27. _cclegacy._RF.push({}, "dc324J03ptB8b2JV9Ljduzh", "AnimatorDragonBones", undefined);
  28. __checkObsolete__(['_decorator', 'dragonBones']);
  29. ({
  30. ccclass,
  31. property,
  32. requireComponent,
  33. disallowMultiple,
  34. menu,
  35. help
  36. } = _decorator);
  37. /**
  38. * DragonBones状态机组件
  39. */
  40. _export("default", AnimatorDragonBones = (_dec = requireComponent(dragonBones.ArmatureDisplay), _dec2 = menu('OopsFramework/Animator/AnimatorDragonBones (龙骨状态机)'), _dec3 = help('https://gitee.com/dgflash/oops-framework/wikis/pages?sort_id=12036279&doc_id=2873565'), ccclass(_class = disallowMultiple(_class = _dec(_class = _dec2(_class = _dec3(_class = class AnimatorDragonBones extends (_crd && AnimatorBase === void 0 ? (_reportPossibleCrUseOfAnimatorBase({
  41. error: Error()
  42. }), AnimatorBase) : AnimatorBase) {
  43. constructor() {
  44. super(...arguments);
  45. /** DragonBones组件 */
  46. this._dragonBones = null;
  47. }
  48. start() {
  49. if (!this.PlayOnStart || this._hasInit) {
  50. return;
  51. }
  52. this._hasInit = true;
  53. this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay);
  54. this._dragonBones.addEventListener('complete', this.onAnimFinished, this);
  55. if (this.AssetRawUrl !== null) {
  56. this.initJson(this.AssetRawUrl.json);
  57. }
  58. }
  59. /**
  60. * 手动初始化状态机,可传入0-3个参数,类型如下
  61. * - onStateChangeCall 状态切换时的回调
  62. * - stateLogicMap 各个状态逻辑控制
  63. * - animationPlayer 自定义动画控制
  64. * @override
  65. */
  66. onInit() {
  67. if (this.PlayOnStart || this._hasInit) {
  68. return;
  69. }
  70. this._hasInit = true;
  71. this.initArgs(...arguments);
  72. this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay);
  73. this._dragonBones.addEventListener('complete', this.onAnimFinished, this);
  74. if (this.AssetRawUrl !== null) {
  75. this.initJson(this.AssetRawUrl.json);
  76. }
  77. }
  78. /**
  79. * 播放动画
  80. * @override
  81. * @param animName 动画名
  82. * @param loop 是否循环播放
  83. */
  84. playAnimation(animName, loop) {
  85. if (animName) this._dragonBones.playAnimation(animName, loop ? 0 : -1);
  86. }
  87. /**
  88. * 缩放动画播放速率
  89. * @override
  90. * @param scale 缩放倍率
  91. */
  92. scaleTime(scale) {
  93. if (scale > 0) this._dragonBones.timeScale = scale;
  94. }
  95. }) || _class) || _class) || _class) || _class) || _class));
  96. _cclegacy._RF.pop();
  97. _crd = false;
  98. }
  99. };
  100. });
  101. //# sourceMappingURL=a4c6d34f27d57ec64ddd4d49977d504c5db0b4ef.js.map