123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2"], function (_export, _context) {
- "use strict";
- 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;
- 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 }); }
- 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; }
- 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.'); }
- function _reportPossibleCrUseOfListItem(extras) {
- _reporterNs.report("ListItem", "../../third/ListItem", _context.meta, extras);
- }
- function _reportPossibleCrUseOfResUtil(extras) {
- _reporterNs.report("ResUtil", "../../utils/ResUtil", _context.meta, extras);
- }
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- __checkObsolete__ = _cc.__checkObsolete__;
- __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
- _decorator = _cc._decorator;
- Sprite = _cc.Sprite;
- SpriteFrame = _cc.SpriteFrame;
- Node = _cc.Node;
- Vec3 = _cc.Vec3;
- easing = _cc.easing;
- tween = _cc.tween;
- }, function (_unresolved_2) {
- ListItem = _unresolved_2.default;
- }, function (_unresolved_3) {
- ResUtil = _unresolved_3.ResUtil;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "21daa73BXtJ9ICVj80csOY/", "GunTypeItem", undefined);
- __checkObsolete__(['_decorator', 'Sprite', 'SpriteFrame', 'Node', 'Vec3', 'EventTouch', 'easing', 'tween']);
- ({
- ccclass,
- property
- } = _decorator); //枪的类型数据
- _export("GunTypeItem", GunTypeItem = (_dec = ccclass('GunTypeItem'), _dec2 = property({
- type: SpriteFrame,
- tooltip: "枪类型解锁选中的"
- }), _dec3 = property({
- type: SpriteFrame,
- tooltip: "枪类型未解锁选中的"
- }), _dec4 = property({
- type: SpriteFrame,
- tooltip: "枪类型解锁的背景"
- }), _dec5 = property({
- type: SpriteFrame,
- tooltip: "枪类型解锁的背景"
- }), _dec6 = property({
- type: Sprite,
- tooltip: "枪类型的背景图片"
- }), _dec7 = property({
- type: Node,
- tooltip: "枪类型解锁"
- }), _dec(_class = (_class2 = class GunTypeItem extends (_crd && ListItem === void 0 ? (_reportPossibleCrUseOfListItem({
- error: Error()
- }), ListItem) : ListItem) {
- constructor() {
- super(...arguments);
- _initializerDefineProperty(this, "selected_bg", _descriptor, this);
- _initializerDefineProperty(this, "gary_selected_bg", _descriptor2, this);
- _initializerDefineProperty(this, "unlock_bg", _descriptor3, this);
- _initializerDefineProperty(this, "not_unlock_bg", _descriptor4, this);
- _initializerDefineProperty(this, "gun_type_bg", _descriptor5, this);
- _initializerDefineProperty(this, "gou_type_icon", _descriptor6, this);
- this.data = null;
- this.cb = null;
- }
- start() {
- this.node.on(Node.EventType.TOUCH_START, this.touchStart, this); //点击查看
- this.node.on(Node.EventType.TOUCH_END, () => {
- var _this$cb;
- if (!this.data) return;
- (_this$cb = this.cb) == null || _this$cb.call(this, this.data);
- }, this);
- }
- /**
- * 点击
- */
- touchStart(event) {
- if (!this.data) return;
- var target = event.target;
- tween(target).to(0.1, {
- scale: new Vec3(1.02, 1.02, 1.02)
- }, {
- easing: easing.backOut
- }).to(0.1, {
- scale: new Vec3(0.98, 0.98, 0.98)
- }, {
- easing: easing.backOut
- }).call(() => {
- target.scale = new Vec3(1, 1, 1);
- }).start();
- }
- /**
- * 数据填充
- * @param data 数据
- * @param cb 回调
- */
- init(data, cb) {
- if (!data) return;
- this.data = data;
- this.cb = cb; //设置背景图片(根据解锁状态切换)
- if (data.selected) {
- this.gun_type_bg.spriteFrame = data.unlocked ? this.selected_bg : this.gary_selected_bg;
- } else {
- this.gun_type_bg.spriteFrame = data.unlocked ? this.unlock_bg : this.not_unlock_bg;
- } //设置类型图标(需要确保data包含type_icon字段)
- var icon = data.unlocked ? data.type_not_unlock : data.type_unlock;
- (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
- error: Error()
- }), ResUtil) : ResUtil).setSpriteFrame(icon, this.gou_type_icon);
- }
- }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "selected_bg", [_dec2], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "gary_selected_bg", [_dec3], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "unlock_bg", [_dec4], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "not_unlock_bg", [_dec5], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "gun_type_bg", [_dec6], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "gou_type_icon", [_dec7], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- })), _class2)) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=7902e41708cb27e7a30316744ddaf5eed7c08f25.js.map
|