7902e41708cb27e7a30316744ddaf5eed7c08f25.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Sprite, SpriteFrame, Node, Vec3, easing, tween, ListItem, ResUtil, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _crd, ccclass, property, GunTypeItem;
  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. return {
  14. setters: [function (_unresolved_) {
  15. _reporterNs = _unresolved_;
  16. }, function (_cc) {
  17. _cclegacy = _cc.cclegacy;
  18. __checkObsolete__ = _cc.__checkObsolete__;
  19. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  20. _decorator = _cc._decorator;
  21. Sprite = _cc.Sprite;
  22. SpriteFrame = _cc.SpriteFrame;
  23. Node = _cc.Node;
  24. Vec3 = _cc.Vec3;
  25. easing = _cc.easing;
  26. tween = _cc.tween;
  27. }, function (_unresolved_2) {
  28. ListItem = _unresolved_2.default;
  29. }, function (_unresolved_3) {
  30. ResUtil = _unresolved_3.ResUtil;
  31. }],
  32. execute: function () {
  33. _crd = true;
  34. _cclegacy._RF.push({}, "21daa73BXtJ9ICVj80csOY/", "GunTypeItem", undefined);
  35. __checkObsolete__(['_decorator', 'Sprite', 'SpriteFrame', 'Node', 'Vec3', 'EventTouch', 'easing', 'tween']);
  36. ({
  37. ccclass,
  38. property
  39. } = _decorator); //枪的类型数据
  40. _export("GunTypeItem", GunTypeItem = (_dec = ccclass('GunTypeItem'), _dec2 = property({
  41. type: SpriteFrame,
  42. tooltip: "枪类型解锁选中的"
  43. }), _dec3 = property({
  44. type: SpriteFrame,
  45. tooltip: "枪类型未解锁选中的"
  46. }), _dec4 = property({
  47. type: SpriteFrame,
  48. tooltip: "枪类型解锁的背景"
  49. }), _dec5 = property({
  50. type: SpriteFrame,
  51. tooltip: "枪类型解锁的背景"
  52. }), _dec6 = property({
  53. type: Sprite,
  54. tooltip: "枪类型的背景图片"
  55. }), _dec7 = property({
  56. type: Node,
  57. tooltip: "枪类型解锁"
  58. }), _dec(_class = (_class2 = class GunTypeItem extends (_crd && ListItem === void 0 ? (_reportPossibleCrUseOfListItem({
  59. error: Error()
  60. }), ListItem) : ListItem) {
  61. constructor() {
  62. super(...arguments);
  63. _initializerDefineProperty(this, "selected_bg", _descriptor, this);
  64. _initializerDefineProperty(this, "gary_selected_bg", _descriptor2, this);
  65. _initializerDefineProperty(this, "unlock_bg", _descriptor3, this);
  66. _initializerDefineProperty(this, "not_unlock_bg", _descriptor4, this);
  67. _initializerDefineProperty(this, "gun_type_bg", _descriptor5, this);
  68. _initializerDefineProperty(this, "gou_type_icon", _descriptor6, this);
  69. this.data = null;
  70. this.cb = null;
  71. }
  72. start() {
  73. this.node.on(Node.EventType.TOUCH_START, this.touchStart, this); //点击查看
  74. this.node.on(Node.EventType.TOUCH_END, () => {
  75. var _this$cb;
  76. if (!this.data) return;
  77. (_this$cb = this.cb) == null || _this$cb.call(this, this.data);
  78. }, this);
  79. }
  80. /**
  81. * 点击
  82. */
  83. touchStart(event) {
  84. if (!this.data) return;
  85. var target = event.target;
  86. tween(target).to(0.1, {
  87. scale: new Vec3(1.02, 1.02, 1.02)
  88. }, {
  89. easing: easing.backOut
  90. }).to(0.1, {
  91. scale: new Vec3(0.98, 0.98, 0.98)
  92. }, {
  93. easing: easing.backOut
  94. }).call(() => {
  95. target.scale = new Vec3(1, 1, 1);
  96. }).start();
  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. if (data.selected) {
  108. this.gun_type_bg.spriteFrame = data.unlocked ? this.selected_bg : this.gary_selected_bg;
  109. } else {
  110. this.gun_type_bg.spriteFrame = data.unlocked ? this.unlock_bg : this.not_unlock_bg;
  111. } //设置类型图标(需要确保data包含type_icon字段)
  112. var icon = data.unlocked ? data.type_not_unlock : data.type_unlock;
  113. (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  114. error: Error()
  115. }), ResUtil) : ResUtil).setSpriteFrame(icon, this.gou_type_icon);
  116. }
  117. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "selected_bg", [_dec2], {
  118. configurable: true,
  119. enumerable: true,
  120. writable: true,
  121. initializer: null
  122. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "gary_selected_bg", [_dec3], {
  123. configurable: true,
  124. enumerable: true,
  125. writable: true,
  126. initializer: null
  127. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "unlock_bg", [_dec4], {
  128. configurable: true,
  129. enumerable: true,
  130. writable: true,
  131. initializer: null
  132. }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "not_unlock_bg", [_dec5], {
  133. configurable: true,
  134. enumerable: true,
  135. writable: true,
  136. initializer: null
  137. }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "gun_type_bg", [_dec6], {
  138. configurable: true,
  139. enumerable: true,
  140. writable: true,
  141. initializer: null
  142. }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "gou_type_icon", [_dec7], {
  143. configurable: true,
  144. enumerable: true,
  145. writable: true,
  146. initializer: null
  147. })), _class2)) || _class));
  148. _cclegacy._RF.pop();
  149. _crd = false;
  150. }
  151. };
  152. });
  153. //# sourceMappingURL=7902e41708cb27e7a30316744ddaf5eed7c08f25.js.map