3e672487cc17bd45476e9a434d891b28ced16448.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, sp, AnimatorSpine, AnimatorBase, _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _crd, ccclass, property, requireComponent, menu, help, AnimatorSpineSecondary;
  4. function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
  5. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
  6. function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
  7. function _reportPossibleCrUseOfAnimatorSpine(extras) {
  8. _reporterNs.report("AnimatorSpine", "./AnimatorSpine", _context.meta, extras);
  9. }
  10. function _reportPossibleCrUseOfAnimatorBase(extras) {
  11. _reporterNs.report("AnimatorBase", "./core/AnimatorBase", _context.meta, extras);
  12. }
  13. function _reportPossibleCrUseOfAnimationPlayer(extras) {
  14. _reporterNs.report("AnimationPlayer", "./core/AnimatorBase", _context.meta, extras);
  15. }
  16. function _reportPossibleCrUseOfAnimatorStateLogic(extras) {
  17. _reporterNs.report("AnimatorStateLogic", "./core/AnimatorStateLogic", _context.meta, extras);
  18. }
  19. return {
  20. setters: [function (_unresolved_) {
  21. _reporterNs = _unresolved_;
  22. }, function (_cc) {
  23. _cclegacy = _cc.cclegacy;
  24. __checkObsolete__ = _cc.__checkObsolete__;
  25. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  26. _decorator = _cc._decorator;
  27. sp = _cc.sp;
  28. }, function (_unresolved_2) {
  29. AnimatorSpine = _unresolved_2.default;
  30. }, function (_unresolved_3) {
  31. AnimatorBase = _unresolved_3.default;
  32. }],
  33. execute: function () {
  34. _crd = true;
  35. _cclegacy._RF.push({}, "e47112s9c9Kwo8XQQ4KSW0c", "AnimatorSpineSecondary", undefined);
  36. __checkObsolete__(['_decorator', 'sp']);
  37. ({
  38. ccclass,
  39. property,
  40. requireComponent,
  41. menu,
  42. help
  43. } = _decorator);
  44. /**
  45. * Spine状态机组件(次状态机),同一节点可添加多个,用于在不同track中播放动画,trackIndex必须大于0
  46. */
  47. _export("default", AnimatorSpineSecondary = (_dec = requireComponent(sp.Skeleton), _dec2 = menu('OopsFramework/Animator/AnimatorSpine (Spine 次状态机)'), _dec3 = help('https://gitee.com/dgflash/oops-framework/wikis/pages?sort_id=12036279&doc_id=2873565'), _dec4 = property({
  48. tooltip: '动画播放的trackIndex,必须大于0'
  49. }), ccclass(_class = _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class AnimatorSpineSecondary extends (_crd && AnimatorBase === void 0 ? (_reportPossibleCrUseOfAnimatorBase({
  50. error: Error()
  51. }), AnimatorBase) : AnimatorBase) {
  52. constructor() {
  53. super(...arguments);
  54. _initializerDefineProperty(this, "TrackIndex", _descriptor, this);
  55. /** 主状态机 */
  56. this._main = null;
  57. /** spine组件 */
  58. this._spine = null;
  59. }
  60. start() {
  61. if (!this.PlayOnStart || this._hasInit) {
  62. return;
  63. }
  64. this._hasInit = true;
  65. this._spine = this.getComponent(sp.Skeleton);
  66. this._main = this.getComponent(_crd && AnimatorSpine === void 0 ? (_reportPossibleCrUseOfAnimatorSpine({
  67. error: Error()
  68. }), AnimatorSpine) : AnimatorSpine);
  69. this._main.addSecondaryListener(this.onAnimFinished, this);
  70. if (this.AssetRawUrl !== null) {
  71. this.initJson(this.AssetRawUrl.json);
  72. }
  73. }
  74. /**
  75. * 手动初始化状态机,可传入0-3个参数,类型如下
  76. * - onStateChangeCall 状态切换时的回调
  77. * - stateLogicMap 各个状态逻辑控制
  78. * - animationPlayer 自定义动画控制
  79. * @override
  80. */
  81. onInit() {
  82. if (this.PlayOnStart || this._hasInit) {
  83. return;
  84. }
  85. this._hasInit = true;
  86. this.initArgs(...arguments);
  87. this._spine = this.getComponent(sp.Skeleton);
  88. this._main = this.getComponent(_crd && AnimatorSpine === void 0 ? (_reportPossibleCrUseOfAnimatorSpine({
  89. error: Error()
  90. }), AnimatorSpine) : AnimatorSpine);
  91. this._main.addSecondaryListener(this.onAnimFinished, this);
  92. if (this.AssetRawUrl !== null) {
  93. this.initJson(this.AssetRawUrl.json);
  94. }
  95. }
  96. /**
  97. * 播放动画
  98. * @override
  99. * @param animName 动画名
  100. * @param loop 是否循环播放
  101. */
  102. playAnimation(animName, loop) {
  103. if (animName) {
  104. this._spine.setAnimation(this.TrackIndex, animName, loop);
  105. } else {
  106. this._spine.clearTrack(this.TrackIndex);
  107. }
  108. }
  109. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "TrackIndex", [_dec4], {
  110. configurable: true,
  111. enumerable: true,
  112. writable: true,
  113. initializer: function initializer() {
  114. return 1;
  115. }
  116. })), _class2)) || _class) || _class) || _class) || _class));
  117. _cclegacy._RF.pop();
  118. _crd = false;
  119. }
  120. };
  121. });
  122. //# sourceMappingURL=3e672487cc17bd45476e9a434d891b28ced16448.js.map