e9a67dc3-def8-49eb-b2dd-5190d693341e.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. "use strict";
  2. cc._RF.push(module, 'e9a673D3vhJ67LdUZDWkzQe', 'RedBagProgressNode');
  3. // common-plugin/Scripts/RedBagProgressNode.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 Utils_1 = require("./Utils");
  26. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  27. var RedBagProgressNode = /** @class */ (function (_super) {
  28. __extends(RedBagProgressNode, _super);
  29. function RedBagProgressNode() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. _this.progressLbl = null;
  32. _this.progressBar = null;
  33. _this.tripNode = null;
  34. _this.tripProgressLbl = null;
  35. _this._location = "default";
  36. return _this;
  37. // _postData(appid: string) {
  38. // utils.postData(appid);
  39. // }
  40. }
  41. RedBagProgressNode.prototype.onLoad = function () {
  42. this.progressLbl = this.node.getComponentInChildren(cc.Label);
  43. this.progressBar = this.node.getComponentInChildren(cc.ProgressBar);
  44. this.tripNode = cc.find("Mask/tripNode", this.node);
  45. this.tripNode.opacity = 0;
  46. this.tripProgressLbl = this.tripNode.getComponentInChildren(cc.Label);
  47. };
  48. RedBagProgressNode.prototype.init = function (data) {
  49. var _this = this;
  50. if (data) {
  51. if (data.location) {
  52. this._location = data.location;
  53. }
  54. }
  55. cc.log("wid s==========" + Utils_1.utils.yzRedBagInfo.totalProgress + " pro =" + Utils_1.utils.yzRedBagInfo.progress);
  56. this.progressBar.progress = Utils_1.utils.yzRedBagInfo.progress / Utils_1.utils.yzRedBagInfo.totalProgress;
  57. this.progressLbl.string = Utils_1.utils.yzRedBagInfo.progress + "/" + Utils_1.utils.yzRedBagInfo.totalProgress;
  58. this.tripProgressLbl.string = "\u901A\u8FC7" + Utils_1.utils.yzRedBagInfo.totalProgress + "\u5173\u5373\u53EF\u9886\u53D6\u7EA2\u5305";
  59. if (Utils_1.utils.yzRedBagInfo.progress >= Utils_1.utils.yzRedBagInfo.totalProgress) {
  60. cc.find("Mask/Icon/pro_cghb", this.node).active = false;
  61. cc.find("Mask/Icon/pro_full", this.node).active = true;
  62. cc.find("Mask/Icon/pro_full", this.node).stopAllActions();
  63. cc.find("Mask/Icon/pro_full", this.node).runAction(cc.repeatForever(cc.sequence(cc.scaleTo(0.5, 1.2), cc.scaleTo(0.5, 1))));
  64. }
  65. else {
  66. cc.find("Mask/Icon/pro_cghb", this.node).active = true;
  67. cc.find("Mask/Icon/pro_full", this.node).active = false;
  68. cc.find("Mask/Icon/pro_full", this.node).stopAllActions();
  69. }
  70. setTimeout(function () {
  71. if (_this.tripNode && cc.isValid(_this.tripNode)) {
  72. _this.tripNode.runAction(cc.sequence(cc.fadeIn(0.3), cc.callFunc(function () {
  73. if (_this.tripNode && cc.isValid(_this.tripNode)) {
  74. _this.tripNode.runAction(cc.sequence(cc.delayTime(5), cc.fadeOut(0.3)));
  75. }
  76. })));
  77. }
  78. }, 3000);
  79. };
  80. RedBagProgressNode.prototype.onEnable = function () {
  81. var _this = this;
  82. this.init();
  83. Utils_1.utils.SendEvent("\u7EA2\u5305\u8FDB\u5EA6\u6302\u4EF6-" + this._location + "-\u5C55\u793A\u6210\u529F");
  84. cc.game.on("YZ_RED_BAG_PROGRESS_CHANGE", function () {
  85. _this.init();
  86. }, this);
  87. };
  88. RedBagProgressNode.prototype.showOpenRedBagPanel = function () {
  89. Utils_1.utils.SendEvent("\u7EA2\u5305\u8FDB\u5EA6\u6302\u4EF6-" + this._location + "-\u70B9\u51FB\u4E0A\u62A5");
  90. if (Utils_1.utils.yzRedBagInfo.progress >= Utils_1.utils.yzRedBagInfo.totalProgress) {
  91. Utils_1.utils.showOpenRedBagPanel({ showType: 2 });
  92. }
  93. else {
  94. Utils_1.utils.showMsg("再挑战" + (Utils_1.utils.yzRedBagInfo.totalProgress - Utils_1.utils.yzRedBagInfo.progress) + "关即可领取现金红包");
  95. }
  96. };
  97. RedBagProgressNode.prototype.onDisable = function () {
  98. this.unscheduleAllCallbacks();
  99. this.node.targetOff(this);
  100. cc.game.targetOff(this);
  101. };
  102. RedBagProgressNode = __decorate([
  103. ccclass
  104. ], RedBagProgressNode);
  105. return RedBagProgressNode;
  106. }(cc.Component));
  107. exports.default = RedBagProgressNode;
  108. cc._RF.pop();