7e40211e166a442d615c7b065faa4011025c2112.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Sprite, Label, ProgressBar, Node, ListItem, ResUtil, userIns, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _crd, ccclass, property, UpgradeItem;
  4. function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
  5. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
  6. function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
  7. function _reportPossibleCrUseOfListItem(extras) {
  8. _reporterNs.report("ListItem", "../../third/ListItem", _context.meta, extras);
  9. }
  10. function _reportPossibleCrUseOfResUtil(extras) {
  11. _reporterNs.report("ResUtil", "../../utils/ResUtil", _context.meta, extras);
  12. }
  13. function _reportPossibleCrUseOfuserIns(extras) {
  14. _reporterNs.report("userIns", "../../data/UserData", _context.meta, extras);
  15. }
  16. return {
  17. setters: [function (_unresolved_) {
  18. _reporterNs = _unresolved_;
  19. }, function (_cc) {
  20. _cclegacy = _cc.cclegacy;
  21. __checkObsolete__ = _cc.__checkObsolete__;
  22. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  23. _decorator = _cc._decorator;
  24. Sprite = _cc.Sprite;
  25. Label = _cc.Label;
  26. ProgressBar = _cc.ProgressBar;
  27. Node = _cc.Node;
  28. }, function (_unresolved_2) {
  29. ListItem = _unresolved_2.default;
  30. }, function (_unresolved_3) {
  31. ResUtil = _unresolved_3.ResUtil;
  32. }, function (_unresolved_4) {
  33. userIns = _unresolved_4.userIns;
  34. }],
  35. execute: function () {
  36. _crd = true;
  37. _cclegacy._RF.push({}, "58119Xb2Q5HDJm3BiboEXdY", "UpgradeItem", undefined);
  38. __checkObsolete__(['_decorator', 'Sprite', 'Label', 'ProgressBar', 'EventTouch', 'Node', 'utils']);
  39. ({
  40. ccclass,
  41. property
  42. } = _decorator); //枪的属性数据
  43. _export("UpgradeItem", UpgradeItem = (_dec = ccclass('UpgradeItem'), _dec2 = property({
  44. type: Sprite,
  45. tooltip: "枪的属性图片"
  46. }), _dec3 = property({
  47. type: ProgressBar,
  48. tooltip: "属性值的最大进度"
  49. }), _dec4 = property({
  50. type: Label,
  51. tooltip: "属性值的数据文本"
  52. }), _dec5 = property({
  53. type: Label,
  54. tooltip: "枪的属性多语言名字"
  55. }), _dec6 = property({
  56. type: Node,
  57. tooltip: "广告按钮"
  58. }), _dec7 = property({
  59. type: Node,
  60. tooltip: "视频按钮"
  61. }), _dec8 = property({
  62. type: Node,
  63. tooltip: "金币和钻石按钮"
  64. }), _dec9 = property({
  65. type: Node,
  66. tooltip: "最大等级按钮"
  67. }), _dec(_class = (_class2 = class UpgradeItem extends (_crd && ListItem === void 0 ? (_reportPossibleCrUseOfListItem({
  68. error: Error()
  69. }), ListItem) : ListItem) {
  70. constructor() {
  71. super(...arguments);
  72. _initializerDefineProperty(this, "attr_sp", _descriptor, this);
  73. _initializerDefineProperty(this, "progressBar", _descriptor2, this);
  74. _initializerDefineProperty(this, "atts_label", _descriptor3, this);
  75. _initializerDefineProperty(this, "attribute_lang_lable", _descriptor4, this);
  76. _initializerDefineProperty(this, "ad_free_btn", _descriptor5, this);
  77. _initializerDefineProperty(this, "video_btn", _descriptor6, this);
  78. _initializerDefineProperty(this, "prop_btn", _descriptor7, this);
  79. _initializerDefineProperty(this, "max_btn", _descriptor8, this);
  80. this.data = null;
  81. this.cb = null;
  82. }
  83. start() {
  84. this.ad_free_btn.active = false;
  85. this.video_btn.active = false;
  86. this.prop_btn.active = true;
  87. this.max_btn.active = false;
  88. }
  89. /**
  90. * 点击了按钮
  91. */
  92. onBtnClicked(event, param) {
  93. var _this$cb;
  94. if (!this.data) return;
  95. var idx = Number(param);
  96. (_this$cb = this.cb) == null || _this$cb.call(this, this.data, idx, event.target);
  97. }
  98. /**
  99. * 数据填充
  100. * @param data 数据
  101. * @param cb 回调
  102. */
  103. init(data, cb) {
  104. if (!data) return;
  105. this.data = data;
  106. this.cb = cb; //设置属性图标
  107. (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  108. error: Error()
  109. }), ResUtil) : ResUtil).setSpriteFrame(data.attr_icon, this.attr_sp); //设置进度条
  110. this.progressBar.progress = data.attr_value / data.totalValue; //设置属性数值文本
  111. this.atts_label.string = data.attr_value + "/" + data.totalValue; //设置多语言属性名称
  112. this.attribute_lang_lable.string = data.attribute_lang; //升级需要消耗的材料
  113. var parts = data.nextExpenditure.split("_");
  114. var stuff = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  115. error: Error()
  116. }), userIns) : userIns).itemTable.find(e => e.id == parts[0]);
  117. if (stuff) {
  118. //设置材料图标
  119. (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  120. error: Error()
  121. }), ResUtil) : ResUtil).setSpriteFrame(stuff.icon, this.prop_btn.getChildByName("icon")); //设置材料数量文本
  122. this.prop_btn.getChildByName("num_lable").getComponent(Label).string = "x" + parts[1];
  123. } //判断是否可以升级
  124. this.prop_btn.active = !data.isMaxLevel;
  125. this.max_btn.active = data.isMaxLevel;
  126. }
  127. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "attr_sp", [_dec2], {
  128. configurable: true,
  129. enumerable: true,
  130. writable: true,
  131. initializer: null
  132. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "progressBar", [_dec3], {
  133. configurable: true,
  134. enumerable: true,
  135. writable: true,
  136. initializer: null
  137. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "atts_label", [_dec4], {
  138. configurable: true,
  139. enumerable: true,
  140. writable: true,
  141. initializer: null
  142. }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "attribute_lang_lable", [_dec5], {
  143. configurable: true,
  144. enumerable: true,
  145. writable: true,
  146. initializer: null
  147. }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "ad_free_btn", [_dec6], {
  148. configurable: true,
  149. enumerable: true,
  150. writable: true,
  151. initializer: null
  152. }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "video_btn", [_dec7], {
  153. configurable: true,
  154. enumerable: true,
  155. writable: true,
  156. initializer: null
  157. }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "prop_btn", [_dec8], {
  158. configurable: true,
  159. enumerable: true,
  160. writable: true,
  161. initializer: null
  162. }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "max_btn", [_dec9], {
  163. configurable: true,
  164. enumerable: true,
  165. writable: true,
  166. initializer: null
  167. })), _class2)) || _class));
  168. _cclegacy._RF.pop();
  169. _crd = false;
  170. }
  171. };
  172. });
  173. //# sourceMappingURL=7e40211e166a442d615c7b065faa4011025c2112.js.map