123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- 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, GameLink, UI_ad_get, LvDir, _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 _reportPossibleCrUseOfGameLink(extras) {
- _reporterNs.report("GameLink", "../../game/GameLink", _context.meta, extras);
- }
- function _reportPossibleCrUseOfUI_ad_get(extras) {
- _reporterNs.report("UI_ad_get", "../ad_get/UI_ad_get", _context.meta, extras);
- }
- function _reportPossibleCrUseOfLvDir(extras) {
- _reporterNs.report("LvDir", "../../game/Lv", _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) {
- GameLink = _unresolved_4.GameLink;
- }, function (_unresolved_5) {
- UI_ad_get = _unresolved_5.UI_ad_get;
- }, function (_unresolved_6) {
- LvDir = _unresolved_6.LvDir;
- }],
- 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']);
- ({
- 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 && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
- error: Error()
- }), GameLink) : GameLink).getInst().player.get_item(this.type));
- if (this.node.getComponent(Button)) {
- this.node.on(Node.EventType.TOUCH_END, this.onClick, this);
- }
- (_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
- error: Error()
- }), GameLink) : GameLink).getInst().player.event.on((_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
- error: Error()
- }), GameLink) : GameLink).getInst().player.event.key.item_count, this.show, this);
- }
- onDestroy() {
- (_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
- error: Error()
- }), GameLink) : GameLink).getInst().player.event.off((_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
- error: Error()
- }), GameLink) : GameLink).getInst().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) {
- (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).audio.playOneShot('sounds/sfx_item1');
- } else if (type == 2) {
- (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).audio.playOneShot('sounds/sfx_item2');
- } else {
- (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).audio.playOneShot('sounds/sfx_item3');
- }
- }
- }
- this._c = count;
- this.count.string = count == 0 ? '+' : count.toString();
- if (type == 1) {
- if ((_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
- error: Error()
- }), GameLink) : GameLink).getInst().lv.dir == (_crd && LvDir === void 0 ? (_reportPossibleCrUseOfLvDir({
- error: Error()
- }), LvDir) : LvDir).none) {
- this.node.active = false;
- } else {
- this.node.active = true;
- }
- } //this.ad.active = count <= 0;
- } //
- async onClick(evt) {
- if (this._c <= 0) {
- (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
- error: Error()
- }), gui) : gui).show(_crd && UI_ad_get === void 0 ? (_reportPossibleCrUseOfUI_ad_get({
- error: Error()
- }), UI_ad_get) : UI_ad_get, this.type);
- } else {
- (_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
- error: Error()
- }), GameLink) : GameLink).getInst().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=763dcb86513069be85d26f144b1026f18455031a.js.map
|