System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5"], function (_export, _context) { "use strict"; var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Button, Component, Label, Node, tween, v3, ch, gui, UINotify, UI_Main, Hall, _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2, _descriptor3, _crd, ccclass, property, UI_Item; 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 _reportPossibleCrUseOfch(extras) { _reporterNs.report("ch", "../../../ch/ch", _context.meta, extras); } function _reportPossibleCrUseOfgui(extras) { _reporterNs.report("gui", "../../../core/ui/ui", _context.meta, extras); } function _reportPossibleCrUseOfUINotify(extras) { _reporterNs.report("UINotify", "../../../module_basic/ui_notify/UINotify", _context.meta, extras); } function _reportPossibleCrUseOfUI_Main(extras) { _reporterNs.report("UI_Main", "../UI_Main/UI_Main", _context.meta, extras); } function _reportPossibleCrUseOfLayout_Main(extras) { _reporterNs.report("Layout_Main", "../UI_Main/Layout_Main", _context.meta, extras); } function _reportPossibleCrUseOfHall(extras) { _reporterNs.report("Hall", "../../hall/Hall", _context.meta, extras); } return { setters: [function (_unresolved_) { _reporterNs = _unresolved_; }, function (_cc) { _cclegacy = _cc.cclegacy; __checkObsolete__ = _cc.__checkObsolete__; __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__; _decorator = _cc._decorator; Button = _cc.Button; Component = _cc.Component; Label = _cc.Label; Node = _cc.Node; tween = _cc.tween; v3 = _cc.v3; }, function (_unresolved_2) { ch = _unresolved_2.ch; }, function (_unresolved_3) { gui = _unresolved_3.gui; }, function (_unresolved_4) { UINotify = _unresolved_4.UINotify; }, function (_unresolved_5) { UI_Main = _unresolved_5.UI_Main; }, function (_unresolved_6) { Hall = _unresolved_6.Hall; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "12c662bVNFDxoVeaMUS/AvG", "UI_Item", undefined); __checkObsolete__(['_decorator', 'Button', 'Component', 'instantiate', 'Label', 'Node', 'Sprite', 'SpriteFrame', 'tween', 'v3']); __checkObsolete__(['Enum']); // import { GameLink } from '../../game/GameLink'; // import { UI_ad_get } from '../ad_get/UI_ad_get'; // import { LvDir } from '../../game/Lv'; ({ ccclass, property } = _decorator); _export("UI_Item", UI_Item = (_dec = ccclass('UI_Item'), _dec2 = property(Label), _dec3 = property(Node), _dec(_class = (_class2 = class UI_Item extends Component { constructor(...args) { super(...args); _initializerDefineProperty(this, "type", _descriptor, this); _initializerDefineProperty(this, "count", _descriptor2, this); _initializerDefineProperty(this, "ad", _descriptor3, this); this._c = 0; } start() { if (this.type == 0) return; this.show(this.type, (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({ error: Error() }), Hall) : Hall).getInstance().player.get_item(this.type)); if (this.node.getComponent(Button)) { this.node.on(Node.EventType.TOUCH_END, this.onClick, this); } (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({ error: Error() }), Hall) : Hall).getInstance().player.event.on((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({ error: Error() }), Hall) : Hall).getInstance().player.event.key.item_count, this.show, this); } onDestroy() { (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({ error: Error() }), Hall) : Hall).getInstance().player.event.off((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({ error: Error() }), Hall) : Hall).getInstance().player.event.key.item_count, this.show, this); } show(type, count) { if (type != this.type) return; if (this._c != count) { tween(this.node).to(0.05, { scale: v3(1.2, 1.2, 1) }).to(0.1, { scale: v3(1, 1, 1) }).start(); if (count < this._c) {// if (type == 1) { // ch.audio.playOneShot('sounds/sfx_item1'); // } else if (type == 2) { // ch.audio.playOneShot('sounds/sfx_item2'); // } else { // ch.audio.playOneShot('sounds/sfx_item3'); // } } } this._c = count; this.count.string = count == 0 ? '+' : count.toString(); if (type == 1) {// if (GameLink.getInst().lv.dir == LvDir.none) { // this.node.active = false; // } else { // this.node.active = true; // } } //this.ad.active = count <= 0; } // async onClick(evt) { if (this._c <= 0) { if (this.type == 3) { let flag = false; for (let element of (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({ error: Error() }), gui) : gui).get(_crd && UI_Main === void 0 ? (_reportPossibleCrUseOfUI_Main({ error: Error() }), UI_Main) : UI_Main).getLayout().Container.node_isIdiom) { console.log(element); if (element == true) { flag = true; break; } } if (!flag) (_crd && UINotify === void 0 ? (_reportPossibleCrUseOfUINotify({ error: Error() }), UINotify) : UINotify).show('槽中无可清除的方块'); } const ret = await chsdk.playRewardAd('获得道具' + this.type); if (ret) { // ch.audio.playOneShot('sounds/sfx_add_item'); (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({ error: Error() }), Hall) : Hall).getInstance().player.add_item(this.type, 1); (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({ error: Error() }), ch) : ch).audio.resume(); } // gui.show(UI_ad_get, this.type); } else { if (this.type == 3) { let flag = false; for (let element of (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({ error: Error() }), gui) : gui).get(_crd && UI_Main === void 0 ? (_reportPossibleCrUseOfUI_Main({ error: Error() }), UI_Main) : UI_Main).getLayout().Container.node_isIdiom) { console.log(element); if (element == true) { (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({ error: Error() }), Hall) : Hall).getInstance().player.use_item(this.type); flag = true; break; } } if (!flag) (_crd && UINotify === void 0 ? (_reportPossibleCrUseOfUINotify({ error: Error() }), UINotify) : UINotify).show('槽中无可清除的方块'); } else { (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({ error: Error() }), Hall) : Hall).getInstance().player.use_item(this.type); } } } }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "type", [property], { configurable: true, enumerable: true, writable: true, initializer: function () { return 0; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "count", [_dec2], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "ad", [_dec3], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2)) || _class)); _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=5cc3ce28e30e8e416eb47ff816c05a8fc1f78292.js.map