4495aa23-64c0-47c6-a199-eda2084a495f.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. "use strict";
  2. cc._RF.push(module, '4495aojZMBHxqGZ7aIISklf', 'WithdrawalPanel');
  3. // common-plugin/Scripts/WithdrawalPanel.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 YZ_Constant_1 = require("./YZ_Constant");
  27. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  28. var WithdrawalPanel = /** @class */ (function (_super) {
  29. __extends(WithdrawalPanel, _super);
  30. function WithdrawalPanel() {
  31. var _this = _super !== null && _super.apply(this, arguments) || this;
  32. _this._closeBtn = null;
  33. _this._withdrawalBtn = null;
  34. _this._moneyItemNodes = null;
  35. _this._panel = null;
  36. _this._balanceLbl = null;
  37. _this._redBagInfo = null;
  38. _this._location = YZ_Constant_1.SubLocation.isMoreGame;
  39. _this._selectedMoneyItemIndex = -1;
  40. return _this;
  41. }
  42. WithdrawalPanel.prototype.onLoad = function () {
  43. if (Utils_1.utils.otherConfig && Utils_1.utils.otherConfig.group) {
  44. this.node.group = Utils_1.utils.otherConfig.group;
  45. }
  46. this._panel = this.node.getChildByName("Panel");
  47. this._moneyItemNodes = this._panel.getChildByName("WithdrawalPriceNodes").children;
  48. this._balanceLbl = this._panel.getChildByName("balanceLabel").getComponent(cc.Label);
  49. // this.node.active = false;
  50. this._redBagInfo = Utils_1.utils.yzRedBagInfo;
  51. var ratio = 1;
  52. if (cc.winSize.height < cc.winSize.width) {
  53. // 横屏游戏
  54. ratio = cc.winSize.width / 1920 * 0.5;
  55. }
  56. else {
  57. ratio = cc.winSize.width / 1080;
  58. }
  59. this._panel.scale = ratio;
  60. this._initWidget();
  61. };
  62. WithdrawalPanel.prototype._initWidget = function () {
  63. var _this = this;
  64. if (this._redBagInfo.balance > 0) {
  65. this._balanceLbl.string = this._redBagInfo.balance + "\u5143";
  66. }
  67. var _loop_1 = function (i) {
  68. var data = Utils_1.utils.yzRedBagInfo.withdrawaMoneys[i];
  69. if (data) {
  70. this_1._moneyItemNodes[i].getChildByName("PriceLbl").getComponent(cc.Label).string = data + "\u5143";
  71. this_1._moneyItemNodes[i].on(cc.Node.EventType.TOUCH_START, function () {
  72. _this.selectedMoneyNode(i);
  73. }, this_1);
  74. }
  75. };
  76. var this_1 = this;
  77. for (var i = 0; i < 4; i++) {
  78. _loop_1(i);
  79. }
  80. };
  81. WithdrawalPanel.prototype.selectedMoneyNode = function (itemIndex) {
  82. var _this = this;
  83. if (this._redBagInfo.balance >= Utils_1.utils.yzRedBagInfo.withdrawaMoneys[itemIndex]) {
  84. this._selectedMoneyItemIndex = itemIndex;
  85. this._moneyItemNodes.forEach(function (element, index) {
  86. if (itemIndex != index) {
  87. _this._moneyItemNodes[index].getChildByName("selectedBg").active = false;
  88. }
  89. });
  90. this._moneyItemNodes[itemIndex].getChildByName("selectedBg").active = true;
  91. }
  92. else {
  93. Utils_1.utils.showMsg("当前余额不足!");
  94. }
  95. };
  96. WithdrawalPanel.prototype.withDrawalMoney = function () {
  97. console.log("money");
  98. if (this._selectedMoneyItemIndex > -1) {
  99. }
  100. else {
  101. Utils_1.utils.showMsg("请选择要提现的金额!");
  102. }
  103. };
  104. // update() {
  105. // if (this._dataDirty) {
  106. // this._dataDirty = false;
  107. // this._updatePanel();
  108. // }
  109. // }
  110. WithdrawalPanel.prototype._updatePanel = function () {
  111. Utils_1.utils.postRecommentShowData(this._location);
  112. this._initWidget();
  113. return;
  114. };
  115. WithdrawalPanel.prototype.init = function (YzRedBagInfo) {
  116. };
  117. WithdrawalPanel.prototype.show = function () {
  118. this.node.active = true;
  119. };
  120. WithdrawalPanel.prototype.hide = function () {
  121. var self = this;
  122. // this._panel.runAction(cc.sequence(cc.moveTo(0.3, CompatibleTool.position(-this._panel.getContentSize().width, 0)).easing(cc.easeQuadraticActionOut()), cc.callFunc(() => {
  123. self.node.active = false;
  124. // })));
  125. // if (!PlatUtils.IsNativeAndroid) {
  126. // utils.adManager.ShowBanner(BannerLocation.Home);
  127. // }
  128. };
  129. WithdrawalPanel.prototype.onCloseBtnHandler = function (event, data) {
  130. this.hide();
  131. };
  132. WithdrawalPanel = __decorate([
  133. ccclass
  134. ], WithdrawalPanel);
  135. return WithdrawalPanel;
  136. }(cc.Component));
  137. exports.default = WithdrawalPanel;
  138. cc._RF.pop();