System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7", "__unresolved_8", "__unresolved_9"], function (_export, _context) {
  "use strict";

  var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, ITEM_TYPE, BasePanel, Data, GameConst, MsgHints, WindowManager, Main, audioManager, constants, _dec, _class, _crd, ccclass, property, BuyItemLayer;

  function _reportPossibleCrUseOfITEM_TYPE(extras) {
    _reporterNs.report("ITEM_TYPE", "../../../core/common/GameConst", _context.meta, extras);
  }

  function _reportPossibleCrUseOfBasePanel(extras) {
    _reporterNs.report("BasePanel", "../../../core/component/BasePanel", _context.meta, extras);
  }

  function _reportPossibleCrUseOfData(extras) {
    _reporterNs.report("Data", "../../../core/manager/Data", _context.meta, extras);
  }

  function _reportPossibleCrUseOfGameConst(extras) {
    _reporterNs.report("GameConst", "../../../core/common/GameConst", _context.meta, extras);
  }

  function _reportPossibleCrUseOfMsgHints(extras) {
    _reporterNs.report("MsgHints", "../../../core/utils/MsgHints", _context.meta, extras);
  }

  function _reportPossibleCrUseOfWindowManager(extras) {
    _reporterNs.report("WindowManager", "../../../core/manager/WindowManager", _context.meta, extras);
  }

  function _reportPossibleCrUseOfMain(extras) {
    _reporterNs.report("Main", "../Main", _context.meta, extras);
  }

  function _reportPossibleCrUseOfaudioManager(extras) {
    _reporterNs.report("audioManager", "db://assets/manager/audioManager", _context.meta, extras);
  }

  function _reportPossibleCrUseOfconstants(extras) {
    _reporterNs.report("constants", "db://assets/data/constants", _context.meta, extras);
  }

  return {
    setters: [function (_unresolved_) {
      _reporterNs = _unresolved_;
    }, function (_cc) {
      _cclegacy = _cc.cclegacy;
      __checkObsolete__ = _cc.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
      _decorator = _cc._decorator;
    }, function (_unresolved_2) {
      ITEM_TYPE = _unresolved_2.ITEM_TYPE;
    }, function (_unresolved_3) {
      BasePanel = _unresolved_3.default;
    }, function (_unresolved_4) {
      Data = _unresolved_4.default;
    }, function (_unresolved_5) {
      GameConst = _unresolved_5.default;
    }, function (_unresolved_6) {
      MsgHints = _unresolved_6.default;
    }, function (_unresolved_7) {
      WindowManager = _unresolved_7.default;
    }, function (_unresolved_8) {
      Main = _unresolved_8.Main;
    }, function (_unresolved_9) {
      audioManager = _unresolved_9.default;
    }, function (_unresolved_10) {
      constants = _unresolved_10.constants;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "319a3lNH0ZNqJYKvBxPxIkf", "BuyItemLayer", undefined);

      __checkObsolete__(['_decorator', 'Component', 'Node']);

      ({
        ccclass,
        property
      } = _decorator);

      _export("BuyItemLayer", BuyItemLayer = (_dec = ccclass('BuyItemLayer'), _dec(_class = class BuyItemLayer extends (_crd && BasePanel === void 0 ? (_reportPossibleCrUseOfBasePanel({
        error: Error()
      }), BasePanel) : BasePanel) {
        constructor(...args) {
          super(...args);
          this.type = void 0;
        }

        setItemType(type) {
          this.type = type;
          this.GetGameObject("Magnet").active = type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
            error: Error()
          }), ITEM_TYPE) : ITEM_TYPE).Magnet;
          this.GetGameObject("Hint").active = type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
            error: Error()
          }), ITEM_TYPE) : ITEM_TYPE).Hint;
          this.GetGameObject("Frozen").active = type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
            error: Error()
          }), ITEM_TYPE) : ITEM_TYPE).Frozen;
          this.GetGameObject("Time").active = type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
            error: Error()
          }), ITEM_TYPE) : ITEM_TYPE).Time;
          this.SetText("lbl_name", (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).getItemName(type));
          (_crd && Main === void 0 ? (_reportPossibleCrUseOfMain({
            error: Error()
          }), Main) : Main).Instance()._GameUI.pasue = true;
        }

        onDestroy() {
          super.onDestroy();
          (_crd && Main === void 0 ? (_reportPossibleCrUseOfMain({
            error: Error()
          }), Main) : Main).Instance()._GameUI.pasue = false;
        }

        onBtnClicked(event, customEventData) {
          (_crd && audioManager === void 0 ? (_reportPossibleCrUseOfaudioManager({
            error: Error()
          }), audioManager) : audioManager).playOneShot((_crd && constants === void 0 ? (_reportPossibleCrUseOfconstants({
            error: Error()
          }), constants) : constants).audios.btnclick);
          var btnName = event.target.name;

          switch (btnName) {
            case "btn_close":
              this.close();
              break;

            case "btn_buy":
              if ((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).user.coin < 90) {
                (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
                  error: Error()
                }), WindowManager) : WindowManager).ins.open("BuyCoinLayer");
              } else {
                (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
                  error: Error()
                }), MsgHints) : MsgHints).show("购买成功！");
                (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                  error: Error()
                }), Data) : Data).user.coin -= 90;
                (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                  error: Error()
                }), Data) : Data).user.addItem(this.type, 3);
                (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                  error: Error()
                }), Data) : Data).save();
                this.close();
              }

              break;
          }
        }

      }) || _class));

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=8cfc393018c512140de262b420ac3b7cf8b56c99.js.map