1b984a52-1027-4165-9c5c-53541f2f81f7.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. "use strict";
  2. cc._RF.push(module, '1b984pSECdBZZxcU1QfL4H3', 'showEffect');
  3. // scripts/Game/showEffect.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 (b.hasOwnProperty(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. var gameMgr_1 = require("./gameMgr");
  26. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  27. var NewClass = /** @class */ (function (_super) {
  28. __extends(NewClass, _super);
  29. function NewClass() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. _this.texMess = new cc.Vec4(0, 0, 0, 0);
  32. _this.intervalTime = 0.05;
  33. _this.effectType = 0;
  34. return _this;
  35. // update (dt) {}
  36. }
  37. // LIFE-CYCLE CALLBACKS:
  38. // onLoad () {}
  39. NewClass.prototype.start = function () {
  40. var _this = this;
  41. gameMgr_1.gameMgr && gameMgr_1.gameMgr.setMapTs.checkNode(this.node, true);
  42. if (this.node.name.includes("bullet_boom")) {
  43. if (gameMgr_1.gameMgr.mainCamereRootNode.getBoundingBoxToWorld().intersects(this.node.getBoundingBoxToWorld())) {
  44. gameMgr_1.gameMgr.shakeEffect(3, 1, true);
  45. }
  46. }
  47. if (this.effectType == 0) {
  48. if (this.getComponent(cc.Sprite) && this.getComponent(cc.Sprite).getMaterial(0).name == "fire") {
  49. var mtl_1 = this.getComponent(cc.Sprite).getMaterial(0);
  50. mtl_1.setProperty("totalTex", this.texMess);
  51. var num_1 = 1;
  52. this.schedule(function () {
  53. if (!gameMgr_1.gameMgr.mainCamera.containsNode(_this.node)) {
  54. _this.node.opacity = 0;
  55. }
  56. else {
  57. _this.node.opacity = 255;
  58. }
  59. mtl_1.setProperty("curTex", num_1);
  60. num_1++;
  61. // if (num > this.texMess.x) {
  62. // num = 1;
  63. // }
  64. if (num_1 > _this.texMess.x) {
  65. cc.tween(_this.node).to(0.2, { opacity: 0 }).call(function () { _this.node.destroy(); }).start();
  66. }
  67. }, this.intervalTime, this.texMess.x);
  68. }
  69. else {
  70. this.node.destroy();
  71. }
  72. }
  73. else if (this.effectType == 1) {
  74. this.scheduleOnce(function () {
  75. _this.node.destroy();
  76. }, 2);
  77. }
  78. else if (this.effectType == 3) {
  79. cc.tween(this.node).set({ scale: 3 }).to(0.5, { scale: 1 }).to(0.5, { opacity: 0 }).call(function () {
  80. _this.node.destroy();
  81. }).start();
  82. }
  83. else if (this.effectType == 4) {
  84. cc.tween(this.node).to(1.5, { angle: 720, scale: 0.5 }).to(0.3, { opacity: 0 }).call(function () { _this.node.destroy(); }).start();
  85. }
  86. else if (this.effectType == 5) {
  87. var ani = this.node.children[0].getComponent(sp.Skeleton);
  88. ani.setCompleteListener(function () { cc.isValid(_this.node.isValid) && _this.node.destroy(); });
  89. this.scheduleOnce(function () { cc.isValid(_this.node.isValid) && _this.node.destroy(); }, 2);
  90. }
  91. else if (this.effectType == 6) {
  92. cc.tween(this.node).delay(0.5).to(0.2, { opacity: 0 }).call(function () { _this.node.destroy(); }).start();
  93. }
  94. else if (this.effectType == 7) {
  95. var icon = this.node.children[0];
  96. cc.tween(icon)
  97. .bezierTo(0.6, cc.Vec2.ZERO, cc.v2(-50, 50), cc.v2(-50 - 50 * Math.random(), -150))
  98. .to(1, { opacity: 0 }, { easing: 'fade' })
  99. .call(function () { _this.node.destroy(); })
  100. .start();
  101. }
  102. else if (this.effectType == 8) {
  103. cc.tween(this.node)
  104. .to(0.5, { opacity: 0 })
  105. .call(function () { _this.node.destroy(); })
  106. .start();
  107. }
  108. };
  109. __decorate([
  110. property()
  111. ], NewClass.prototype, "texMess", void 0);
  112. __decorate([
  113. property()
  114. ], NewClass.prototype, "intervalTime", void 0);
  115. __decorate([
  116. property()
  117. ], NewClass.prototype, "effectType", void 0);
  118. NewClass = __decorate([
  119. ccclass
  120. ], NewClass);
  121. return NewClass;
  122. }(cc.Component));
  123. exports.default = NewClass;
  124. cc._RF.pop();