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

  var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, GameConst, BasePanel, Data, Utils, platformSystem, audioManager, constants, _dec, _class, _crd, ccclass, property, BuyLifeLayer;

  function _reportPossibleCrUseOfGameConst(extras) {
    _reporterNs.report("GameConst", "../../../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 _reportPossibleCrUseOfUtils(extras) {
    _reporterNs.report("Utils", "../../../core/utils/Utils", _context.meta, extras);
  }

  function _reportPossibleCrUseOfplatformSystem(extras) {
    _reporterNs.report("platformSystem", "db://assets/platform/platformSystem", _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) {
      GameConst = _unresolved_2.default;
    }, function (_unresolved_3) {
      BasePanel = _unresolved_3.default;
    }, function (_unresolved_4) {
      Data = _unresolved_4.default;
    }, function (_unresolved_5) {
      Utils = _unresolved_5.default;
    }, function (_unresolved_6) {
      platformSystem = _unresolved_6.default;
    }, function (_unresolved_7) {
      audioManager = _unresolved_7.default;
    }, function (_unresolved_8) {
      constants = _unresolved_8.constants;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "98a55rrdspLsI3mkIbROuIw", "BuyLifeLayer", undefined);

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

      ({
        ccclass,
        property
      } = _decorator);

      _export("BuyLifeLayer", BuyLifeLayer = (_dec = ccclass('BuyLifeLayer'), _dec(_class = class BuyLifeLayer extends (_crd && BasePanel === void 0 ? (_reportPossibleCrUseOfBasePanel({
        error: Error()
      }), BasePanel) : BasePanel) {
        update() {
          this.SetText("lbl_life", (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.life + "");

          if ((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.life >= (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).MAX_LIFE) {
            this.SetText("lbl_life_time", "已满");
          } else {
            if ((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
              error: Error()
            }), Data) : Data).user.life_cost_time == 0) {
              (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).user.life_cost_time = Date.now();
            }

            let nLeft = (Date.now() - (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
              error: Error()
            }), Data) : Data).user.life_cost_time) / 1000;
            let addLife = Math.floor(nLeft / 60 / (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
              error: Error()
            }), GameConst) : GameConst).MAX_LIFE_RECOVERY_TIME);
            if (addLife > 0) (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
              error: Error()
            }), Data) : Data).user.life += addLife;
            nLeft -= addLife * (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
              error: Error()
            }), GameConst) : GameConst).MAX_LIFE_RECOVERY_TIME * 60;
            this.SetText("lbl_life_time", (_crd && Utils === void 0 ? (_reportPossibleCrUseOfUtils({
              error: Error()
            }), Utils) : Utils).getTimeStrByS((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
              error: Error()
            }), GameConst) : GameConst).MAX_LIFE_RECOVERY_TIME * 60 - nLeft));
          }
        }

        star() {
          (_crd && platformSystem === void 0 ? (_reportPossibleCrUseOfplatformSystem({
            error: Error()
          }), platformSystem) : platformSystem).platform.showInterstitialAd();
        }

        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_ad":
              (_crd && platformSystem === void 0 ? (_reportPossibleCrUseOfplatformSystem({
                error: Error()
              }), platformSystem) : platformSystem).platform.showRewardVideo(b => {
                if (b) {
                  (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                    error: Error()
                  }), Data) : Data).user.life += 1;
                  (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                    error: Error()
                  }), Data) : Data).save();
                  this.close();
                }
              });
              break;
          }
        }

      }) || _class));

      _cclegacy._RF.pop();

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