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

  var _reporterNs, _cclegacy, _decorator, Component, Node, Prefab, Camera, instantiate, OTWFlagComponent, OTWTroopComponent, OTWTroopFlagComponent, OTWTroopRenderComponent, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _temp, _crd, ccclass, property, Test;

  function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }

  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 _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }

  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }

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

  function _reportPossibleCrUseOfOTWTroopComponent(extras) {
    _reporterNs.report("OTWTroopComponent", "../scripts/occupationTheWar/Components/OTWTroopComponent", _context.meta, extras);
  }

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

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

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

  function _reportPossibleCrUseOfOTWTroopData(extras) {
    _reporterNs.report("OTWTroopData", "../scripts/occupationTheWar/Data/OTWTroopData", _context.meta, extras);
  }

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

  return {
    setters: [function (_unresolved_) {
      _reporterNs = _unresolved_;
    }, function (_cc) {
      _cclegacy = _cc.cclegacy;
      _decorator = _cc._decorator;
      Component = _cc.Component;
      Node = _cc.Node;
      Prefab = _cc.Prefab;
      Camera = _cc.Camera;
      instantiate = _cc.instantiate;
    }, function (_unresolved_2) {
      OTWFlagComponent = _unresolved_2.OTWFlagComponent;
    }, function (_unresolved_3) {
      OTWTroopComponent = _unresolved_3.OTWTroopComponent;
    }, function (_unresolved_4) {
      OTWTroopFlagComponent = _unresolved_4.OTWTroopFlagComponent;
    }, function (_unresolved_5) {
      OTWTroopRenderComponent = _unresolved_5.OTWTroopRenderComponent;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "c7fdf7PkK9GRLMOUlmrII9o", "Test", undefined);

      ({
        ccclass,
        property
      } = _decorator);
      /**
       * Predefined variables
       * Name = Test
       * DateTime = Sat Mar 19 2022 15:38:05 GMT+0800 (中国标准时间)
       * Author = fengssy
       * FileBasename = Test.ts
       * FileBasenameNoExtension = Test
       * URL = db://assets/Test/Test.ts
       * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
       *
       */

      _export("Test", Test = (_dec = ccclass('Test'), _dec2 = property({
        type: Camera,
        tooltip: "主摄像机"
      }), _dec3 = property({
        type: Prefab,
        tooltip: "士兵渲染模型预制体"
      }), _dec4 = property({
        type: Prefab,
        tooltip: "士兵碰撞体预制体"
      }), _dec5 = property({
        type: Prefab,
        tooltip: "士兵旗帜UI的预制体"
      }), _dec6 = property({
        type: Node,
        tooltip: "存放所有游戏对象的3D节点"
      }), _dec7 = property({
        type: Node,
        tooltip: "存放所有Flag的UI节点"
      }), _dec(_class = (_class2 = (_temp = class Test extends Component {
        constructor() {
          super(...arguments);

          _initializerDefineProperty(this, "MainCamera", _descriptor, this);

          _initializerDefineProperty(this, "TroopRenderPrefab", _descriptor2, this);

          _initializerDefineProperty(this, "TroopColliderPrefab", _descriptor3, this);

          _initializerDefineProperty(this, "TroopFlagPrefab", _descriptor4, this);

          _initializerDefineProperty(this, "GameObjContainer", _descriptor5, this);

          _initializerDefineProperty(this, "GameObjFlagUI", _descriptor6, this);

          _defineProperty(this, "gameData", {
            map: {
              allCountry: {
                "1": {
                  countryId: "1",
                  playerConnId: null,
                  name: "中立1"
                }
              },
              allArea: [{
                areaIndex: 0,
                countryId: "1",
                troopsMax: 50,
                troopsCurr: 50,
                troopsCurrCalculate: 50,
                troopsInc: 1,
                troopsPreFSIndex: 0,
                x: 0,
                z: 0
              }, {
                areaIndex: 1,
                countryId: "1",
                troopsMax: 50,
                troopsCurr: 50,
                troopsCurrCalculate: 50,
                troopsInc: 1,
                troopsPreFSIndex: 0,
                x: 3,
                z: 0
              }],
              allPlayer: {},
              allAttackingTroop: []
            },
            allAreaInfo: [],
            allAttackingTroopInfo: [],
            myPlayer: null,
            myCountryId: null
          });

          _defineProperty(this, "getGameData", () => this.gameData);

          _defineProperty(this, "testTroopData", void 0);
        }

        start() {}

        click() {
          if (this.testTroopData) {
            var _this$testTroopData$r, _this$testTroopData$f;

            (_this$testTroopData$r = this.testTroopData.renderNode.parent) === null || _this$testTroopData$r === void 0 ? void 0 : _this$testTroopData$r.removeChild(this.testTroopData.renderNode);
            (_this$testTroopData$f = this.testTroopData.flagNode.parent) === null || _this$testTroopData$f === void 0 ? void 0 : _this$testTroopData$f.removeChild(this.testTroopData.flagNode);
          }

          var country = this.gameData.map.allCountry["1"];
          var troop = {
            troopIndex: this.gameData.map.allAttackingTroop.length,
            countryId: country.countryId,
            fromAreaIndex: 0,
            toAreaIndex: 1,
            troopsCount: 10,
            x: 0,
            z: 0
          };
          this.gameData.map.allAttackingTroop[troop.troopIndex] = troop;
          var gameObjWrapNode = this.GameObjContainer;
          var gameFlagUIWrapNode = this.GameObjFlagUI;
          var mainCamera = this.MainCamera;
          var getGameData = this.getGameData;
          var troopFlagPrefab = this.TroopFlagPrefab;
          var renderNode = instantiate(this.TroopRenderPrefab);
          renderNode.name = "TroopRender_" + troop.troopIndex;
          var flagComp;
          var flagNode = (_crd && OTWFlagComponent === void 0 ? (_reportPossibleCrUseOfOTWFlagComponent({
            error: Error()
          }), OTWFlagComponent) : OTWFlagComponent).createFlagNode(_crd && OTWTroopFlagComponent === void 0 ? (_reportPossibleCrUseOfOTWTroopFlagComponent({
            error: Error()
          }), OTWTroopFlagComponent) : OTWTroopFlagComponent, getGameData, troopFlagPrefab, renderNode, mainCamera, this.node, "Test", "onTroopFlagUIUpdate", troop.troopIndex.toString(), country, c => {
            flagComp = c;
          });
          gameFlagUIWrapNode.addChild(flagNode);
          var renderComp = renderNode.getComponent(_crd && OTWTroopRenderComponent === void 0 ? (_reportPossibleCrUseOfOTWTroopRenderComponent({
            error: Error()
          }), OTWTroopRenderComponent) : OTWTroopRenderComponent);
          renderNode.setPosition(troop.x, 0, troop.z);
          gameObjWrapNode.addChild(renderNode);
          var troopInfo = {
            troop: troop,
            fromArea: getGameData().map.allArea[0],
            toArea: getGameData().map.allArea[1],
            country: country,
            renderNode: renderNode,
            renderComp: renderComp,
            troopNode: renderNode,
            troopComp: new (_crd && OTWTroopComponent === void 0 ? (_reportPossibleCrUseOfOTWTroopComponent({
              error: Error()
            }), OTWTroopComponent) : OTWTroopComponent)(),
            flagNode: flagNode,
            flagComp: flagComp
          };
          renderComp.troopInfo = troopInfo;
          renderComp.getGameData = getGameData;
          flagComp.troopInfo = troopInfo;
          flagComp.getGameData = getGameData;
          flagComp.updateShow();
          this.testTroopData = troopInfo;
        }

        onTroopFlagUIUpdate(localUIPos, distanceScale, customEventData) {
          var _this$testTroopData;

          (_this$testTroopData = this.testTroopData) === null || _this$testTroopData === void 0 ? void 0 : _this$testTroopData.flagNode.setPosition(localUIPos);
          console.log('onTroopFlagUIUpdate', localUIPos, customEventData);
        }

        update(deltaTime) {
          if (this.testTroopData) {
            //this.testTroopData.troopComp.updateData(deltaTime);

            /*
            if(this.testTroopData.troop.x<5){
                this.testTroopData.troop.x += deltaTime;
            }
            */
            if (this.testTroopData.renderNode.position.x < 5) {
              this.testTroopData.renderNode.setPosition(this.testTroopData.renderNode.position.x + deltaTime, this.testTroopData.renderNode.position.y, this.testTroopData.renderNode.position.z);
            }
          }
        }

      }, _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "MainCamera", [_dec2], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: null
      }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "TroopRenderPrefab", [_dec3], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: null
      }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "TroopColliderPrefab", [_dec4], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: null
      }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "TroopFlagPrefab", [_dec5], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: null
      }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "GameObjContainer", [_dec6], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: null
      }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "GameObjFlagUI", [_dec7], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: null
      })), _class2)) || _class));

      _cclegacy._RF.pop();

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