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

  var _reporterNs, _cclegacy, _decorator, instantiate, Collider, PHY_GROUP, OTWAreaFlagComponent, OTWObjectComponent, OTWFlagComponent, _dec, _class, _crd, ccclass, property, OTWAreaComponent;

  function _reportPossibleCrUseOfIArea(extras) {
    _reporterNs.report("IArea", "../../../shared/gameClient/games/OccupationTheWarModels", _context.meta, extras);
  }

  function _reportPossibleCrUseOfICountry(extras) {
    _reporterNs.report("ICountry", "../../../shared/gameClient/games/OccupationTheWarModels", _context.meta, extras);
  }

  function _reportPossibleCrUseOfPHY_GROUP(extras) {
    _reporterNs.report("PHY_GROUP", "../Const", _context.meta, extras);
  }

  function _reportPossibleCrUseOfOTWAreaFlagComponent(extras) {
    _reporterNs.report("OTWAreaFlagComponent", "./OTWAreaFlagComponent", _context.meta, extras);
  }

  function _reportPossibleCrUseOfOTWAreaData(extras) {
    _reporterNs.report("OTWAreaData", "../Data/OTWAreaData", _context.meta, extras);
  }

  function _reportPossibleCrUseOfOTWGameData(extras) {
    _reporterNs.report("OTWGameData", "../Data/OTWGameData", _context.meta, extras);
  }

  function _reportPossibleCrUseOfOTWObjectComponent(extras) {
    _reporterNs.report("OTWObjectComponent", "./OTWObjectComponent", _context.meta, extras);
  }

  function _reportPossibleCrUseOfOTWFlagComponent(extras) {
    _reporterNs.report("OTWFlagComponent", "./OTWFlagComponent", _context.meta, extras);
  }

  return {
    setters: [function (_unresolved_) {
      _reporterNs = _unresolved_;
    }, function (_cc) {
      _cclegacy = _cc.cclegacy;
      _decorator = _cc._decorator;
      instantiate = _cc.instantiate;
      Collider = _cc.Collider;
    }, function (_unresolved_2) {
      PHY_GROUP = _unresolved_2.PHY_GROUP;
    }, function (_unresolved_3) {
      OTWAreaFlagComponent = _unresolved_3.OTWAreaFlagComponent;
    }, function (_unresolved_4) {
      OTWObjectComponent = _unresolved_4.OTWObjectComponent;
    }, function (_unresolved_5) {
      OTWFlagComponent = _unresolved_5.OTWFlagComponent;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "c9e237La+1DfIzVmqQZaiYC", "OTWAreaComponent", undefined);

      ({
        ccclass,
        property
      } = _decorator);

      _export("OTWAreaComponent", OTWAreaComponent = (_dec = ccclass('OTWAreaComponent'), _dec(_class = class OTWAreaComponent extends (_crd && OTWObjectComponent === void 0 ? (_reportPossibleCrUseOfOTWObjectComponent({
        error: Error()
      }), OTWObjectComponent) : OTWObjectComponent) {
        start() {
          var collider = this.getComponentInChildren(Collider);
          collider === null || collider === void 0 ? void 0 : collider.setGroup((_crd && PHY_GROUP === void 0 ? (_reportPossibleCrUseOfPHY_GROUP({
            error: Error()
          }), PHY_GROUP) : PHY_GROUP).Area);
          collider === null || collider === void 0 ? void 0 : collider.setMask(0xffffffff);
        }

        updateData(dt) {
          if (this.areaInfo.area.troopsCurr < this.areaInfo.area.troopsMax) {
            //增兵
            this.areaInfo.area.troopsCurrCalculate += this.areaInfo.area.troopsInc * dt;

            if (this.areaInfo.area.troopsCurrCalculate > this.areaInfo.area.troopsMax) {
              this.areaInfo.area.troopsCurrCalculate = this.areaInfo.area.troopsMax;
            }

            var curr = Math.floor(this.areaInfo.area.troopsCurrCalculate);

            if (curr > this.areaInfo.area.troopsCurr) {
              this.areaInfo.area.troopsCurr = curr;
              this.areaInfo.flagComp.updateShow();
            }
          }
        }

        static createNode(areaPrefab, areaFlagPrefab, getGameData, area, country, mainCamera, gameMgrNode, gameFlagUIWrapNode, gameObjWrapNode) {
          var node = instantiate(areaPrefab);
          node.name = "Area_" + area.areaIndex;
          var flagComp;
          var flagNode = (_crd && OTWFlagComponent === void 0 ? (_reportPossibleCrUseOfOTWFlagComponent({
            error: Error()
          }), OTWFlagComponent) : OTWFlagComponent).createFlagNode(_crd && OTWAreaFlagComponent === void 0 ? (_reportPossibleCrUseOfOTWAreaFlagComponent({
            error: Error()
          }), OTWAreaFlagComponent) : OTWAreaFlagComponent, getGameData, areaFlagPrefab, node, mainCamera, gameMgrNode, "OTWGameManager", "onAreaFlagUIUpdate", area.areaIndex.toString(), country, c => {
            flagComp = c;
          });
          gameFlagUIWrapNode.addChild(flagNode);
          var areaComp = node.getComponent(OTWAreaComponent);
          areaComp.getGameData = getGameData;
          node.setPosition(area.x, 0, area.z);
          gameObjWrapNode.addChild(node);
          var areaInfo = {
            area: area,
            country: country,
            areaNode: node,
            areaComp: areaComp,
            flagNode: flagNode,
            flagComp: flagComp
          };
          flagComp.areaInfo = areaInfo;
          areaComp.areaInfo = areaInfo;
          flagComp.updateShow();
          return areaInfo;
        }

      }) || _class));

      _cclegacy._RF.pop();

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