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, Button, Component, easing, EventHandler, js, Tween, tween, Vec3, uiMgr, eventEmitter, Utils, GameConst, Logger, initAutoBindings, _dec, _class, _crd, ccclass, property, BaseExp;

  function _reportPossibleCrUseOfuiMgr(extras) {
    _reporterNs.report("uiMgr", "../manager/UIManager", _context.meta, extras);
  }

  function _reportPossibleCrUseOfeventEmitter(extras) {
    _reporterNs.report("eventEmitter", "../event/EventEmitter", _context.meta, extras);
  }

  function _reportPossibleCrUseOfUtils(extras) {
    _reporterNs.report("Utils", "../utils/Utils", _context.meta, extras);
  }

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

  function _reportPossibleCrUseOfLogger(extras) {
    _reporterNs.report("Logger", "../extend/Logger", _context.meta, extras);
  }

  function _reportPossibleCrUseOfinitAutoBindings(extras) {
    _reporterNs.report("initAutoBindings", "../extend/AutoBind", _context.meta, extras);
  }

  return {
    setters: [function (_unresolved_) {
      _reporterNs = _unresolved_;
    }, function (_cc) {
      _cclegacy = _cc.cclegacy;
      __checkObsolete__ = _cc.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
      _decorator = _cc._decorator;
      Button = _cc.Button;
      Component = _cc.Component;
      easing = _cc.easing;
      EventHandler = _cc.EventHandler;
      js = _cc.js;
      Tween = _cc.Tween;
      tween = _cc.tween;
      Vec3 = _cc.Vec3;
    }, function (_unresolved_2) {
      uiMgr = _unresolved_2.uiMgr;
    }, function (_unresolved_3) {
      eventEmitter = _unresolved_3.eventEmitter;
    }, function (_unresolved_4) {
      Utils = _unresolved_4.default;
    }, function (_unresolved_5) {
      GameConst = _unresolved_5.GameConst;
    }, function (_unresolved_6) {
      Logger = _unresolved_6.Logger;
    }, function (_unresolved_7) {
      initAutoBindings = _unresolved_7.initAutoBindings;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "f7232bGb6xDy4F0OYIYaAsF", "BaseExp", undefined);

      __checkObsolete__(['_decorator', 'Button', 'Component', 'easing', 'EventHandler', 'EventTouch', 'js', 'Node', 'Tween', 'tween', 'Vec3']);

      ({
        ccclass,
        property
      } = _decorator);

      _export("BaseExp", BaseExp = (_dec = ccclass('BaseExp'), _dec(_class = class BaseExp extends Component {
        constructor() {
          super(...arguments);
          this.layer = (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).WIN_LAYER.POPUP;
          this.winType = (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).WIN_TYPE.NORMAL;
          this.destroyAfterClose = false;
          //关闭后销毁资源
          //事件数组
          this.events = [];
          //是否有出场动画
          this._hasAnim = true;
        }

        set hasAnim(value) {
          if (value) {
            this.showAnim();
          }

          this._hasAnim = value;
        }

        onLoad() {
          this.events = []; //加入按钮点击

          this._addClickEvent(this.node); //自动绑定属性


          (_crd && initAutoBindings === void 0 ? (_reportPossibleCrUseOfinitAutoBindings({
            error: Error()
          }), initAutoBindings) : initAutoBindings)(this);
        }
        /**
         * 展示加载缓动动画
         */


        showAnim() {
          var uiBG = this.node.getChildByName("UI");

          if (uiBG) {
            Tween.stopAllByTarget(uiBG);
            uiBG.scale = new Vec3(0.95, 0.95, 0.95);
            tween(uiBG).to(0.12, {
              scale: new Vec3(1.04, 1.04, 1.04)
            }, {
              easing: easing.backOut
            }).to(0.2, {
              scale: new Vec3(1, 1, 1)
            }, {
              easing: easing.backOut
            }).call(() => {}).start();
          }
        }
        /**
         * 关闭页面
         * @param cb 关闭页面的回调
         */


        close(cb) {
          var pagePath = this.node["_uiPath"];

          if (!(_crd && Utils === void 0 ? (_reportPossibleCrUseOfUtils({
            error: Error()
          }), Utils) : Utils).isNull(pagePath)) {
            (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
              error: Error()
            }), uiMgr) : uiMgr).hide(pagePath, cb);
          } else {
            (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
              error: Error()
            }), Logger) : Logger).log("\u8BF7\u68C0\u67E5\u8BE5: " + this.node.name + "\u9875\u9762\u8DEF\u5F84\u4FE1\u606F\uFF0C\u4E0D\u5B58\u5728");
          }
        }
        /**
         * 点击事件
         * @param event 事件
         * @param customEventData 数据
         */


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

          if (btnName === 'close_btn') {
            this.close();
          }
        }
        /**
         * 是否允许添加
         * @param node 添加的节点
         */


        _isSkipNode(node) {
          if (this.node == node) {
            return false;
          }

          var b = node.getComponent(BaseExp);
          if (b) (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
            error: Error()
          }), Logger) : Logger).log("跳过", b.name);
          return b != null;
        }
        /**
         * 加入点击事件
         * @param node 加入点击的节点
         */


        _addClickEvent(node) {
          if (this._isSkipNode(node)) return;

          for (var i = 0; i < node.children.length; i++) {
            var n = node.children[i];
            if (this._isSkipNode(n)) continue;

            if (n.getComponent(Button)) {
              this.addClickEvent(n, this.node, js.getClassName(this), "onBtnClicked", n);
            }

            this._addClickEvent(n);
          }
        }
        /**
         * 加入按钮点击事件
         * @param node 点击的节点
         * @param target 点击的对象
         * @param component 组建的类名
         * @param handler 处理的具柄
         * @param customEventData 传递的数据
         */


        addClickEvent(node, target, component, handler, customEventData) {
          var eventHandler = new EventHandler();
          eventHandler.target = target;
          eventHandler.component = component;
          eventHandler.handler = handler;

          if (customEventData) {
            eventHandler.customEventData = customEventData;
          }

          var clickEvents = node.getComponent(Button).clickEvents;

          if (clickEvents.length > 0) {
            (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
              error: Error()
            }), Logger) : Logger).log(node.name + "\u6309\u94AE\u5DF2\u7ECF\u5B58\u5728\u7ED1\u5B9A\uFF0C\u8DF3\u8FC7\u81EA\u52A8\u7ED1\u5B9A");
            return;
          }

          clickEvents.push(eventHandler);
        } //销毁的时候注销所有的事件


        onDestroy() {
          for (var i = 0; i < this.events.length; i++) {
            (_crd && eventEmitter === void 0 ? (_reportPossibleCrUseOfeventEmitter({
              error: Error()
            }), eventEmitter) : eventEmitter).unregister(this, this.events[i]);
          }
        } //注册事件


        register(type, cb) {
          this.events.push(type);
          (_crd && eventEmitter === void 0 ? (_reportPossibleCrUseOfeventEmitter({
            error: Error()
          }), eventEmitter) : eventEmitter).register(this, type, cb);
        } //取消注册的时间


        unregister(type) {
          (_crd && eventEmitter === void 0 ? (_reportPossibleCrUseOfeventEmitter({
            error: Error()
          }), eventEmitter) : eventEmitter).unregister(this, type);
        } //事件派发


        dispatch(type) {
          for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            data[_key - 1] = arguments[_key];
          }

          (_crd && eventEmitter === void 0 ? (_reportPossibleCrUseOfeventEmitter({
            error: Error()
          }), eventEmitter) : eventEmitter).dispatch(type, ...data);
        }

      }) || _class));

      _cclegacy._RF.pop();

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