e937f332-0fed-4a49-b656-78b2542fbacd.js 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. "use strict";
  2. cc._RF.push(module, 'e937fMyD+1KSbZWeLJUL7rN', 'SpinManager');
  3. // Script/Manager/SpinManager.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. exports.AnimType = void 0;
  26. var SingleClass_1 = require("./SingleClass");
  27. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  28. var AnimType;
  29. (function (AnimType) {
  30. AnimType[AnimType["Dog"] = 1] = "Dog";
  31. AnimType[AnimType["Daoju"] = 2] = "Daoju";
  32. })(AnimType = exports.AnimType || (exports.AnimType = {}));
  33. var SpinManager = /** @class */ (function (_super) {
  34. __extends(SpinManager, _super);
  35. function SpinManager() {
  36. return _super !== null && _super.apply(this, arguments) || this;
  37. }
  38. // public spSkeleton: sp.Skeleton = null;//动画
  39. // public currentAnimName: string = '';
  40. // 更换动画资源
  41. SpinManager.prototype.ChangeSpineAnimation = function (node, path, animationName, isLoop, completeCallback, self, timeScale) {
  42. if (completeCallback === void 0) { completeCallback = null; }
  43. if (self === void 0) { self = null; }
  44. if (timeScale === void 0) { timeScale = 1; }
  45. var spSkeleton = node.getComponent(sp.Skeleton);
  46. spSkeleton.loop = isLoop;
  47. spSkeleton.timeScale = timeScale;
  48. cc.assetManager.loadBundle("gameScene", function (err, bundle) {
  49. bundle.load(path, sp.SkeletonData, function (err, data) {
  50. if (err) {
  51. console.log("err", err);
  52. }
  53. else {
  54. spSkeleton.skeletonData = data;
  55. }
  56. });
  57. });
  58. };
  59. /**
  60. * 播放spin动画
  61. * @param animationName 动画名称
  62. * @param completeCallback 播放回调
  63. * @param isLoop 是否循环
  64. */
  65. SpinManager.prototype.PlaySpinAnimation = function (node, animationName, isLoop, completeCallback, self, timeScale) {
  66. if (completeCallback === void 0) { completeCallback = null; }
  67. if (self === void 0) { self = null; }
  68. if (timeScale === void 0) { timeScale = 1; }
  69. var spinSkeleton = node.getComponent(sp.Skeleton);
  70. spinSkeleton.loop = isLoop;
  71. spinSkeleton.timeScale = timeScale;
  72. console.log("aaa----播放动画", animationName, isLoop);
  73. (completeCallback) ? spinSkeleton.setCompleteListener(completeCallback) : spinSkeleton.setCompleteListener(null);
  74. spinSkeleton.setAnimation(1, animationName, isLoop);
  75. // spinSkeleton.setEndListener(completeCallback);
  76. };
  77. SpinManager.prototype.GetAnimationName = function (spinSkeleton) {
  78. return spinSkeleton.animation;
  79. };
  80. SpinManager = __decorate([
  81. ccclass
  82. ], SpinManager);
  83. return SpinManager;
  84. }(SingleClass_1.SingleClass));
  85. exports.default = SpinManager;
  86. cc._RF.pop();