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

  var _reporterNs, _cclegacy, _decorator, Component, instantiate, Collider, PHY_GROUP, OTWTroopFlagComponent, OTWTroopRenderComponent, _dec, _class, _temp, _crd, ccclass, property, OTWTroopComponent;

  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

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

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

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

  function _reportPossibleCrUseOfOTWTroopFlagComponent(extras) {
    _reporterNs.report("OTWTroopFlagComponent", "./OTWTroopFlagComponent", _context.meta, extras);
  }

  function _reportPossibleCrUseOfOTWTroopInfo(extras) {
    _reporterNs.report("OTWTroopInfo", "./OTWTroopInfo", _context.meta, extras);
  }

  function _reportPossibleCrUseOfOTWTroopRenderComponent(extras) {
    _reporterNs.report("OTWTroopRenderComponent", "./OTWTroopRenderComponent", _context.meta, extras);
  }

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

      _cclegacy._RF.push({}, "7f29fxF9btB3o8o4AuhN4/Y", "OTWTroopComponent", undefined);

      ({
        ccclass,
        property
      } = _decorator);

      _export("OTWTroopComponent", OTWTroopComponent = (_dec = ccclass('OTWTroopComponent'), _dec(_class = (_temp = class OTWTroopComponent extends Component {
        constructor(...args) {
          super(...args);

          _defineProperty(this, "troopInfo", null);
        }

        onDestroy() {
          this.troopInfo = null;
        }

        start() {
          var collider = this.getComponent(Collider);
          collider === null || collider === void 0 ? void 0 : collider.setGroup((_crd && PHY_GROUP === void 0 ? (_reportPossibleCrUseOfPHY_GROUP({
            error: Error()
          }), PHY_GROUP) : PHY_GROUP).Troop);
          collider === null || collider === void 0 ? void 0 : collider.setMask(0xffffffff);
        }

        static createNode(troopPrefab, troopColliderPrefab, troopFlagPrefab, getMap, troop, mainCamera, gameMgrNode, gameFlagUIWrapNode, gameObjWrapNode) {
          var renderNode = instantiate(troopPrefab);
          renderNode.name = "TroopRender_" + troop.troopIndex;
          var renderComp = renderNode.getComponent(_crd && OTWTroopRenderComponent === void 0 ? (_reportPossibleCrUseOfOTWTroopRenderComponent({
            error: Error()
          }), OTWTroopRenderComponent) : OTWTroopRenderComponent);
          var flag = (_crd && OTWTroopFlagComponent === void 0 ? (_reportPossibleCrUseOfOTWTroopFlagComponent({
            error: Error()
          }), OTWTroopFlagComponent) : OTWTroopFlagComponent).createFlagNode(getMap, troop, troopFlagPrefab, renderNode, mainCamera, gameMgrNode, "onTroopFlagUIUpdate");
          gameFlagUIWrapNode.addChild(flag);
          renderNode.setPosition(troop.x, 0, troop.z);
          gameObjWrapNode.addChild(renderNode);
          var colliderNode = instantiate(troopColliderPrefab);
          colliderNode.name = "Troop_" + troop.troopIndex;
          var colliderNodeComp = colliderNode.getComponent(OTWTroopComponent);
          colliderNode.setPosition(troop.x, 0, troop.z);
          gameObjWrapNode.addChild(colliderNode);
          var troopInfo = {
            troopIndex: troop.troopIndex,
            renderNode: renderNode,
            colliderNode: colliderNode,
            flagNode: flag,
            flagComp: flag.getComponent(_crd && OTWTroopFlagComponent === void 0 ? (_reportPossibleCrUseOfOTWTroopFlagComponent({
              error: Error()
            }), OTWTroopFlagComponent) : OTWTroopFlagComponent)
          };
          renderComp.getMap = getMap;
          renderComp.troopInfo = troopInfo;
          colliderNodeComp.troopInfo = troopInfo;
          return troopInfo;
        }

      }, _temp)) || _class));

      _cclegacy._RF.pop();

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