d0e3b6f8-d1bb-4160-8ccf-4279b45901ff.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. "use strict";
  2. cc._RF.push(module, 'd0e3bb40btBYIzPQnm0WQH/', 'UIAction');
  3. // Script/new_20210323/UIAction.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.EasingEnum = void 0;
  26. var EasingEnum;
  27. (function (EasingEnum) {
  28. EasingEnum[EasingEnum["quadIn"] = 0] = "quadIn";
  29. EasingEnum[EasingEnum["quadOut"] = 1] = "quadOut";
  30. EasingEnum[EasingEnum["quadInOut"] = 2] = "quadInOut";
  31. EasingEnum[EasingEnum["cubicIn"] = 3] = "cubicIn";
  32. EasingEnum[EasingEnum["cubicOut"] = 4] = "cubicOut";
  33. EasingEnum[EasingEnum["cubicInOut"] = 5] = "cubicInOut";
  34. EasingEnum[EasingEnum["quartIn"] = 6] = "quartIn";
  35. EasingEnum[EasingEnum["quartOut"] = 7] = "quartOut";
  36. EasingEnum[EasingEnum["quartInOut"] = 8] = "quartInOut";
  37. EasingEnum[EasingEnum["quintIn"] = 9] = "quintIn";
  38. EasingEnum[EasingEnum["quintOut"] = 10] = "quintOut";
  39. EasingEnum[EasingEnum["quintInOut"] = 11] = "quintInOut";
  40. EasingEnum[EasingEnum["sineIn"] = 12] = "sineIn";
  41. EasingEnum[EasingEnum["sineOut"] = 13] = "sineOut";
  42. EasingEnum[EasingEnum["sineInOut"] = 14] = "sineInOut";
  43. EasingEnum[EasingEnum["expoIn"] = 15] = "expoIn";
  44. EasingEnum[EasingEnum["expoOut"] = 16] = "expoOut";
  45. EasingEnum[EasingEnum["expoInOut"] = 17] = "expoInOut";
  46. EasingEnum[EasingEnum["circIn"] = 18] = "circIn";
  47. EasingEnum[EasingEnum["circOut"] = 19] = "circOut";
  48. EasingEnum[EasingEnum["circInOut"] = 20] = "circInOut";
  49. EasingEnum[EasingEnum["elasticIn"] = 21] = "elasticIn";
  50. EasingEnum[EasingEnum["elasticOut"] = 22] = "elasticOut";
  51. EasingEnum[EasingEnum["elasticInOut"] = 23] = "elasticInOut";
  52. EasingEnum[EasingEnum["backIn"] = 24] = "backIn";
  53. EasingEnum[EasingEnum["backOut"] = 25] = "backOut";
  54. EasingEnum[EasingEnum["backInOut"] = 26] = "backInOut";
  55. EasingEnum[EasingEnum["bounceIn"] = 27] = "bounceIn";
  56. EasingEnum[EasingEnum["bounceOut"] = 28] = "bounceOut";
  57. EasingEnum[EasingEnum["bounceInOut"] = 29] = "bounceInOut";
  58. EasingEnum[EasingEnum["smooth"] = 30] = "smooth";
  59. EasingEnum[EasingEnum["fade"] = 31] = "fade";
  60. })(EasingEnum = exports.EasingEnum || (exports.EasingEnum = {}));
  61. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  62. var NewClass = /** @class */ (function (_super) {
  63. __extends(NewClass, _super);
  64. function NewClass() {
  65. var _this = _super !== null && _super.apply(this, arguments) || this;
  66. _this.easings = EasingEnum.smooth;
  67. _this.duration = 2;
  68. _this.isScale = false;
  69. _this.startScale = 2;
  70. _this.targetScale = 1;
  71. /**初始隐藏 */
  72. _this.isStartHide = false;
  73. _this.isMove = false;
  74. _this.startPos = new cc.Vec3(0, 50, 0);
  75. _this.endPos = new cc.Vec3(0, 0, 0);
  76. _this.isInterval = false;
  77. _this.intervalTime = 1;
  78. _this.isLoop = false;
  79. return _this;
  80. // update (dt) {}
  81. }
  82. // LIFE-CYCLE CALLBACKS:
  83. NewClass.prototype.onLoad = function () {
  84. var _this = this;
  85. this.Init();
  86. (this.isInterval) ? this.scheduleOnce(function () { _this.TweenFunc(); }, this.intervalTime) : this.TweenFunc();
  87. };
  88. NewClass.prototype.Init = function () {
  89. if (this.isMove)
  90. this.node.position = this.startPos;
  91. if (this.isScale)
  92. this.node.setScale(this.startScale);
  93. if (this.isStartHide)
  94. this.node.opacity = 0;
  95. };
  96. NewClass.prototype.TweenFunc = function () {
  97. if (this.isStartHide)
  98. this.node.opacity = 255;
  99. var tweens = cc.tween();
  100. //, position: this.currentPos
  101. if (this.isScale)
  102. tweens.to(this.duration, { scale: this.targetScale }, { easing: EasingEnum[this.easings] });
  103. if (this.isMove)
  104. tweens.to(this.duration, { position: this.endPos }, { easing: EasingEnum[this.easings] });
  105. tweens.call(function () {
  106. // this.node.setScale(this.startScale);
  107. console.log('缓动结束回调');
  108. // if (this.callback) this.callback();
  109. });
  110. (this.isLoop) ? cc.tween(this.node).repeatForever(tweens).start() : cc.tween(this.node).repeat(1, tweens).start();
  111. };
  112. __decorate([
  113. property({ type: cc.Enum(EasingEnum) })
  114. ], NewClass.prototype, "easings", void 0);
  115. __decorate([
  116. property
  117. ], NewClass.prototype, "duration", void 0);
  118. __decorate([
  119. property
  120. ], NewClass.prototype, "isScale", void 0);
  121. __decorate([
  122. property
  123. ], NewClass.prototype, "startScale", void 0);
  124. __decorate([
  125. property
  126. ], NewClass.prototype, "targetScale", void 0);
  127. __decorate([
  128. property
  129. ], NewClass.prototype, "isStartHide", void 0);
  130. __decorate([
  131. property
  132. ], NewClass.prototype, "isMove", void 0);
  133. __decorate([
  134. property(cc.Vec3)
  135. ], NewClass.prototype, "startPos", void 0);
  136. __decorate([
  137. property(cc.Vec3)
  138. ], NewClass.prototype, "endPos", void 0);
  139. __decorate([
  140. property
  141. ], NewClass.prototype, "isInterval", void 0);
  142. __decorate([
  143. property
  144. ], NewClass.prototype, "intervalTime", void 0);
  145. __decorate([
  146. property
  147. ], NewClass.prototype, "isLoop", void 0);
  148. NewClass = __decorate([
  149. ccclass
  150. ], NewClass);
  151. return NewClass;
  152. }(cc.Component));
  153. exports.default = NewClass;
  154. cc._RF.pop();