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, BasePanel, Data, WindowManager, Main, levelsData, audioManager, constants, _dec, _class, _crd, ccclass, property, LevelClearLayer;

  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 _reportPossibleCrUseOfWindowManager(extras) {
    _reporterNs.report("WindowManager", "../../../core/manager/WindowManager", _context.meta, extras);
  }

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

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

      _cclegacy._RF.push({}, "93baa702sZFwbZLgUN08Djz", "LevelClearLayer", undefined);

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

      ({
        ccclass,
        property
      } = _decorator);

      _export("LevelClearLayer", LevelClearLayer = (_dec = ccclass('LevelClearLayer'), _dec(_class = class LevelClearLayer extends (_crd && BasePanel === void 0 ? (_reportPossibleCrUseOfBasePanel({
        error: Error()
      }), BasePanel) : BasePanel) {
        constructor() {
          super(...arguments);
          this.addstar = 0;
          this.real_add_star = 0;
          this.cur = 0;
          this.cdt = 0;
          this.ok = false;
        }

        start() {
          this.SetText("lbl_lvv", "关卡" + (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.lv + "\n通过");
          (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.lv++;
        }

        onBtnClicked(event, customEventData) {
          if (!this.ok) return;
          (_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_hall":
              (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).user.star += this.real_add_star;
              (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).save();
              this.close();
              (_crd && Main === void 0 ? (_reportPossibleCrUseOfMain({
                error: Error()
              }), Main) : Main).Instance().backHall();
              break;

            case "btn_next":
              (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).user.star += this.real_add_star;
              (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).save();
              this.close();
              (_crd && Main === void 0 ? (_reportPossibleCrUseOfMain({
                error: Error()
              }), Main) : Main).Instance().play();
              break;
          }
        }

        setAddStar(addstar) {
          this.real_add_star = addstar;
          this.addstar = addstar;
          this.cur = (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.star % 100;
          this.SetProgressBar("ProgressBar", this.cur / 100);
          this.SetText("lbl_pro", Math.floor(this.cur / 100) * 100 + "%");
        }

        update(dt) {
          if (this.ok) return;
          this.cdt += dt;
          if (this.cdt < 0.01) return;
          this.cdt = 0;

          if (this.addstar > 0) {
            this.addstar--;
            this.cur++;

            if (this.cur > 100) {
              this.cur = 100;
              this.ok = true;
            }
          } else {
            this.ok = true;
          }

          var OpenItems = (_crd && levelsData === void 0 ? (_reportPossibleCrUseOflevelsData({
            error: Error()
          }), levelsData) : levelsData).getNormModelDatas();

          if (this.ok && this.cur >= 100 && (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.openIndex < OpenItems.length - 1) {
            //解锁新物品
            (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
              error: Error()
            }), WindowManager) : WindowManager).ins.open("NewPackOpenedLayer", (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
              error: Error()
            }), Data) : Data).user.openIndex);
          }

          this.SetProgressBar("ProgressBar", this.cur / 100);
          this.SetText("lbl_pro", this.cur + "%");
        }

      }) || _class));

      _cclegacy._RF.pop();

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