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

  var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, tween, v3, Label, Vec3, BOX_TYPE, ITEM_TYPE, BasePanel, Data, Utils, constants, audioManager, _dec, _class, _crd, ccclass, property, BoxLayer;

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

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

  function _reportPossibleCrUseOfTItem(extras) {
    _reporterNs.report("TItem", "../../../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 _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);
  }

  return {
    setters: [function (_unresolved_) {
      _reporterNs = _unresolved_;
    }, function (_cc) {
      _cclegacy = _cc.cclegacy;
      __checkObsolete__ = _cc.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
      _decorator = _cc._decorator;
      tween = _cc.tween;
      v3 = _cc.v3;
      Label = _cc.Label;
      Vec3 = _cc.Vec3;
    }, function (_unresolved_2) {
      BOX_TYPE = _unresolved_2.BOX_TYPE;
      ITEM_TYPE = _unresolved_2.ITEM_TYPE;
    }, function (_unresolved_3) {
      BasePanel = _unresolved_3.default;
    }, function (_unresolved_4) {
      Data = _unresolved_4.default;
    }, function (_unresolved_5) {
      Utils = _unresolved_5.default;
    }, function (_unresolved_6) {
      constants = _unresolved_6.constants;
    }, function (_unresolved_7) {
      audioManager = _unresolved_7.default;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "4b854Z4MQxMMoEv+1klVHm+", "BoxLayer", undefined);

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

      ({
        ccclass,
        property
      } = _decorator);

      _export("BoxLayer", BoxLayer = (_dec = ccclass('BoxLayer'), _dec(_class = class BoxLayer extends (_crd && BasePanel === void 0 ? (_reportPossibleCrUseOfBasePanel({
        error: Error()
      }), BasePanel) : BasePanel) {
        constructor() {
          super(...arguments);
          this.list = void 0;
          this.boxType = void 0;
          this.open = false;
        }

        start() {
          this.GetGameObject("item").active = false;
          this.GetGameObject("item").setPosition(Vec3.ZERO);
          this.GetGameObject("box").setPosition(Vec3.ZERO);
        } //最多奖励4个


        setInfo(boxType, list) {
          this.boxType = boxType;
          this.list = list;

          for (var i = 0; i < 4; ++i) {
            var tmp = this.GetGameObject("item").children[i];

            if (list[i]) {
              tmp.active = true;
              tmp.getChildByName("Time").active = list[i].type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
                error: Error()
              }), ITEM_TYPE) : ITEM_TYPE).Time;
              tmp.getChildByName("Frozen").active = list[i].type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
                error: Error()
              }), ITEM_TYPE) : ITEM_TYPE).Frozen;
              tmp.getChildByName("Hint").active = list[i].type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
                error: Error()
              }), ITEM_TYPE) : ITEM_TYPE).Hint;
              tmp.getChildByName("Magnet").active = list[i].type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
                error: Error()
              }), ITEM_TYPE) : ITEM_TYPE).Magnet;
              tmp.getChildByName("Coin").active = list[i].type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
                error: Error()
              }), ITEM_TYPE) : ITEM_TYPE).Coin;
              tmp.getChildByName("Label").getComponent(Label).string = "+" + list[i].num;
            } else {
              tmp.active = false;
            }
          }

          this.GetGameObject("chest-level-reward-close").active = boxType == (_crd && BOX_TYPE === void 0 ? (_reportPossibleCrUseOfBOX_TYPE({
            error: Error()
          }), BOX_TYPE) : BOX_TYPE).LEVEL;
          this.GetGameObject("chest-team-reward-close").active = boxType == (_crd && BOX_TYPE === void 0 ? (_reportPossibleCrUseOfBOX_TYPE({
            error: Error()
          }), BOX_TYPE) : BOX_TYPE).TEAM;
          this.GetGameObject("chest-star-reward-close").active = boxType == (_crd && BOX_TYPE === void 0 ? (_reportPossibleCrUseOfBOX_TYPE({
            error: Error()
          }), BOX_TYPE) : BOX_TYPE).STAR;
          this.GetGameObject("chest-level-reward-open").active = false;
          this.GetGameObject("chest-star-reward-open").active = false;
          this.GetGameObject("chest-team-reward-open").active = 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_open":
              if (this.open) {
                this.list.map(a => {
                  (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                    error: Error()
                  }), Data) : Data).user.addItem(a.type, a.num);

                  if (a.type == (_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
                    error: Error()
                  }), ITEM_TYPE) : ITEM_TYPE).Coin) {
                    (_crd && Utils === void 0 ? (_reportPossibleCrUseOfUtils({
                      error: Error()
                    }), Utils) : Utils).flyAnim((_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
                      error: Error()
                    }), ITEM_TYPE) : ITEM_TYPE).Coin, this.GetNode("item"), this.GetNodeFromCanvas("coin-icon"), 5, 50, b => {});
                  }
                });

                if (this.boxType == (_crd && BOX_TYPE === void 0 ? (_reportPossibleCrUseOfBOX_TYPE({
                  error: Error()
                }), BOX_TYPE) : BOX_TYPE).LEVEL) {
                  (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                    error: Error()
                  }), Data) : Data).user.lvboxDrawInfo[Math.floor((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                    error: Error()
                  }), Data) : Data).user.lv / 10)] = 1;
                } else if (this.boxType == (_crd && BOX_TYPE === void 0 ? (_reportPossibleCrUseOfBOX_TYPE({
                  error: Error()
                }), BOX_TYPE) : BOX_TYPE).STAR) {
                  (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                    error: Error()
                  }), Data) : Data).user.starboxDrawInfo[Math.floor((_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                    error: Error()
                  }), Data) : Data).user.star / 1000)] = 1;
                }

                (_crd && Data === void 0 ? (_reportPossibleCrUseOfData({
                  error: Error()
                }), Data) : Data).save();
                this.close();
              } else {
                this.open = true;
                this.GetGameObject("item").active = true;
                tween(this.GetGameObject("item")).by(0.3, {
                  worldPosition: v3(0, 90, 0)
                }).start();
                tween(this.GetGameObject("box")).by(0.3, {
                  worldPosition: v3(0, -60, 0)
                }).start();
                this.GetGameObject("chest-level-reward-close").active = false;
                this.GetGameObject("chest-team-reward-close").active = false;
                this.GetGameObject("chest-star-reward-close").active = false;
                this.GetGameObject("chest-level-reward-open").active = this.boxType == (_crd && BOX_TYPE === void 0 ? (_reportPossibleCrUseOfBOX_TYPE({
                  error: Error()
                }), BOX_TYPE) : BOX_TYPE).LEVEL;
                this.GetGameObject("chest-team-reward-open").active = this.boxType == (_crd && BOX_TYPE === void 0 ? (_reportPossibleCrUseOfBOX_TYPE({
                  error: Error()
                }), BOX_TYPE) : BOX_TYPE).TEAM;
                this.GetGameObject("chest-star-reward-open").active = this.boxType == (_crd && BOX_TYPE === void 0 ? (_reportPossibleCrUseOfBOX_TYPE({
                  error: Error()
                }), BOX_TYPE) : BOX_TYPE).STAR;
                this.SetText("lbl_btn", "领取");
              }

              break;
          }
        }

      }) || _class));

      _cclegacy._RF.pop();

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