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

  var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, tween, BasePanel, WindowManager, platformSystem, constants, audioManager, _dec, _class, _crd, ccclass, property, DrawStarLayer;

  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 _reportPossibleCrUseOfLevelClearLayer(extras) {
    _reporterNs.report("LevelClearLayer", "./LevelClearLayer", _context.meta, extras);
  }

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

      _cclegacy._RF.push({}, "7afe5oq/n9DwrKNNlUUERm9", "DrawStarLayer", undefined);

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

      ({
        ccclass,
        property
      } = _decorator);

      _export("DrawStarLayer", DrawStarLayer = (_dec = ccclass('DrawStarLayer'), _dec(_class = class DrawStarLayer extends (_crd && BasePanel === void 0 ? (_reportPossibleCrUseOfBasePanel({
        error: Error()
      }), BasePanel) : BasePanel) {
        constructor(...args) {
          super(...args);
          this.indicator = null;
          this.star = 0;
          this.dir = 1;
          this.beisu = 1;
          this.pause = false;
        }

        start() {
          this.indicator = this.GetGameObject("star-gamification-indicator");
          (_crd && audioManager === void 0 ? (_reportPossibleCrUseOfaudioManager({
            error: Error()
          }), audioManager) : audioManager).playOneShot((_crd && constants === void 0 ? (_reportPossibleCrUseOfconstants({
            error: Error()
          }), constants) : constants).audios.pass);
        }

        setStar(s) {
          this.star = s;
          this.SetText("lbl_star", s + "");
        }

        update() {
          if (this.pause) return;
          let pos = this.indicator.getPosition();
          pos.x += this.dir * 10;
          if (pos.x > 190) this.dir = -1;
          if (pos.x < -190) this.dir = 1;
          this.indicator.setPosition(pos);
          let x = this.indicator.getPosition().x;

          if (x >= -190 && x < -145) {
            this.beisu = 2;
          } else if (x >= -145 && x < -98) {
            this.beisu = 3;
          } else if (x >= -98 && x < -36) {
            this.beisu = 4;
          } else if (x >= -36 && x < 36) {
            this.beisu = 5;
          } else if (x >= 36 && x < 98) {
            this.beisu = 4;
          } else if (x >= 98 && x < 145) {
            this.beisu = 3;
          } else if (x >= 145 && x <= 190) {
            this.beisu = 2;
          }

          this.SetText("lbl_beisu", "x" + this.beisu);
        }

        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_get":
              this.pause = true;
              (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
                error: Error()
              }), WindowManager) : WindowManager).ins.open("LevelClearLayer").then(com => {
                com.setAddStar(this.star);
              });
              this.close();
              break;

            case "btn_ad":
              this.pause = true;
              tween(this.node).delay(1).call(() => {
                (_crd && platformSystem === void 0 ? (_reportPossibleCrUseOfplatformSystem({
                  error: Error()
                }), platformSystem) : platformSystem).platform.showRewardVideo(b => {
                  if (b) {
                    (_crd && WindowManager === void 0 ? (_reportPossibleCrUseOfWindowManager({
                      error: Error()
                    }), WindowManager) : WindowManager).ins.open("LevelClearLayer").then(com => {
                      com.setAddStar(this.star * this.beisu);
                    });
                    this.close();
                  }
                });
              }).start();
              break;
          }
        }

      }) || _class));

      _cclegacy._RF.pop();

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