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

  var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Singleton, GameConst, _dec, _class, _crd, ccclass, property, StateManager, stateMgr;

  function _reportPossibleCrUseOfSingleton(extras) {
    _reporterNs.report("Singleton", "./Singleton", _context.meta, extras);
  }

  function _reportPossibleCrUseOfGameConst(extras) {
    _reporterNs.report("GameConst", "../common/GameConst", _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) {
      Singleton = _unresolved_2.Singleton;
    }, function (_unresolved_3) {
      GameConst = _unresolved_3.GameConst;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "09b0bjVyx5PfLbkl4TC4vVJ", "StateManager", undefined);

      __checkObsolete__(['_decorator', 'Label', 'Node']);

      ({
        ccclass,
        property
      } = _decorator);
      StateManager = (_dec = ccclass('StateManager'), _dec(_class = class StateManager extends (_crd && Singleton === void 0 ? (_reportPossibleCrUseOfSingleton({
        error: Error()
      }), Singleton) : Singleton) {
        constructor() {
          super(...arguments);
          //存储状态字段与 UI 组件的绑定关系
          this.uiBindings = new Map();
        }

        /**
         * 注册UI组件
         * @param field 注册的key uiName
         * @param label 具体的文本
         */
        registerUI(field, label) {
          if (!this.uiBindings.has(field)) {
            this.uiBindings.set(field, []);
          } //将UI组件添加到绑定列表


          var uiArr = this.uiBindings.get(field);

          if (!uiArr.includes(label)) {
            uiArr.push(label);
          } //初始化UI显示


          this.updateSingleUI(field, label);
        }
        /**
         * 全局更新所有绑定该字段
         * @param field 注册的key uiName
         */


        updateAllUI(field) {
          var labels = this.uiBindings.get(field);

          if (labels) {
            labels.forEach(label => {
              this.updateSingleUI(field, label);
            });
          }
        }
        /**
         * 更新单个UI组件
         * @param field 
         * @param label 
         */


        updateSingleUI(field, com) {
          if (field == (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).playerName) {
            //
            com.string = "" + 1;
          } else if (field == (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).playerName) {
            //
            com.string = "" + 2;
          } else if (field == (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).playerInfoData) {
            //玩家信息变化
            com.refreshData();
          } else if (field == (_crd && GameConst === void 0 ? (_reportPossibleCrUseOfGameConst({
            error: Error()
          }), GameConst) : GameConst).playerName) {
            //
            com.active = true;
          }
        }

      }) || _class); //全局单例

      _export("stateMgr", stateMgr = StateManager.ins());

      _cclegacy._RF.pop();

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