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

  var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, v3, tween, BasePanel, WindowManager, Data, Utils, ITEM_FROZEN_LV, ITEM_HINT_LV, ITEM_TYPE, MsgHints, GameConst, levelsData, constants, audioManager, Main, _dec, _class, _crd, ccclass, property, GameUI;

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

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

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

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

  function _reportPossibleCrUseOfBuyItemLayer(extras) {
    _reporterNs.report("BuyItemLayer", "./gameui/BuyItemLayer", _context.meta, extras);
  }

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

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

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

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

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

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

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

      _cclegacy._RF.push({}, "77bd1Kn5NVDmrfcKi2ozH33", "GameUI", undefined);

      __checkObsolete__(['_decorator', 'v3', 'Node', 'tween']);

      ({
        ccclass,
        property
      } = _decorator);

      _export("GameUI", GameUI = (_dec = ccclass('GameUI'), _dec(_class = class GameUI extends (_crd && BasePanel === void 0 ? (_reportPossibleCrUseOfBasePanel({
        error: Error()
      }), BasePanel) : BasePanel) {
        constructor(...args) {
          super(...args);
          this.hint_time = 0;
          this.starNode = null;
          this.levelTime = 0;
          this.passedTime = 0;
          this.pasue = false;
          this.freezetime = false;
          this.star = 0;
        }

        onBtnClicked(event, customEventData) {
          var btnName = event.target.name;

          switch (btnName) {
            case "btn_pause":
              (_crd && audioManager === void 0 ? (_reportPossibleCrUseOfaudioManager({
                error: Error()
              }), audioManager) : audioManager).playOneShot((_crd && constants === void 0 ? (_reportPossibleCrUseOfconstants({
                error: Error()
              }), constants) : constants).audios.btnclick);
              this.pasue = true;
              (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
                error: Error()
              }), WindowManager) : WindowManager).ins.open("PauseLayer");
              break;

            case "item_left":
              (_crd && audioManager === void 0 ? (_reportPossibleCrUseOfaudioManager({
                error: Error()
              }), audioManager) : audioManager).playOneShot((_crd && constants === void 0 ? (_reportPossibleCrUseOfconstants({
                error: Error()
              }), constants) : constants).audios.btnclick);
              if (Date.now() - this.hint_time < 2000) return;

              if ((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).user.lv < (_crd && ITEM_HINT_LV === void 0 ? (_reportPossibleCrUseOfITEM_HINT_LV({
                error: Error()
              }), ITEM_HINT_LV) : ITEM_HINT_LV)) {
                (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
                  error: Error()
                }), MsgHints) : MsgHints).show("关卡" + (_crd && ITEM_HINT_LV === void 0 ? (_reportPossibleCrUseOfITEM_HINT_LV({
                  error: Error()
                }), ITEM_HINT_LV) : ITEM_HINT_LV) + "解锁");
                return;
              }

              if ((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).user.hint > 0) {
                this.dispatch((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
                  error: Error()
                }), GameConst) : GameConst).USE_ITEM_HINT);
                this.hint_time = Date.now();
              } else {
                (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
                  error: Error()
                }), WindowManager) : WindowManager).ins.open("BuyItemLayer").then(com => {
                  com.setItemType((_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
                    error: Error()
                  }), ITEM_TYPE) : ITEM_TYPE).Hint);
                });
              }

              break;

            case "btn_sp_01":
              //移除
              (_crd && audioManager === void 0 ? (_reportPossibleCrUseOfaudioManager({
                error: Error()
              }), audioManager) : audioManager).playOneShot((_crd && constants === void 0 ? (_reportPossibleCrUseOfconstants({
                error: Error()
              }), constants) : constants).audios.btnclick);

              (_crd && Main === void 0 ? (_reportPossibleCrUseOfMain({
                error: Error()
              }), Main) : Main)._instance._GameNode.remove();

              break;

            case "btn_sp_02":
              //凑齐
              (_crd && audioManager === void 0 ? (_reportPossibleCrUseOfaudioManager({
                error: Error()
              }), audioManager) : audioManager).playOneShot((_crd && constants === void 0 ? (_reportPossibleCrUseOfconstants({
                error: Error()
              }), constants) : constants).audios.btnclick);

              (_crd && Main === void 0 ? (_reportPossibleCrUseOfMain({
                error: Error()
              }), Main) : Main)._instance._GameNode.prompt();

              break;

            case "btn_sp_03":
              //乱序
              (_crd && audioManager === void 0 ? (_reportPossibleCrUseOfaudioManager({
                error: Error()
              }), audioManager) : audioManager).playOneShot((_crd && constants === void 0 ? (_reportPossibleCrUseOfconstants({
                error: Error()
              }), constants) : constants).audios.btnclick);

              (_crd && Main === void 0 ? (_reportPossibleCrUseOfMain({
                error: Error()
              }), Main) : Main)._instance._GameNode.mess();

              break;

            case "item_right":
              if (this.freezetime) {
                (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
                  error: Error()
                }), MsgHints) : MsgHints).show("冰冻中...");
                return;
              }

              if ((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).user.lv < (_crd && ITEM_FROZEN_LV === void 0 ? (_reportPossibleCrUseOfITEM_FROZEN_LV({
                error: Error()
              }), ITEM_FROZEN_LV) : ITEM_FROZEN_LV)) {
                (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
                  error: Error()
                }), MsgHints) : MsgHints).show("关卡" + (_crd && ITEM_FROZEN_LV === void 0 ? (_reportPossibleCrUseOfITEM_FROZEN_LV({
                  error: Error()
                }), ITEM_FROZEN_LV) : ITEM_FROZEN_LV) + "解锁");
                return;
              }

              if ((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                error: Error()
              }), Data) : Data).user.frozen > 0) {
                (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                  error: Error()
                }), Data) : Data).user.frozen--;
                this.freezetime = true;
                setTimeout(() => {
                  this.freezetime = false;
                }, 5000);
                (_crd && audioManager === void 0 ? (_reportPossibleCrUseOfaudioManager({
                  error: Error()
                }), audioManager) : audioManager).playOneShot((_crd && constants === void 0 ? (_reportPossibleCrUseOfconstants({
                  error: Error()
                }), constants) : constants).audios.freeze);
              } else {
                (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
                  error: Error()
                }), WindowManager) : WindowManager).ins.open("BuyItemLayer").then(com => {
                  com.setItemType((_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
                    error: Error()
                  }), ITEM_TYPE) : ITEM_TYPE).Frozen);
                });
              }

              break;
          }
        }

        start() {
          this.register((_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).USE_ITEM_TIME, this.doUseTime.bind(this));
          this.register("PAUSE_LAYER_CLOSE", () => {
            this.pasue = false;
          });
          this.starNode = this.GetGameObject("star-with-outline");
        }

        restart() {
          this.SetText("lbl_lv", "关卡" + (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.lv);
          let obj = (_crd && levelsData === void 0 ? (_reportPossibleCrUseOflevelsData({
            error: Error()
          }), levelsData) : levelsData).getCurLevelInfo();
          console.log("关卡数据:", obj);
          this.levelTime = obj.time;
          this.GetGameObject("match-timer-freeze-background").active = false;
          this.GetGameObject("match-extra-time-power-up-small").active = false;
          this.SetText("lbl_left_item_lv", "关卡" + (_crd && ITEM_HINT_LV === void 0 ? (_reportPossibleCrUseOfITEM_HINT_LV({
            error: Error()
          }), ITEM_HINT_LV) : ITEM_HINT_LV));
          this.SetText("lbl_right_item_lv", "关卡" + (_crd && ITEM_FROZEN_LV === void 0 ? (_reportPossibleCrUseOfITEM_FROZEN_LV({
            error: Error()
          }), ITEM_FROZEN_LV) : ITEM_FROZEN_LV));
          this.freezetime = false;
          this.pasue = false;
          this.passedTime = 0;
        }

        doUseTime() {
          (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.time--;
          let node = this.GetGameObject("match-extra-time-power-up-small");
          node.active = true;
          node.setPosition(v3(0, 0, 0));
          tween(node).to(0.5, {
            worldPosition: this.GetGameObject("lbl_time").worldPosition
          }).call(() => {
            this.levelTime += 60;
            node.active = false;
          }).start();
        }

        update(dt) {
          if ((_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
            error: Error()
          }), WindowManager) : WindowManager).ins.isShow("OutOfBoxLayer") || (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
            error: Error()
          }), WindowManager) : WindowManager).ins.isShow("DrawStarLayer") || (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
            error: Error()
          }), WindowManager) : WindowManager).ins.isShow("LevelClearLayer") || (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
            error: Error()
          }), WindowManager) : WindowManager).ins.isShow("FailLayer")) return;
          this.GetGameObject("match-timer-freeze-background").active = this.freezetime;
          if (!this.pasue && !this.freezetime) this.passedTime += dt;
          this.SetText("lbl_star", this.star + "");
          let nLeft = this.levelTime - this.passedTime;

          if (nLeft > 0) {
            this.SetText("lbl_time", (_crd && Utils === void 0 ? (_reportPossibleCrUseOfUtils({
              error: Error()
            }), Utils) : Utils).getTimeStrByS(nLeft));
          } else {
            //游戏结束
            (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
              error: Error()
            }), WindowManager) : WindowManager).ins.open("FailLayer");
          }

          if ((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.lv < (_crd && ITEM_HINT_LV === void 0 ? (_reportPossibleCrUseOfITEM_HINT_LV({
            error: Error()
          }), ITEM_HINT_LV) : ITEM_HINT_LV)) {
            this.GetGameObject("item_left_Locked").active = true;
            this.GetGameObject("item_left_icon").active = false;
          } else {
            this.GetGameObject("item_left_Locked").active = false;
            this.GetGameObject("item_left_icon").active = true;
            this.SetText("lbl_item_left_count", (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
              error: Error()
            }), Data) : Data).user.hint == 0 ? "+" : (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
              error: Error()
            }), Data) : Data).user.hint + "");
          }

          if ((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
            error: Error()
          }), Data) : Data).user.lv < (_crd && ITEM_FROZEN_LV === void 0 ? (_reportPossibleCrUseOfITEM_FROZEN_LV({
            error: Error()
          }), ITEM_FROZEN_LV) : ITEM_FROZEN_LV)) {
            this.GetGameObject("item_right_Locked").active = true;
            this.GetGameObject("item_right_icon").active = false;
          } else {
            this.GetGameObject("item_right_Locked").active = false;
            this.GetGameObject("item_right_icon").active = true;
            this.SetText("lbl_item_rihgt_count", (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
              error: Error()
            }), Data) : Data).user.frozen == 0 ? "+" : (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
              error: Error()
            }), Data) : Data).user.frozen + "");
          }
        }

      }) || _class));

      _cclegacy._RF.pop();

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