Browse Source

添加任务演示版本

zansimple 8 months ago
parent
commit
a74d7f0ac8
49 changed files with 1029 additions and 443 deletions
  1. 241 14
      KYNetwork/Message/OuterMessage.cs
  2. 21 9
      KYNetwork/Message/OuterOpcode.cs
  3. 109 84
      Models/SimulationCommon/FXJHGenenrate.cs
  4. 22 1
      Models/SimulationCommon/FlightPlanEditor.cs
  5. 24 2
      Proto2CS/bin/Debug/net7.0/OuterMessage.proto
  6. BIN
      Proto2CS/bin/Debug/net7.0/Proto2CS.dll
  7. BIN
      Proto2CS/bin/Debug/net7.0/Proto2CS.exe
  8. BIN
      Proto2CS/bin/Debug/net7.0/Proto2CS.pdb
  9. 3 2
      SimulationServer/Component/TotalTaskPerformanceComponent.cs
  10. 1 1
      SimulationServer/Entity/AircraftEntity.cs
  11. 14 4
      SimulationServer/Entity/AircraftMHWithPersion.cs
  12. 10 1
      SimulationServer/Entity/AircraftSHJ.cs
  13. 5 2
      SimulationServer/Entity/AircraftXH.cs
  14. 5 2
      SimulationServer/Entity/AircraftZC.cs
  15. 16 1
      SimulationServer/Entity/FireGround.cs
  16. 13 1
      SimulationServer/Entity/MHRescueMission.cs
  17. 23 13
      SimulationServer/Entity/MHRescueMissionSystem.cs
  18. 2 1
      SimulationServer/Entity/XHRescueMission.cs
  19. 2 2
      SimulationServer/Entity/XHRescueMissionSystem.cs
  20. 4 4
      SimulationServer/Entity/ZCRescueMission.cs
  21. 207 0
      SimulationServer/EventHandler/CreateTaskEventHandler.cs
  22. 21 1
      SimulationServer/EventHandler/EventStruct.cs
  23. 1 0
      SimulationServer/EventHandler/MHSimulationOverrEventHandler.cs
  24. 18 201
      SimulationServer/EventHandler/ServerStartEventHandler.cs
  25. 1 0
      SimulationServer/EventHandler/XHSimulationOverrEventHandler.cs
  26. 1 1
      SimulationServer/Init.cs
  27. 59 0
      SimulationServer/MessageHandler/C2S_GetReportMessageHandler.cs
  28. 1 2
      SimulationServer/MessageHandler/C2S_StmulationStartMessageHandler.cs
  29. 1 0
      SimulationServer/MessageHandler/C2S_StmulationTimeScaleMessageHandler.cs
  30. 23 0
      SimulationServer/Utils/Util.cs
  31. BIN
      SimulationServer/bin/Debug/net7.0/KYFramework.dll
  32. BIN
      SimulationServer/bin/Debug/net7.0/KYFramework.pdb
  33. BIN
      SimulationServer/bin/Debug/net7.0/KYNetwork.dll
  34. BIN
      SimulationServer/bin/Debug/net7.0/KYNetwork.pdb
  35. 32 67
      SimulationServer/bin/Debug/net7.0/Missions/editor_config.json
  36. 149 27
      SimulationServer/bin/Debug/net7.0/Missions/task_config.json
  37. BIN
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/AC-313A-根河-0灭火任务单机指标报告.xls
  38. BIN
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/Ka-32-根河-0灭火任务单机指标报告.xls
  39. BIN
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/Ka-32-根河-2灭火任务单机指标报告.xls
  40. BIN
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/灭火任务总体指标报告.xls
  41. BIN
      SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/装备体系评估报告.xls
  42. BIN
      SimulationServer/bin/Debug/net7.0/SimulationCommon.dll
  43. BIN
      SimulationServer/bin/Debug/net7.0/SimulationCommon.pdb
  44. BIN
      SimulationServer/bin/Debug/net7.0/SimulationServer.dll
  45. BIN
      SimulationServer/bin/Debug/net7.0/SimulationServer.exe
  46. BIN
      SimulationServer/bin/Debug/net7.0/SimulationServer.pdb
  47. BIN
      SimulationServer/bin/Debug/net7.0/ThirdParty.dll
  48. BIN
      SimulationServer/bin/Debug/net7.0/ThirdParty.pdb
  49. BIN
      SimulationServer/bin/Debug/server.zip

+ 241 - 14
KYNetwork/Message/OuterMessage.cs

@@ -2681,6 +2681,213 @@ namespace KYFramework.Network {
 
   }
 
+  public partial class C2S_GetReport : pb::IMessage {
+    private static readonly pb::MessageParser<C2S_GetReport> _parser = new pb::MessageParser<C2S_GetReport>(() => (C2S_GetReport)MessagePool.Instance.Fetch(typeof(C2S_GetReport)));
+    public static pb::MessageParser<C2S_GetReport> Parser { get { return _parser; } }
+
+    private int rpcId_;
+    public int RpcId {
+      get { return rpcId_; }
+      set {
+        rpcId_ = value;
+      }
+    }
+
+    public void WriteTo(pb::CodedOutputStream output) {
+      if (RpcId != 0) {
+        output.WriteRawTag(208, 5);
+        output.WriteInt32(RpcId);
+      }
+    }
+
+    public int CalculateSize() {
+      int size = 0;
+      if (RpcId != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
+      }
+      return size;
+    }
+
+    public void MergeFrom(pb::CodedInputStream input) {
+      rpcId_ = 0;
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            input.SkipLastField();
+            break;
+          case 720: {
+            RpcId = input.ReadInt32();
+            break;
+          }
+        }
+      }
+    }
+
+  }
+
+  public partial class S2C_GetReport : pb::IMessage {
+    private static readonly pb::MessageParser<S2C_GetReport> _parser = new pb::MessageParser<S2C_GetReport>(() => (S2C_GetReport)MessagePool.Instance.Fetch(typeof(S2C_GetReport)));
+    public static pb::MessageParser<S2C_GetReport> Parser { get { return _parser; } }
+
+    private int rpcId_;
+    public int RpcId {
+      get { return rpcId_; }
+      set {
+        rpcId_ = value;
+      }
+    }
+
+    private int error_;
+    public int Error {
+      get { return error_; }
+      set {
+        error_ = value;
+      }
+    }
+
+    private string message_ = "";
+    public string Message {
+      get { return message_; }
+      set {
+        message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    private static readonly pb::FieldCodec<global::KYFramework.Network.ResportWithTaskName> _repeated_reports_codec
+        = pb::FieldCodec.ForMessage(746, global::KYFramework.Network.ResportWithTaskName.Parser);
+    private pbc::RepeatedField<global::KYFramework.Network.ResportWithTaskName> reports_ = new pbc::RepeatedField<global::KYFramework.Network.ResportWithTaskName>();
+    public pbc::RepeatedField<global::KYFramework.Network.ResportWithTaskName> Reports {
+      get { return reports_; }
+      set { reports_ = value; }
+    }
+
+    public void WriteTo(pb::CodedOutputStream output) {
+      if (RpcId != 0) {
+        output.WriteRawTag(208, 5);
+        output.WriteInt32(RpcId);
+      }
+      if (Error != 0) {
+        output.WriteRawTag(216, 5);
+        output.WriteInt32(Error);
+      }
+      if (Message.Length != 0) {
+        output.WriteRawTag(226, 5);
+        output.WriteString(Message);
+      }
+      reports_.WriteTo(output, _repeated_reports_codec);
+    }
+
+    public int CalculateSize() {
+      int size = 0;
+      if (RpcId != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
+      }
+      if (Error != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
+      }
+      if (Message.Length != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
+      }
+      size += reports_.CalculateSize(_repeated_reports_codec);
+      return size;
+    }
+
+    public void MergeFrom(pb::CodedInputStream input) {
+      rpcId_ = 0;
+      error_ = 0;
+      message_ = "";
+      for (int i = 0; i < reports_.Count; i++) { MessagePool.Instance.Recycle(reports_[i]); }
+      reports_.Clear();
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            input.SkipLastField();
+            break;
+          case 720: {
+            RpcId = input.ReadInt32();
+            break;
+          }
+          case 728: {
+            Error = input.ReadInt32();
+            break;
+          }
+          case 738: {
+            Message = input.ReadString();
+            break;
+          }
+          case 746: {
+            reports_.AddEntriesFrom(input, _repeated_reports_codec);
+            break;
+          }
+        }
+      }
+    }
+
+  }
+
+  public partial class ResportWithTaskName : pb::IMessage {
+    private static readonly pb::MessageParser<ResportWithTaskName> _parser = new pb::MessageParser<ResportWithTaskName>(() => (ResportWithTaskName)MessagePool.Instance.Fetch(typeof(ResportWithTaskName)));
+    public static pb::MessageParser<ResportWithTaskName> Parser { get { return _parser; } }
+
+    private int firePointId_;
+    public int FirePointId {
+      get { return firePointId_; }
+      set {
+        firePointId_ = value;
+      }
+    }
+
+    private static readonly pb::FieldCodec<global::KYFramework.Network.EntitySheetReportValue> _repeated_entitySheetReportValueArr_codec
+        = pb::FieldCodec.ForMessage(18, global::KYFramework.Network.EntitySheetReportValue.Parser);
+    private pbc::RepeatedField<global::KYFramework.Network.EntitySheetReportValue> entitySheetReportValueArr_ = new pbc::RepeatedField<global::KYFramework.Network.EntitySheetReportValue>();
+    public pbc::RepeatedField<global::KYFramework.Network.EntitySheetReportValue> EntitySheetReportValueArr {
+      get { return entitySheetReportValueArr_; }
+      set { entitySheetReportValueArr_ = value; }
+    }
+
+    public void WriteTo(pb::CodedOutputStream output) {
+      if (FirePointId != 0) {
+        output.WriteRawTag(8);
+        output.WriteInt32(FirePointId);
+      }
+      entitySheetReportValueArr_.WriteTo(output, _repeated_entitySheetReportValueArr_codec);
+    }
+
+    public int CalculateSize() {
+      int size = 0;
+      if (FirePointId != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(FirePointId);
+      }
+      size += entitySheetReportValueArr_.CalculateSize(_repeated_entitySheetReportValueArr_codec);
+      return size;
+    }
+
+    public void MergeFrom(pb::CodedInputStream input) {
+      firePointId_ = 0;
+      for (int i = 0; i < entitySheetReportValueArr_.Count; i++) { MessagePool.Instance.Recycle(entitySheetReportValueArr_[i]); }
+      entitySheetReportValueArr_.Clear();
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            input.SkipLastField();
+            break;
+          case 8: {
+            FirePointId = input.ReadInt32();
+            break;
+          }
+          case 18: {
+            entitySheetReportValueArr_.AddEntriesFrom(input, _repeated_entitySheetReportValueArr_codec);
+            break;
+          }
+        }
+      }
+    }
+
+  }
+
   /// <summary>
   /// 仿真开始 
   /// </summary>
@@ -2764,8 +2971,16 @@ namespace KYFramework.Network {
     private static readonly pb::MessageParser<S2C_StmulationEnd> _parser = new pb::MessageParser<S2C_StmulationEnd>(() => (S2C_StmulationEnd)MessagePool.Instance.Fetch(typeof(S2C_StmulationEnd)));
     public static pb::MessageParser<S2C_StmulationEnd> Parser { get { return _parser; } }
 
+    private int firePointId_;
+    public int FirePointId {
+      get { return firePointId_; }
+      set {
+        firePointId_ = value;
+      }
+    }
+
     private static readonly pb::FieldCodec<global::KYFramework.Network.EntitySheetReportValue> _repeated_entitySheetReportValueArr_codec
-        = pb::FieldCodec.ForMessage(10, global::KYFramework.Network.EntitySheetReportValue.Parser);
+        = pb::FieldCodec.ForMessage(18, global::KYFramework.Network.EntitySheetReportValue.Parser);
     private pbc::RepeatedField<global::KYFramework.Network.EntitySheetReportValue> entitySheetReportValueArr_ = new pbc::RepeatedField<global::KYFramework.Network.EntitySheetReportValue>();
     public pbc::RepeatedField<global::KYFramework.Network.EntitySheetReportValue> EntitySheetReportValueArr {
       get { return entitySheetReportValueArr_; }
@@ -2773,16 +2988,24 @@ namespace KYFramework.Network {
     }
 
     public void WriteTo(pb::CodedOutputStream output) {
+      if (FirePointId != 0) {
+        output.WriteRawTag(8);
+        output.WriteInt32(FirePointId);
+      }
       entitySheetReportValueArr_.WriteTo(output, _repeated_entitySheetReportValueArr_codec);
     }
 
     public int CalculateSize() {
       int size = 0;
+      if (FirePointId != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(FirePointId);
+      }
       size += entitySheetReportValueArr_.CalculateSize(_repeated_entitySheetReportValueArr_codec);
       return size;
     }
 
     public void MergeFrom(pb::CodedInputStream input) {
+      firePointId_ = 0;
       for (int i = 0; i < entitySheetReportValueArr_.Count; i++) { MessagePool.Instance.Recycle(entitySheetReportValueArr_[i]); }
       entitySheetReportValueArr_.Clear();
       uint tag;
@@ -2791,7 +3014,11 @@ namespace KYFramework.Network {
           default:
             input.SkipLastField();
             break;
-          case 10: {
+          case 8: {
+            FirePointId = input.ReadInt32();
+            break;
+          }
+          case 18: {
             entitySheetReportValueArr_.AddEntriesFrom(input, _repeated_entitySheetReportValueArr_codec);
             break;
           }
@@ -3517,11 +3744,11 @@ namespace KYFramework.Network {
       }
     }
 
-    private string firePointName_ = "";
-    public string FirePointName {
-      get { return firePointName_; }
+    private int firePointId_;
+    public int FirePointId {
+      get { return firePointId_; }
       set {
-        firePointName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+        firePointId_ = value;
       }
     }
 
@@ -3546,9 +3773,9 @@ namespace KYFramework.Network {
         output.WriteRawTag(10);
         output.WriteString(AircraftId);
       }
-      if (FirePointName.Length != 0) {
-        output.WriteRawTag(18);
-        output.WriteString(FirePointName);
+      if (FirePointId != 0) {
+        output.WriteRawTag(16);
+        output.WriteInt32(FirePointId);
       }
       if (FireGrids != 0D) {
         output.WriteRawTag(25);
@@ -3565,8 +3792,8 @@ namespace KYFramework.Network {
       if (AircraftId.Length != 0) {
         size += 1 + pb::CodedOutputStream.ComputeStringSize(AircraftId);
       }
-      if (FirePointName.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(FirePointName);
+      if (FirePointId != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(FirePointId);
       }
       if (FireGrids != 0D) {
         size += 1 + 8;
@@ -3579,7 +3806,7 @@ namespace KYFramework.Network {
 
     public void MergeFrom(pb::CodedInputStream input) {
       aircraftId_ = "";
-      firePointName_ = "";
+      firePointId_ = 0;
       uint tag;
       while ((tag = input.ReadTag()) != 0) {
         switch(tag) {
@@ -3590,8 +3817,8 @@ namespace KYFramework.Network {
             AircraftId = input.ReadString();
             break;
           }
-          case 18: {
-            FirePointName = input.ReadString();
+          case 16: {
+            FirePointId = input.ReadInt32();
             break;
           }
           case 25: {

+ 21 - 9
KYNetwork/Message/OuterOpcode.cs

@@ -60,6 +60,15 @@ namespace KYFramework.Network
 	[Message(OuterOpcode.S2C_TurningPointOutput)]
 	public partial class S2C_TurningPointOutput : IMessage {}
 
+	[Message(OuterOpcode.C2S_GetReport)]
+	public partial class C2S_GetReport : IRequest {}
+
+	[Message(OuterOpcode.S2C_GetReport)]
+	public partial class S2C_GetReport : IResponse {}
+
+	[Message(OuterOpcode.ResportWithTaskName)]
+	public partial class ResportWithTaskName {}
+
 	[Message(OuterOpcode.C2S_StmulationStart)]
 	public partial class C2S_StmulationStart : IMessage {}
 
@@ -112,14 +121,17 @@ namespace KYFramework.Network
 		 public const ushort S2C_FlyPlanOutput = 118;
 		 public const ushort PlanTurningPoint = 119;
 		 public const ushort S2C_TurningPointOutput = 120;
-		 public const ushort C2S_StmulationStart = 121;
-		 public const ushort C2S_StmulationTimeScale = 122;
-		 public const ushort S2C_StmulationEnd = 123;
-		 public const ushort EntitySheetReportValue = 124;
-		 public const ushort SheetReportValue = 125;
-		 public const ushort ReportValue = 126;
-		 public const ushort C2S_SimulationResult = 127;
-		 public const ushort S2C_SimulatinResult = 128;
-		 public const ushort S2C_FireSpread = 129;
+		 public const ushort C2S_GetReport = 121;
+		 public const ushort S2C_GetReport = 122;
+		 public const ushort ResportWithTaskName = 123;
+		 public const ushort C2S_StmulationStart = 124;
+		 public const ushort C2S_StmulationTimeScale = 125;
+		 public const ushort S2C_StmulationEnd = 126;
+		 public const ushort EntitySheetReportValue = 127;
+		 public const ushort SheetReportValue = 128;
+		 public const ushort ReportValue = 129;
+		 public const ushort C2S_SimulationResult = 130;
+		 public const ushort S2C_SimulatinResult = 131;
+		 public const ushort S2C_FireSpread = 132;
 	}
 }

+ 109 - 84
Models/SimulationCommon/FXJHGenenrate.cs

@@ -19,20 +19,25 @@ namespace Model
                 RemainingFuel = 0,
             });
 
-            double k;
-            double lat1, lon1; //直升机起飞后爬升到的航路点的经纬度,记为经纬度1
-            k = (editor.missionpoint.MissionPointLatitude - editor.originbase.BaseLatitude) /
-                (editor.missionpoint.MissionPointLongitude - editor.originbase.BaseLongitude);
-            if (editor.missionpoint.MissionPointLongitude > editor.originbase.BaseLongitude)
-            {
-                lat1 = 0.08544 * k / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLatitude; //经验公式
-                lon1 = 0.08544 / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLongitude;
-            }
-            else
-            {
-                lat1 = editor.originbase.BaseLatitude - 0.08544 * k / (Math.Sqrt(k * k + 1));
-                lon1 = editor.originbase.BaseLongitude - 0.08544 / (Math.Sqrt(k * k + 1));
-            }
+            // double k;
+               double lat1, lon1; //直升机起飞后爬升到的航路点的经纬度,记为经纬度1
+
+
+               lat1 = (editor.originbase.BaseLatitude + editor.missionpoint.MissionPointLatitude) / 2;
+               lon1 = (editor.originbase.BaseLongitude + editor.missionpoint.MissionPointLongitude) / 2;
+               
+            // k = (editor.missionpoint.MissionPointLatitude - editor.originbase.BaseLatitude) /
+            //     (editor.missionpoint.MissionPointLongitude - editor.originbase.BaseLongitude);
+            // if (editor.missionpoint.MissionPointLongitude > editor.originbase.BaseLongitude)
+            // {
+            //     lat1 = 0.08544 * k / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLatitude; //经验公式
+            //     lon1 = 0.08544 / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLongitude;
+            // }
+            // else
+            // {
+            //     lat1 = editor.originbase.BaseLatitude - 0.08544 * k / (Math.Sqrt(k * k + 1));
+            //     lon1 = editor.originbase.BaseLongitude - 0.08544 / (Math.Sqrt(k * k + 1));
+            // }
 
             turningPoints.Add(new TurningPoint
             {
@@ -259,7 +264,20 @@ namespace Model
 
             return missionEndPoint;
         }
-
+        public static void JijiangMiehuo1(FlightPlanEditor editor,ref List<TurningPoint> turningPoint)
+        {
+            turningPoint.Add(new TurningPoint
+            {
+                TurningPointName = "转运",
+                TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
+                TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
+                TurningPointHeight = editor.missionpoint.MissionPointHeight,
+                TurningPointType = "转运",
+                SegmentFlightFuelConsumption = 2,
+                SegmentFlightTime = 0,
+                RemainingFuel = 0,
+            });
+        }
         public static void JijiangMiehuo(FlightPlanEditor editor,ref List<TurningPoint> turningPoint)
         {
             turningPoint.Add(new TurningPoint
@@ -278,7 +296,7 @@ namespace Model
             {
                 TurningPointName = "转运",
                 TurningPointLongitude = editor.missionpoint.MissionPointLongitude,
-                TurningPointLatitude = editor.missionpoint.MissionPointLongitude,
+                TurningPointLatitude = editor.missionpoint.MissionPointLatitude,
                 TurningPointHeight = editor.missionpoint.MissionPointHeight,
                 TurningPointType = "转运",
                 SegmentFlightFuelConsumption = 2,
@@ -303,20 +321,22 @@ namespace Model
             });
        
 
-            double k;
+            //double k;
             double lat2, lon2;
-            k = (turningPoints[^1].TurningPointLatitude - editor.originbase.BaseLatitude) /
-                (turningPoints[^1].TurningPointLongitude - editor.originbase.BaseLongitude);
-            if (turningPoints[^1].TurningPointLongitude > editor.originbase.BaseLongitude)
-            {
-                lat2 = 0.08544 * k / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLatitude;
-                lon2 = 0.08544 / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLongitude;
-            }
-            else
-            {
-                lat2 = editor.originbase.BaseLatitude - 0.08544 * k / (Math.Sqrt(k * k + 1));
-                lon2 = editor.originbase.BaseLongitude - 0.08544 / (Math.Sqrt(k * k + 1));
-            }
+            lat2 = (turningPoints[^1].TurningPointLatitude + editor.originbase.BaseLatitude) / 2;
+            lon2 = (turningPoints[^1].TurningPointLongitude + editor.originbase.BaseLongitude) / 2;
+            // k = (turningPoints[^1].TurningPointLatitude - editor.originbase.BaseLatitude) /
+            //     (turningPoints[^1].TurningPointLongitude - editor.originbase.BaseLongitude);
+            // if (turningPoints[^1].TurningPointLongitude > editor.originbase.BaseLongitude)
+            // {
+            //     lat2 = 0.08544 * k / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLatitude;
+            //     lon2 = 0.08544 / (Math.Sqrt(k * k + 1)) + editor.originbase.BaseLongitude;
+            // }
+            // else
+            // {
+            //     lat2 = editor.originbase.BaseLatitude - 0.08544 * k / (Math.Sqrt(k * k + 1));
+            //     lon2 = editor.originbase.BaseLongitude - 0.08544 / (Math.Sqrt(k * k + 1));
+            // }
 
             turningPoints.Add(new TurningPoint
             {
@@ -567,63 +587,68 @@ namespace Model
                     break;
                 }
             }
-
-            currentLocation.PresentMission = turningPoints[segmentnumber].TurningPointName;
+            
             bool isEnd = false || segmentnumber >= turningPoints.Count;
             
-            if (segmentnumber <  turningPoints.Count - 1)
-            {
-                currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
-                                             ((turningPoints[segmentnumber + 1].TurningPointLongitude -
-                                               turningPoints[segmentnumber].TurningPointLongitude) /
-                                              turningPoints[segmentnumber].SegmentFlightTime) *
-                                             (nowtime - timetable[segmentnumber]);
-                currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
-                                             ((turningPoints[segmentnumber + 1].TurningPointLatitude -
-                                               turningPoints[segmentnumber].TurningPointLatitude) /
-                                              turningPoints[segmentnumber].SegmentFlightTime) *
-                                             (nowtime - timetable[segmentnumber]);
-                currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
-                                             ((turningPoints[segmentnumber + 1].TurningPointHeight -
-                                               turningPoints[segmentnumber].TurningPointHeight) /
-                                              turningPoints[segmentnumber].SegmentFlightTime) *
-                                             (nowtime - timetable[segmentnumber]);
-                currentLocation.CurrentFuel = turningPoints[segmentnumber].RemainingFuel -
-                                              turningPoints[segmentnumber].SegmentFlightFuelConsumption *
-                                              (nowtime - timetable[segmentnumber]);
-            }
-            else if (segmentnumber == turningPoints.Count - 1)
-            {
-                currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
-                                             ((turningPoints[0].TurningPointLongitude -
-                                               turningPoints[segmentnumber].TurningPointLongitude) /
-                                              turningPoints[segmentnumber].SegmentFlightTime) *
-                                             (nowtime - timetable[segmentnumber]);
-                currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
-                                             ((turningPoints[0].TurningPointLatitude -
-                                               turningPoints[segmentnumber].TurningPointLatitude) /
-                                              turningPoints[segmentnumber].SegmentFlightTime) *
-                                             (nowtime - timetable[segmentnumber]);
-                currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
-                                             ((turningPoints[0].TurningPointHeight -
-                                               turningPoints[segmentnumber].TurningPointHeight) /
-                                              turningPoints[segmentnumber].SegmentFlightTime) *
-                                             (nowtime - timetable[segmentnumber]);
-                currentLocation.CurrentFuel = turningPoints[segmentnumber].RemainingFuel -
-                                              turningPoints[segmentnumber].SegmentFlightFuelConsumption *
-                                              (nowtime - timetable[segmentnumber]);
-            }
-            else
-            {
-                currentLocation.CurrentLon = turningPoints[0].TurningPointLongitude;
-                currentLocation.CurrentLat = turningPoints[0].TurningPointLatitude;
-                currentLocation.CurrentHei = turningPoints[0].TurningPointHeight;
-                currentLocation.Currentvelo = 0;
-                currentLocation.CurrentFuel = turningPoints[segmentnumber - 1].RemainingFuel -
-                                              turningPoints[segmentnumber - 1].SegmentFlightFuelConsumption *
-                                              turningPoints[segmentnumber - 1].SegmentFlightTime;
-            }
-
+           
+              
+                if (segmentnumber <  turningPoints.Count - 1)
+                {
+                    currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
+                                                 ((turningPoints[segmentnumber + 1].TurningPointLongitude -
+                                                   turningPoints[segmentnumber].TurningPointLongitude) /
+                                                  turningPoints[segmentnumber].SegmentFlightTime) *
+                                                 (nowtime - timetable[segmentnumber]);
+                    currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
+                                                 ((turningPoints[segmentnumber + 1].TurningPointLatitude -
+                                                   turningPoints[segmentnumber].TurningPointLatitude) /
+                                                  turningPoints[segmentnumber].SegmentFlightTime) *
+                                                 (nowtime - timetable[segmentnumber]);
+                    currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
+                                                 ((turningPoints[segmentnumber + 1].TurningPointHeight -
+                                                   turningPoints[segmentnumber].TurningPointHeight) /
+                                                  turningPoints[segmentnumber].SegmentFlightTime) *
+                                                 (nowtime - timetable[segmentnumber]);
+                    currentLocation.CurrentFuel = turningPoints[segmentnumber].RemainingFuel -
+                                                  turningPoints[segmentnumber].SegmentFlightFuelConsumption *
+                                                  (nowtime - timetable[segmentnumber]);
+                    currentLocation.PresentMission = turningPoints[segmentnumber].TurningPointName;
+                }
+                else if (segmentnumber == turningPoints.Count - 1)
+                {
+                    currentLocation.CurrentLon = turningPoints[segmentnumber].TurningPointLongitude +
+                                                 ((turningPoints[0].TurningPointLongitude -
+                                                   turningPoints[segmentnumber].TurningPointLongitude) /
+                                                  turningPoints[segmentnumber].SegmentFlightTime) *
+                                                 (nowtime - timetable[segmentnumber]);
+                    currentLocation.CurrentLat = turningPoints[segmentnumber].TurningPointLatitude +
+                                                 ((turningPoints[0].TurningPointLatitude -
+                                                   turningPoints[segmentnumber].TurningPointLatitude) /
+                                                  turningPoints[segmentnumber].SegmentFlightTime) *
+                                                 (nowtime - timetable[segmentnumber]);
+                    currentLocation.CurrentHei = turningPoints[segmentnumber].TurningPointHeight +
+                                                 ((turningPoints[0].TurningPointHeight -
+                                                   turningPoints[segmentnumber].TurningPointHeight) /
+                                                  turningPoints[segmentnumber].SegmentFlightTime) *
+                                                 (nowtime - timetable[segmentnumber]);
+                    currentLocation.CurrentFuel = turningPoints[segmentnumber].RemainingFuel -
+                                                  turningPoints[segmentnumber].SegmentFlightFuelConsumption *
+                                                  (nowtime - timetable[segmentnumber]);
+                    currentLocation.PresentMission = turningPoints[segmentnumber].TurningPointName;
+                }
+                else
+                {
+                    currentLocation.CurrentLon = turningPoints[0].TurningPointLongitude;
+                    currentLocation.CurrentLat = turningPoints[0].TurningPointLatitude;
+                    currentLocation.CurrentHei = turningPoints[0].TurningPointHeight;
+                    currentLocation.Currentvelo = 0;
+                    currentLocation.CurrentFuel = turningPoints[segmentnumber - 1].RemainingFuel -
+                                                  turningPoints[segmentnumber - 1].SegmentFlightFuelConsumption *
+                                                  turningPoints[segmentnumber - 1].SegmentFlightTime;
+                    currentLocation.PresentMission = turningPoints[segmentnumber - 1].TurningPointName;
+
+                    isEnd = true;
+                }
             return (currentLocation,isEnd);
         }
     }

+ 22 - 1
Models/SimulationCommon/FlightPlanEditor.cs

@@ -17,7 +17,28 @@ public class FlightPlanEditor
     public MissionPoint missionpoint = new MissionPoint();
     [JsonProperty("火点")]
     public FirePoint[] firepoint = new FirePoint[1];
-
+    
+    public static FlightPlanEditor Create(AircraftParameter aircraftparameter, CityWeather cityweather, Base originbase, AirRoute[] airroute, MissionPoint missionpoint, FirePoint[] firepoint)
+    {
+        FlightPlanEditor flightPlanEditor = new FlightPlanEditor();
+        flightPlanEditor.aircraftparameter = aircraftparameter;
+        flightPlanEditor.cityweather = cityweather;
+        flightPlanEditor.originbase = originbase;
+        flightPlanEditor.airroute = airroute;
+        flightPlanEditor.missionpoint = missionpoint;
+        flightPlanEditor.firepoint = firepoint;
+        return flightPlanEditor;
+    }
+    public static FlightPlanEditor Create(AircraftParameter aircraftparameter, CityWeather cityweather, Base originbase,  MissionPoint missionpoint, FirePoint[] firepoint)
+    {
+        FlightPlanEditor flightPlanEditor = new FlightPlanEditor();
+        flightPlanEditor.aircraftparameter = aircraftparameter;
+        flightPlanEditor.cityweather = cityweather;
+        flightPlanEditor.originbase = originbase;
+        flightPlanEditor.missionpoint = missionpoint;
+        flightPlanEditor.firepoint = firepoint;
+        return flightPlanEditor;
+    }
 }
 
 

+ 24 - 2
Proto2CS/bin/Debug/net7.0/OuterMessage.proto

@@ -297,6 +297,25 @@ message S2C_TurningPointOutput // IMessage
 	double PresentVelocity = 16;
 }
 
+message C2S_GetReport // IRequest
+{
+	int32 RpcId = 90;
+}
+
+message S2C_GetReport // IResponse
+{
+	int32 RpcId = 90;
+	int32 Error = 91;
+	string Message = 92;
+	repeated ResportWithTaskName Reports = 93;
+}
+
+message ResportWithTaskName
+{
+	int32 FirePointId = 1;
+	repeated EntitySheetReportValue EntitySheetReportValueArr = 2;
+}
+
 
 /* 仿真开始 */
 message C2S_StmulationStart // IMessage
@@ -313,7 +332,8 @@ message C2S_StmulationTimeScale // IMessage
 /* 仿真结束 */
 message S2C_StmulationEnd // IMessage
 {
-	repeated EntitySheetReportValue EntitySheetReportValueArr = 1;
+	int32 FirePointId = 1;
+	repeated EntitySheetReportValue EntitySheetReportValueArr = 2;
 }
 
 message EntitySheetReportValue
@@ -395,8 +415,10 @@ message S2C_SimulatinResult // IResponse
 message S2C_FireSpread // IMessage
 {
 	string AircraftId = 1;
-	string FirePointName = 2;
+	int32 FirePointId = 2;
 	double fireGrids = 3;
 	double firedGrids = 4;
 }
 
+
+

BIN
Proto2CS/bin/Debug/net7.0/Proto2CS.dll


BIN
Proto2CS/bin/Debug/net7.0/Proto2CS.exe


BIN
Proto2CS/bin/Debug/net7.0/Proto2CS.pdb


+ 3 - 2
SimulationServer/Component/TotalTaskPerformanceComponent.cs

@@ -23,7 +23,8 @@ public class TotalTaskPerformanceComponent : Component
     {
         var mission = GetParent<MHRescueMission>();
         
-        TotalTaskPerformance.任务响应时间 = mission.aircrafts.Find(a => a is AircraftMH).TaskResponseTime.ToString("#0.00");
+        TotalTaskPerformance.任务响应时间 = mission.aircrafts.First().TaskResponseTime.ToString("#0.00");
+        
         TotalTaskPerformance.总任务耗时 = mission.tn.ToString("#0.00");
         TotalTaskPerformance.任务是否成功 = mission.Success ? "成功" : "失败";
         
@@ -42,7 +43,7 @@ public class TotalTaskPerformanceComponent : Component
         
         TotalTaskPerformance.过火面积 = end.burnarea.ToString("#0.00");
         
-        double x = end.burnarea;
+        double x = end.burnarea/10000;
         double y1 = 0.3096 * Math.Pow(x, 0.4893);
         double y2 = 1004.4520 * Math.Pow(x, 0.2193);
         double y3 = 0.2312 * Math.Pow(y1, 1.1668);

+ 1 - 1
SimulationServer/Entity/AircraftEntity.cs

@@ -17,7 +17,7 @@ public class AircraftEntity : Entity
     public double T { get; set; } // 飞机飞到火场需要的时间
     public double TotalFuelConsumption { get; set; } // 总燃油消耗
     public double FirstTime { get; set; } //单机入场时间
-    public double TaskResponseTime { get; set; } // 任务响应时间
+    public double TaskResponseTime { get; set; } = 600; // 任务响应时间
     public double EffMisTime { get; set; } // 单机有效任务时长
     public double TaskReadyTime { get; set; } // 任务准备时间
     public bool SyncOver { get; set; } // 是否同步完成

+ 14 - 4
SimulationServer/Entity/AircraftMHWithPersion.cs

@@ -42,10 +42,20 @@ public class AircraftMHWithPersion : AircraftEntity
         
         int TransportNumber = (int)Math.Ceiling(LandingPersonnel / FlightPlanEditor.aircraftparameter.MaxPassengerNumber);
         int j = 0;
+        
+        
         for (int i = 0; i < TransportNumber; i ++)
         {
-             FXJHGenerate.JijiangMiehuo(FlightPlanEditor,ref TurningPoints);
-            j += 2;
+            if (i == 0)
+            {
+                FXJHGenerate.JijiangMiehuo1(FlightPlanEditor,ref TurningPoints);
+            }
+            else
+            {
+                FXJHGenerate.JijiangMiehuo(FlightPlanEditor,ref TurningPoints);
+                j += 2;
+            }
+            
         }
         // FXJHGenerate.InitializeVelocities(FlightPlanEditor, TurningPoints, ref Velocitys);
         // FXJHGenerate.InitializeFuelConsumptions(FlightPlanEditor, TurningPoints,ref FuelConsumptions);
@@ -60,7 +70,7 @@ public class AircraftMHWithPersion : AircraftEntity
         //Log.Info("距离:" + distance);
         
         //Log.Info($"起飞准备时间: {FlightPlanEditor.aircraftparameter.TakeoffPreparationTime}");
-        InterventionTime = TaskReadyTime + TravelTime ;
+        InterventionTime = 600 + TravelTime ;
         
         //Log.Info($"人走到火场的时间: {InterventionTime}");
     
@@ -75,7 +85,7 @@ public class AircraftMHWithPersion : AircraftEntity
         InterventionNumber = LandingPersonnel + GroundPersonnel;
         T = InterventionTime;
     
-        TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[TransportNumber * 2 + 3].RemainingFuel;
+        TotalFuelConsumption = TurningPoints[0].RemainingFuel - TurningPoints[^1].RemainingFuel;
         T += Frequency;
         
         //Log.Info($"机降  洒水之前火场面积:" + _fireGround.countArea.burnarea);

+ 10 - 1
SimulationServer/Entity/AircraftSHJ.cs

@@ -15,12 +15,21 @@ public class AircraftSHJ : AircraftEntity
     public override void Start()
     {
         FXJHGenerate.FromStartToMission(FlightPlanEditor,ref TurningPoints);//生成从起点到任务段起点的航路点
-        double resulttime = Cable_slippage.get_result_time_rope(content.H,content.personNumber,content.windspeed,content.vis,content.descendspeed).time;//索滑降模型输出的索滑降时间
+        
+        
+        Log.Info(content.ToJson());
+        
+        double resulttime = Cable_slippage.get_result_time_rope(content.H,content.person_number,content.windspeed,content.vis,content.descendspeed).time;//索滑降模型输出的索滑降时间
         FXJHGenerate.SuoHuaJiang(resulttime, FlightPlanEditor,ref TurningPoints);
         
         
         FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.SuoHuaJiangMissionEndPoint(FlightPlanEditor),ref TurningPoints);
         FXJHGenerate.FXJHTPDiedai(FlightPlanEditor,ref TurningPoints, Velocitys, FuelConsumptions);
+        Log.Info("====================" + resulttime.ToString());
+        foreach (var turningPoint in TurningPoints)
+        {
+            Log.Info(turningPoint.ToJson());
+        }
 
     }
 }

+ 5 - 2
SimulationServer/Entity/AircraftXH.cs

@@ -109,11 +109,14 @@ public class AircraftXH : Entity
 }
 
 [ObjectSystem]
-public class AircraftXHAwakeSystem : AwakeSystem<AircraftXH,FlightPlanEditor>
+public class AircraftXHAwakeSystem : AwakeSystem<AircraftXH,FlightPlanEditor,string,string>
 {
-    public override void Awake(AircraftXH self,FlightPlanEditor planEditor)
+    public override void Awake(AircraftXH self,FlightPlanEditor planEditor,string name,string aircraftId)
     {
         self.FlightPlanEditor = planEditor;
+        self.Name = name;
+        self.AircraftId = aircraftId;
+        
         // 读取数据库
         self.Db = Util.GetAircraftDefine(self.FlightPlanEditor.aircraftparameter.AircraftType,self.FlightPlanEditor.aircraftparameter.AircraftSubType,self.FlightPlanEditor.aircraftparameter.AircraftID);
         self.helper = new EquationHelper(HttpInterface.baseUrl);

+ 5 - 2
SimulationServer/Entity/AircraftZC.cs

@@ -38,12 +38,15 @@ public class AircraftZC : AircraftEntity
 
 
 [ObjectSystem]
-public class AircraftZCAwakeSystem : AwakeSystem<AircraftZC,FlightPlanEditor,ZCTask>
+public class AircraftZCAwakeSystem : AwakeSystem<AircraftZC,FlightPlanEditor,ZCTask,int>
 {
-    public override void Awake(AircraftZC self,FlightPlanEditor flightPlanEditor,ZCTask zcTask)
+    public override void Awake(AircraftZC self,FlightPlanEditor flightPlanEditor,ZCTask zcTask,int index)
     {
         self.content = zcTask;
         self.FlightPlanEditor = flightPlanEditor;
         self.missionId = zcTask.missionInformation.MissionName;
+        self.AircraftId = zcTask.missionInformation.AircraftId[index];
+        self.Name = zcTask.missionInformation.AircraftInfos[index];
+        self.TaskReadyTime = zcTask.missionInformation.TakeoffPreparationTime;
     }
 }

+ 16 - 1
SimulationServer/Entity/FireGround.cs

@@ -4,11 +4,26 @@ namespace SimulationServer;
 
 public class FireGround : Entity
 {
-    public string FirePointName;
+    public int FirePointName;
     
     public Fire.CountArea countArea = new Fire.CountArea();
     //火点列表
     public DVector FirePoint;
 }
 
+[ObjectSystem]
+public class FireGroundAwakeSystem : AwakeSystem<FireGround, FirePoint>
+{
+    public override void Awake(FireGround self, FirePoint firePoint)
+    {
+        self.FirePointName = firePoint.FirePointId;
+        self.FirePoint = new DVector
+        {
+            Latitude = firePoint.FirePointLatitude,
+            Longitude = firePoint.FirePointLongitude,
+            Altitude = firePoint.FirePointHeight
+        };
+    }
+}
+
 

+ 13 - 1
SimulationServer/Entity/MHRescueMission.cs

@@ -68,7 +68,9 @@ public class MHRescueMission : Entity
         SaveMH();
         SaveTotalMH();
         ReportMH();
-        //this.StartAsyncMH();
+
+        var readyTime = aircrafts.First().TaskReadyTime;
+        Task.Delay(TimeSpan.FromSeconds(readyTime)).ContinueWith(t => this.StartAsyncMH());
         
 
         // if (currentExecuteCount > ExecutionContext)
@@ -265,6 +267,16 @@ public class MHRescueMission : Entity
     }
 }
 
+[ObjectSystem]
+public class MhRescueMissionAwakeSystem : AwakeSystem<MHRescueMission,FireGround,double>
+{
+    public override void Awake(MHRescueMission self, FireGround fire, double initArea)
+    {
+        self.FireGround = fire;
+        self.InitArea = initArea;
+    }
+}
+
 [ObjectSystem]
 public class RescueMissionUpdateSystem : UpdateSystem<MHRescueMission>
 {

+ 23 - 13
SimulationServer/Entity/MHRescueMissionSystem.cs

@@ -13,12 +13,13 @@ public static class MHRescueMissionSystem
     /// <param name="self"></param>
     public static void StartAsyncMH(this MHRescueMission self)
     {
-        foreach (var aircraft in self.aircrafts)
+        for (int i = 0; i < self.aircrafts.Count; i++)
         {
-            if(aircraft is AircraftZC) continue;
-            var location = FXJHGenerate.GetAllCurrentLocation(aircraft.TurningPoints, self.SimulationTime);
+            if(self.aircrafts[i].SyncOver) continue;
+            
+            var location = FXJHGenerate.GetAllCurrentLocation(self.aircrafts[i].TurningPoints, self.SimulationTime);
             
-            if (aircraft is AircraftMH aircraftMh )
+            if (self.aircrafts[i] is AircraftMH aircraftMh && aircraftMh.FireGrids.Count > 0 )
             {
                 Fire.FireGrid fireGrid = aircraftMh.FireGrids.First();
                 // 发送火焰数据
@@ -27,7 +28,7 @@ public static class MHRescueMissionSystem
                     //洒水了
                     S2C_FireSpread fireSpread = new S2C_FireSpread();
                     fireSpread.AircraftId = aircraftMh.AircraftId;
-                    fireSpread.FirePointName = self.FireGround.FirePointName;
+                    fireSpread.FirePointId = self.FireGround.FirePointName;
                     fireSpread.FireGrids = fireGrid.FireGrids;
                     fireSpread.FiredGrids = fireGrid.FiredGrids;
                     SessionComponent.Instance.Session.Send(fireSpread);
@@ -36,33 +37,42 @@ public static class MHRescueMissionSystem
             }
             
             // 同步信息到客户端
-            self.SyncLocation(location.Item1, aircraft);
+            self.SyncLocation(location.Item1, self.aircrafts[i]);
             
             if (location.Item2) // 判断飞机飞到终点
             {
-                aircraft.SyncOver = true;
+                self.aircrafts[i].SyncOver = true;
+                Log.Info(self.aircrafts[i].AircraftId + "飞机到终点");
             }
             
         }
         
         // 如果 aircraft.SyncOver 为 true ,从列表一处当前aircraft
-        self.aircrafts.RemoveAll(a => a.SyncOver);
+        //self.aircrafts.RemoveAll(a => a.SyncOver);
+
+        bool over = true;
+        
+        foreach (var aircraft in self.aircrafts)
+        {
+            if (aircraft.SyncOver == false)
+                over = false;
+        }
         
-        if (self.aircrafts.Count == 0)
+        if (over)
         {
             // 任务结束
             Game.EventSystem.Publish(new MHSimulationOver {Mission = self});
             return;
         }
         
-        self.SimulationTime++;
-        Task.Delay(TimeSpan.FromSeconds(1 / Init.SimulationSpeed)).ContinueWith(t => self.StartAsyncMH());
+        self.SimulationTime += Init.SimulationSpeed;
+        Task.Delay(TimeSpan.FromSeconds(1f)).ContinueWith(t => self.StartAsyncMH());
     }
     
     public static void SyncLocation(this MHRescueMission self,CurrentLocation location,AircraftEntity aircraft)
     {
         // 同步信息到客户端
-        if (location != null)
+        if (location != null && aircraft != null)
         {
             // 同步信息到客户端
             S2C_TurningPointOutput s2CTurningPointOutput = new S2C_TurningPointOutput();
@@ -80,7 +90,7 @@ public static class MHRescueMissionSystem
 
             s2CTurningPointOutput.PresentVelocity = location.Currentvelo;
             SessionComponent.Instance.Session.Send(s2CTurningPointOutput); 
-            Log.Info($"飞机{aircraft.Name} 当前位置: {location.ToJson()}");
+            //Log.Info($"飞机{aircraft.Name} 当前位置: {location.ToJson()}");
         }
     }
 }

+ 2 - 1
SimulationServer/Entity/XHRescueMission.cs

@@ -49,7 +49,8 @@ public class XHRescueMission : Entity
         End?.Invoke();
         SaveXH();
         ReportXH();
-        this.StartAsyncXH();
+        var readyTime = AircraftXHs.First().TaskReadyTime;
+        Task.Delay(TimeSpan.FromSeconds(readyTime)).ContinueWith(t => this.StartAsyncXH());
     }
 
     

+ 2 - 2
SimulationServer/Entity/XHRescueMissionSystem.cs

@@ -38,8 +38,8 @@ public static class XHRescueMissionSystem
             return;
         }
         
-        self.SimulationTime++;
-        Task.Delay(TimeSpan.FromSeconds(1 / Init.SimulationSpeed)).ContinueWith(t => self.StartAsyncXH());
+        self.SimulationTime += Init.SimulationSpeed;
+        Task.Delay(TimeSpan.FromSeconds(1f)).ContinueWith(t => self.StartAsyncXH());
     }
     
     public static void SyncLocation(this XHRescueMission self,CurrentLocation location,AircraftXH aircraft)

+ 4 - 4
SimulationServer/Entity/ZCRescueMission.cs

@@ -15,8 +15,8 @@ public class ZCRescueMission : Entity
     public void Start()
     {
         AircraftZCs?.ForEach(a => a.Start());
-        
-        this.StartAsyncZC();
+        var readyTime = AircraftZCs.First().TaskReadyTime;
+        Task.Delay(TimeSpan.FromSeconds(readyTime)).ContinueWith(t => this.StartAsyncZC());
     }
 }
 
@@ -52,8 +52,8 @@ public static class ZCRescueMissionSystem
             return;
         }
         
-        self.SimulationTime++;
-        Task.Delay(TimeSpan.FromSeconds(1 / Init.SimulationSpeed)).ContinueWith(t => self.StartAsyncZC());
+        self.SimulationTime += Init.SimulationSpeed;
+        Task.Delay(TimeSpan.FromSeconds(1f)).ContinueWith(t => self.StartAsyncZC());
     }
     
     public static void SyncLocation(this ZCRescueMission self,CurrentLocation location,AircraftEntity aircraft)

+ 207 - 0
SimulationServer/EventHandler/CreateTaskEventHandler.cs

@@ -0,0 +1,207 @@
+using Cysharp.Threading.Tasks;
+using KYFramework;
+using Model;
+using SimulationServer.Utils;
+
+namespace SimulationServer;
+
+[Event]
+public class CreateMHTaskEventHandler : AEvent<CreateMHTask>
+{
+    protected override UniTask Run(CreateMHTask config)
+    {
+        // TODO 创建灭火任务
+        var taskSys = Game.Scene.GetComponent<TaskComponent>();
+        
+        FirePoint point = config.EditorConfig.firePoints.Find(fire => fire.FirePointId == config.MHTaskConfig.FirePointId);
+        
+        // 创建火点
+        var fireGround = ComponentFactory.Create<FireGround,FirePoint>(point);
+        fireGround.FirePointName = point.FirePointId;
+        // 创建灭火任务        
+        var mission = ComponentFactory.Create<MHRescueMission,FireGround,double>(fireGround,point.InitialArea);
+        mission.AddComponent<TotalEconomicalComponent>();
+        mission.AddComponent<TotalTaskPerformanceComponent>();
+        mission.AddComponent<EquipmentComponent>();
+        
+        taskSys.MHRescueMissions.Add(mission);
+        
+        //查询坡度
+        mission.slope = Util.GetSlope(point.FirePointLongitude,
+            point.FirePointLatitude, 30);
+        
+        Log.Info($"创建任务 : {config.MHTaskConfig.TotalMHId}");
+        //创建吊桶灭火任务
+        foreach (MHTask mhTask in config.MHTaskConfig.mHTask)
+        {
+            Log.Info($"创建灭火任务 : {mhTask.missionInformation.MissionName}");
+            if(mhTask.missionInformation.AircraftInfos == null) continue;
+            for (int i = 0; i < mhTask.missionInformation.AircraftInfos.Length; i++)
+            {
+                //飞机参数
+                var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
+                    a => a.AircraftID == mhTask.missionInformation.AircraftInfos[i]);
+                //基地
+                var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
+            
+                //创建飞行计划编辑器
+                var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather,originBase,mhTask.MissionPoints[0], new []{point});
+                
+                AircraftMH aircraft = ComponentFactory.Create<AircraftMH, FlightPlanEditor>( flightPlanEditor);
+                aircraft.Name = mhTask.missionInformation.AircraftInfos[i];
+                aircraft.AircraftId = mhTask.missionInformation.AircraftId[i];
+                
+                aircraft.fireGround = fireGround;
+                aircraft.mhRescueMission = mission;
+                mission.aircrafts.Add(aircraft);
+                aircraft.Airport = flightPlanEditor.originbase.BaseName;
+                aircraft.TaskName = mhTask.missionInformation.MissionName;
+                mission.End += aircraft.End;
+                aircraft.AddComponent<StaticCapacityComponent>();
+                aircraft.AddComponent<TaskPerformanceComponent>();
+                aircraft.AddComponent<EconomicalComponent>();
+                aircraft.TaskReadyTime = mhTask.missionInformation.TakeoffPreparationTime;
+                Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
+            }
+        }
+        //创建机降灭火任务
+        foreach (DMMHTask dmmhTask in config.MHTaskConfig.dMMHTask)
+        {
+            Log.Info($"创建地面灭火任务 : {dmmhTask.missionInformation.MissionName}");
+            if(dmmhTask.missionInformation.AircraftInfos == null) continue;
+            for (int i = 0; i < dmmhTask.missionInformation.AircraftInfos.Length; i++)
+            {
+                //飞机参数
+                var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
+                    a => a.AircraftID == dmmhTask.missionInformation.AircraftInfos[i]);
+                //基地
+                var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
+            
+                //创建飞行计划编辑器
+                var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather,originBase,dmmhTask.MissionPoints[0], new []{point});
+                
+                AircraftMHWithPersion aircraftWithPerson = ComponentFactory.Create<AircraftMHWithPersion, FlightPlanEditor>( flightPlanEditor);
+                mission.End += aircraftWithPerson.End;
+                aircraftWithPerson.Name = dmmhTask.missionInformation.AircraftInfos[i];
+                aircraftWithPerson.fireGround = fireGround;
+                aircraftWithPerson.mhRescueMission = mission;
+                aircraftWithPerson.GroundPersonnel = (int)dmmhTask.GroundPersonnel;
+                aircraftWithPerson.LandingPersonnel = (int)dmmhTask.LandingPersonnel;
+                aircraftWithPerson.NextMissionId = dmmhTask.NextTaskId;
+                aircraftWithPerson.TaskName = dmmhTask.missionInformation.MissionName;
+                aircraftWithPerson.TaskReadyTime = dmmhTask.missionInformation.TakeoffPreparationTime;
+                aircraftWithPerson.AircraftId = dmmhTask.missionInformation.AircraftId[i];
+                
+                mission.aircrafts.Add(aircraftWithPerson);
+                Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
+            }
+        }
+        //创建索滑降任务
+        foreach (SHJTask shjTask in config.MHTaskConfig.sHJTask)
+        {
+            Log.Info($"创建索滑降任务 : {shjTask.missionInformation.MissionName}");
+            if(shjTask.missionInformation.AircraftInfos == null) continue;
+            for (int i = 0; i < shjTask.missionInformation.AircraftInfos.Length; i++)
+            {
+                //飞机参数
+                var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
+                    a => a.AircraftID == shjTask.missionInformation.AircraftInfos[i]);
+                //基地
+                var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
+            
+                //创建飞行计划编辑器
+                var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather,originBase,shjTask.MissionPoints[0], new []{point});
+
+                AircraftSHJ aircraftSHJ = ComponentFactory.Create<AircraftSHJ, FlightPlanEditor,SHJTask>( flightPlanEditor, shjTask);
+                mission.End += aircraftSHJ.End;
+                aircraftSHJ.AircraftId = shjTask.missionInformation.AircraftId[i];
+                mission.aircrafts.Add(aircraftSHJ);
+                Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
+            }
+        }
+        
+        
+        return UniTask.CompletedTask;
+    }
+}
+
+[Event]
+public class CreateZCTaskEventHandler : AEvent<CreateZCTask>
+{
+    protected override UniTask Run(CreateZCTask config)
+    {
+        var taskSys = Game.Scene.GetComponent<TaskComponent>();
+        ZCRescueMission mission = ComponentFactory.Create<ZCRescueMission>();
+        taskSys.ZCRescueMissions.Add(mission);
+        mission.MissionId = $"侦擦任务 {config.ZCTask.missionInformation.MissionName}";
+        
+        FirePoint point = config.EditorConfig.firePoints.Find(f => f.FirePointId == config.ZCTask.FirePointId);
+       
+        for (int i = 0; i < config.ZCTask.missionInformation.AircraftInfos.Length; i++)
+        {
+            //飞机参数
+            var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
+                a => a.AircraftID == config.ZCTask.missionInformation.AircraftInfos[i]);
+            //基地
+            var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
+            
+            //创建飞行计划编辑器
+            var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather,originBase,config.ZCTask.MissionPoints[0], new []{point});
+
+            //创建飞机
+            int index = i;
+            AircraftZC aircraft = ComponentFactory.Create<AircraftZC, FlightPlanEditor,ZCTask,int>( flightPlanEditor, config.ZCTask,index);
+            aircraft.AddComponent<StaticCapacityComponent>();
+            aircraft.AddComponent<TaskPerformanceComponent>();
+            aircraft.AddComponent<EconomicalComponent>();
+            Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
+            mission.AircraftZCs.Add(aircraft);
+        }
+        
+        return UniTask.CompletedTask;
+    }
+}
+
+[Event]
+public class CreateXHTaskEventHandler : AEvent<CreateXHTask>
+{
+    protected override UniTask Run(CreateXHTask config)
+    {
+        // TODO 创建巡护任务
+        var taskSys = Game.Scene.GetComponent<TaskComponent>();
+        
+        XHRescueMission mission = ComponentFactory.Create<XHRescueMission>();
+        mission.AddComponent<XHTotalTaskPerformanceComponent>();
+        mission.AddComponent<EquipmentComponent>();
+        mission.MissionId = $"巡护任务 {config.XHTask.missionInformation.MissionId}";
+        taskSys.XHRescueMissions.Add(mission);
+        
+        FirePoint point = config.EditorConfig.firePoints.Find(f => f.FirePointId == config.XHTask.FirePointId);
+
+        mission.FireGround = ComponentFactory.Create<FireGround, FirePoint>(point);
+        for (int i = 0; i < config.XHTask.missionInformation.AircraftInfos.Length; i++)
+        {
+            //飞机参数
+            var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
+                a => a.AircraftID == config.XHTask.missionInformation.AircraftInfos[i]);
+            //基地
+            var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
+            
+            //创建飞行计划编辑器
+            var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather,originBase,config.XHTask.airroute,config.XHTask.MissionPoints[0], new []{point});
+        
+            AircraftXH aircraft = ComponentFactory.Create<AircraftXH, FlightPlanEditor,string,string>( flightPlanEditor,
+                config.XHTask.missionInformation.AircraftInfos[i],config.XHTask.missionInformation.AircraftId[i]);
+     
+            aircraft.TaskReadyTime = config.XHTask.missionInformation.TakeoffPreparationTime;
+            mission.AircraftXHs.Add(aircraft);
+            
+            mission.End += aircraft.End;
+            aircraft.AddComponent<XHStaticCapacityComponent>();
+            aircraft.AddComponent<XHEconomicalComponent>();
+            Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
+        }
+        
+        return UniTask.CompletedTask;
+    }
+}

+ 21 - 1
SimulationServer/EventHandler/EventStruct.cs

@@ -1,10 +1,30 @@
-namespace SimulationServer;
+using Model;
+
+namespace SimulationServer;
 
 public struct ServerStart
 {
     
 }
 
+public struct CreateMHTask
+{
+    public MHTaskConfig MHTaskConfig;
+    public EditorConfig EditorConfig;
+}
+
+public struct CreateZCTask
+{
+    public EditorConfig EditorConfig;
+    public ZCTask ZCTask;
+}
+
+public struct CreateXHTask
+{
+    public EditorConfig EditorConfig;
+    public XHTask XHTask;
+}
+
 public struct MHSimulationOver
 {
     public MHRescueMission Mission;

+ 1 - 0
SimulationServer/EventHandler/MHSimulationOverrEventHandler.cs

@@ -10,6 +10,7 @@ public class MHSimulationOverrEventHandler : AEvent<MHSimulationOver>
     protected override UniTask Run(MHSimulationOver mhSimulationOver)
     {
         S2C_StmulationEnd end = new S2C_StmulationEnd();
+        end.FirePointId = mhSimulationOver.Mission.FireGround.FirePointName;
         // 所有飞机的数据
         foreach (var kv in mhSimulationOver.Mission.singleReport)
         {

+ 18 - 201
SimulationServer/EventHandler/ServerStartEventHandler.cs

@@ -1,7 +1,6 @@
 using Cysharp.Threading.Tasks;
 using KYFramework;
 using Model;
-using MongoDB.Bson;
 using Newtonsoft.Json;
 using SimulationServer.Utils;
 using SimulationSingleServer.Utils;
@@ -16,12 +15,12 @@ public class ServerStartEventHandler : AEvent<ServerStart>
     {
         Log.Info("读取配置文件!");
         var taskSys = Game.Scene.GetComponent<TaskComponent>();
-
         HttpInterface.serverIp = File.ReadAllText("dbIp.txt");
         SimulationCommon.Util.serverIp = HttpInterface.serverIp;
         // 读取任务配置文件
         string ec_path = "Missions/editor_config.json";
         string tc_path = "Missions/task_config.json";
+        
         if (!File.Exists(ec_path))
         {
             Log.Error("editor_config.json文件不存在!");
@@ -39,6 +38,7 @@ public class ServerStartEventHandler : AEvent<ServerStart>
         
         EditorConfig? editorConfig = JsonConvert.DeserializeObject<EditorConfig>(ec_str);
         TaskConfig? taskConfig = JsonConvert.DeserializeObject<TaskConfig>(tc_str);
+        
         if(editorConfig == null || taskConfig == null)
         {
             Log.Error("配置文件解析失败!");
@@ -51,211 +51,28 @@ public class ServerStartEventHandler : AEvent<ServerStart>
         var wind_temp = TaskComponent.Weather.day_wind_comp.Replace("级", "").Split('-');
         Define.WIND = double.Parse(wind_temp[0]);
 
-        int index = 1;
-        foreach (MHTaskConfig mHTaskConfig in taskConfig.mHTaskConfigs)
-        {
-            MHRescueMission mission = ComponentFactory.Create<MHRescueMission>();
-            mission.ExecutionContext = mHTaskConfig.RunTimes;
-            mission.AddComponent<TotalTaskPerformanceComponent>();
-            mission.AddComponent<TotalEconomicalComponent>();
-            mission.AddComponent<EquipmentComponent>();
-            taskSys.MHRescueMissions.Add(mission);
-            mission.MissionId = $"灭火任务 {mHTaskConfig.TotalMHId}";
-            Log.Info($"创建任务 : {mHTaskConfig.TotalMHId}");
-            mission.slope = Util.GetSlope(editorConfig.firePoints[mHTaskConfig.FirePointId - 1].FirePointLongitude,
-                editorConfig.firePoints[mHTaskConfig.FirePointId - 1].FirePointLatitude, 30);
-            FireGround fireGround = ComponentFactory.Create<FireGround>();
-            mission.FireGround = fireGround;
-            mission.InitArea = editorConfig.firePoints[mHTaskConfig.FirePointId - 1].InitialArea;
-            fireGround.FirePoint = new DVector { Latitude = editorConfig.firePoints[mHTaskConfig.FirePointId - 1].FirePointLatitude,
-                Longitude = editorConfig.firePoints[mHTaskConfig.FirePointId - 1].FirePointLongitude,Altitude = editorConfig.firePoints[mHTaskConfig.FirePointId - 1].FirePointHeight};
-            
-            
-            foreach (MHTask mhTask in mHTaskConfig.mHTask)
-            {
-                Log.Info($"创建灭火任务 : {mhTask.missionInformation.MissionName}");
-                if(mhTask.missionInformation.AircraftInfos == null) continue;
-                for (int i = 0; i < mhTask.missionInformation.AircraftInfos.Length; i++)
-                {
-                    FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
-                    
-                    flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find( a => a.Id == mhTask.missionInformation.AircraftId[i]);
-                    flightPlanEditor.firepoint = new FirePoint[1];
-                    flightPlanEditor.firepoint[0] = editorConfig.firePoints[mHTaskConfig.FirePointId - 1];
-                    flightPlanEditor.missionpoint = mhTask.MissionPoints[0];
-                    flightPlanEditor.originbase = editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-          
-                    flightPlanEditor.cityweather = editorConfig.cityWeather;
-                    AircraftMH aircraft = ComponentFactory.Create<AircraftMH, FlightPlanEditor>( flightPlanEditor);
-                    aircraft.Name = mhTask.missionInformation.AircraftInfos[i];
-                    aircraft.AircraftId = mhTask.missionInformation.AircraftId[i];
-                    aircraft.NextMissionId = mhTask.NextTaskId;
-                    aircraft.fireGround = fireGround;
-                    aircraft.mhRescueMission = mission;
-                    aircraft.AircraftIndex = index.ToString();
-                    mission.aircrafts.Add(aircraft);
-                    aircraft.Airport = flightPlanEditor.originbase.BaseName;
-                    aircraft.TaskName = mhTask.missionInformation.MissionName;
-                    mission.End += aircraft.End;
-                    aircraft.AddComponent<StaticCapacityComponent>();
-                    aircraft.AddComponent<TaskPerformanceComponent>();
-                    aircraft.AddComponent<EconomicalComponent>();
-                    aircraft.TaskReadyTime = mhTask.missionInformation.TakeoffPreparationTime;
-                    Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
-                    index++;
-                }
-            }
-
-            foreach (DMMHTask dmmhTask in mHTaskConfig.dMMHTask)
-            {
-                Log.Info($"创建地面灭火任务 : {dmmhTask.missionInformation.MissionName}");
-                if(dmmhTask.missionInformation.AircraftInfos == null) continue;
-                for (int i = 0; i < dmmhTask.missionInformation.AircraftInfos.Length; i++)
-                {
-                    FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
-                    
-                    flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find( a => a.Id == dmmhTask.missionInformation.AircraftId[i]);
-                    flightPlanEditor.firepoint = new FirePoint[1];
-                    flightPlanEditor.firepoint[0] = editorConfig.firePoints[mHTaskConfig.FirePointId - 1];
-                    flightPlanEditor.missionpoint = dmmhTask.MissionPoints[0];
-                    flightPlanEditor.originbase = editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-                    flightPlanEditor.cityweather = editorConfig.cityWeather;
-                    
-                    AircraftMHWithPersion aircraftWithPerson = ComponentFactory.Create<AircraftMHWithPersion, FlightPlanEditor>( flightPlanEditor);
-                    mission.End += aircraftWithPerson.End;
-                    aircraftWithPerson.Name = dmmhTask.missionInformation.AircraftInfos[i];
-                    aircraftWithPerson.fireGround = fireGround;
-                    aircraftWithPerson.mhRescueMission = mission;
-                    aircraftWithPerson.AircraftIndex = index.ToString();
-                    aircraftWithPerson.GroundPersonnel = (int)dmmhTask.GroundPersonnel;
-                    aircraftWithPerson.LandingPersonnel = (int)dmmhTask.LandingPersonnel;
-                    aircraftWithPerson.NextMissionId = dmmhTask.NextTaskId;
-                    aircraftWithPerson.TaskName = dmmhTask.missionInformation.MissionName;
-                    aircraftWithPerson.TaskReadyTime = dmmhTask.missionInformation.TakeoffPreparationTime;
-                    aircraftWithPerson.AircraftId = dmmhTask.missionInformation.AircraftId[i];
-                    
-                    mission.aircrafts.Add(aircraftWithPerson);
-                    Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
-                    index++;
-                }
-            }
-
-            foreach (SHJTask shjTask in mHTaskConfig.sHJTask)
-            {
-                Log.Info($"创建索滑降任务 : {shjTask.missionInformation.MissionName}");
-                if(shjTask.missionInformation.AircraftInfos == null) continue;
-                for (int i = 0; i < shjTask.missionInformation.AircraftInfos.Length; i++)
-                {
-                    FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
-
-                    flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find(a =>
-                        a.Id == shjTask.missionInformation.AircraftId[i]);
-                    flightPlanEditor.firepoint = new FirePoint[1];
-                    flightPlanEditor.firepoint[0] = editorConfig.firePoints[mHTaskConfig.FirePointId - 1];
-                    flightPlanEditor.missionpoint = shjTask.MissionPoints[0];
-                    flightPlanEditor.originbase =
-                        editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-                    flightPlanEditor.cityweather = editorConfig.cityWeather;
-
-                    AircraftSHJ aircraftSHJ = ComponentFactory.Create<AircraftSHJ, FlightPlanEditor,SHJTask>( flightPlanEditor, shjTask);
-                    mission.End += aircraftSHJ.End;
-                    aircraftSHJ.AircraftIndex = index.ToString();
-                    mission.aircrafts.Add(aircraftSHJ);
-                    Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
-                    index++;
-                }
-            }
-        }
-
 
-        foreach (ZCTask zcTask in taskConfig.zCTask)
+        // 创建灭火
+        foreach (var mhTask in taskConfig.mHTaskConfigs)
         {
-            Log.Info($"创建侦察任务 : {zcTask.missionInformation.MissionName}");
-            ZCRescueMission mission = ComponentFactory.Create<ZCRescueMission>();
-            taskSys.ZCRescueMissions.Add(mission);
-            mission.MissionId = $"侦擦任务 {zcTask.missionInformation.MissionName}";
-            FireGround fireGround = ComponentFactory.Create<FireGround>();
-            fireGround.countArea.burnarea = editorConfig.firePoints[zcTask.FirePointId - 1].InitialArea;
-            fireGround.FirePoint = new DVector
-            {
-                Latitude = editorConfig.firePoints[zcTask.FirePointId - 1].FirePointLatitude,
-                Longitude = editorConfig.firePoints[zcTask.FirePointId - 1].FirePointLongitude,
-                Altitude = editorConfig.firePoints[zcTask.FirePointId - 1].FirePointHeight
-            };
-            mission.InitArea = editorConfig.firePoints[zcTask.FirePointId - 1].InitialArea;
-            if(zcTask.missionInformation.AircraftInfos == null) continue;
-            for (int i = 0; i < zcTask.missionInformation.AircraftInfos.Length; i++)
-            {
-                FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
-        
-                flightPlanEditor.aircraftparameter =
-                    editorConfig.aircraftParameters.Find(
-                        a => a.AircraftID == zcTask.missionInformation.AircraftInfos[i]);
-                flightPlanEditor.firepoint = new FirePoint[1];
-                flightPlanEditor.firepoint[0] = editorConfig.firePoints[zcTask.FirePointId - 1];
-                flightPlanEditor.missionpoint = zcTask.MissionPoints[0];
-                flightPlanEditor.originbase =
-                    editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-                flightPlanEditor.cityweather = editorConfig.cityWeather;
-        
-                AircraftZC aircraft = ComponentFactory.Create<AircraftZC, FlightPlanEditor,ZCTask>( flightPlanEditor, zcTask);
-                //aircraft.Name = zcTask.missionInformation.AircraftInfos[i];
-                //aircraft.NextMissionId = zcTask.NextTaskId;
-                aircraft.AircraftId = zcTask.missionInformation.AircraftId[i];
-                aircraft.TaskReadyTime = zcTask.missionInformation.TakeoffPreparationTime;
-                aircraft.AddComponent<StaticCapacityComponent>();
-                aircraft.AddComponent<TaskPerformanceComponent>();
-                aircraft.AddComponent<EconomicalComponent>();
-                Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
-                mission.AircraftZCs.Add(aircraft);
-            }
+            Game.EventSystem.Publish(new CreateMHTask
+                { EditorConfig = editorConfig, MHTaskConfig = mhTask });
         }
-
-        foreach (XHTask xhTask in taskConfig.xHTask)
+        
+        // 创建侦察
+        foreach (var zcTask in taskConfig.zCTask)
         {
-            Log.Info($"创建巡护任务 : {xhTask.missionInformation.MissionName}");
-            XHRescueMission mission = ComponentFactory.Create<XHRescueMission>();
-            mission.AddComponent<XHEconomicalComponent>();
-            mission.AddComponent<XHTotalTaskPerformanceComponent>();
-            mission.AddComponent<EquipmentComponent>();
-            
-            mission.MissionId = $"巡护任务 {xhTask.missionInformation.MissionId}";
-            taskSys.XHRescueMissions.Add(mission);
-            FireGround fireGround = ComponentFactory.Create<FireGround>();
-            mission.FireGround = fireGround;
-            fireGround.FirePoint = new DVector
-            {
-                Latitude = editorConfig.firePoints[xhTask.FirePointId - 1].FirePointLatitude,
-                Longitude = editorConfig.firePoints[xhTask.FirePointId - 1].FirePointLongitude,
-                Altitude = editorConfig.firePoints[xhTask.FirePointId - 1].FirePointHeight
-            };
-            if(xhTask.missionInformation.AircraftInfos == null) continue;
-            for (int i = 0; i < xhTask.missionInformation.AircraftInfos.Length; i++)
-            {
-                
-                FlightPlanEditor? flightPlanEditor = new FlightPlanEditor();
-                flightPlanEditor.aircraftparameter = editorConfig.aircraftParameters.Find(a =>
-                    a.Id == xhTask.missionInformation.AircraftId[i]);
-                flightPlanEditor.firepoint = new FirePoint[1];
-                flightPlanEditor.firepoint[0] = editorConfig.firePoints[xhTask.FirePointId - 1];
-                flightPlanEditor.airroute = xhTask.airroute;
-                //flightPlanEditor.missionpoint = xhTask.MissionPoints[0];
-                flightPlanEditor.originbase =
-                    editorConfig.bases.Find(b => b.BaseId == flightPlanEditor.aircraftparameter.AirportId);
-                flightPlanEditor.cityweather = editorConfig.cityWeather;
+            Game.EventSystem.Publish(new CreateZCTask
+                { EditorConfig = editorConfig, ZCTask = zcTask });
+        }
         
-                AircraftXH aircraft = ComponentFactory.Create<AircraftXH, FlightPlanEditor>( flightPlanEditor);
-                aircraft.Name = xhTask.missionInformation.AircraftInfos[i];
-                aircraft.AircraftId = xhTask.missionInformation.AircraftId[i];
-                aircraft.TaskReadyTime = xhTask.missionInformation.TakeoffPreparationTime;
-                //aircraft.NextMissionId = zcTask.NextTaskId;
-                mission.AircraftXHs.Add(aircraft);
-                mission.End += aircraft.End;
-                aircraft.AddComponent<XHStaticCapacityComponent>();
-                aircraft.AddComponent<XHEconomicalComponent>();
-                Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
-            }
+        // 创建巡护
+        foreach (var xhTask in taskConfig.xHTask)
+        {
+            Game.EventSystem.Publish(new CreateXHTask
+                { EditorConfig = editorConfig, XHTask = xhTask });
         }
+       
         taskSys.Start();
         return UniTask.CompletedTask;
     }

+ 1 - 0
SimulationServer/EventHandler/XHSimulationOverrEventHandler.cs

@@ -10,6 +10,7 @@ public class XHSimulationOverrEventHandler : AEvent<XHSimulationOver>
     protected override UniTask Run(XHSimulationOver mhSimulationOver)
     {
         S2C_StmulationEnd end = new S2C_StmulationEnd();
+        end.FirePointId = mhSimulationOver.Mission.FireGround.FirePointName;
         // 所有飞机的数据
         foreach (var kv in mhSimulationOver.Mission.singleReport)
         {

+ 1 - 1
SimulationServer/Init.cs

@@ -35,7 +35,7 @@ public static class Init
 
             // 任务
             Game.Scene.AddComponent<TaskComponent>();
-            Game.EventSystem.Publish(new ServerStart());
+            //Game.EventSystem.Publish(new ServerStart());
             Log.Info("服务器启动完成!");
         }
         catch (Exception e)

+ 59 - 0
SimulationServer/MessageHandler/C2S_GetReportMessageHandler.cs

@@ -0,0 +1,59 @@
+using Cysharp.Threading.Tasks;
+using KYFramework;
+using KYFramework.Network;
+using SimulationServer.Utils;
+
+namespace SimulationServer;
+
+[MessageHandler]
+public class C2S_GetReportMessageHandler : AMRpcHandler<C2S_GetReport,S2C_GetReport>
+{
+    protected override UniTask Run(Session session, C2S_GetReport message, S2C_GetReport response, Action reply)
+    {
+        var taskSys = Game.Scene.GetComponent<TaskComponent>();
+
+        foreach (MHRescueMission mission in taskSys.MHRescueMissions)
+        {
+            ResportWithTaskName end = new ResportWithTaskName();
+            end.FirePointId = mission.FireGround.FirePointName;
+            foreach (var kv in mission.singleReport)
+            {
+                EntitySheetReportValue aircraftValue = Util.GetSheetReportValue(kv.Key + "-灭火任务单机指标报告", kv.Value);
+                end.EntitySheetReportValueArr.Add(aircraftValue);
+            }
+        
+            // 总体数据
+            EntitySheetReportValue totalValue = Util.GetSheetReportValue("灭火任务总体指标报告", mission.totalReport);
+            end.EntitySheetReportValueArr.Add(totalValue);
+        
+            // 装备数据
+            EntitySheetReportValue equipmentValue = Util.GetSheetReportValue("装备体系评估报告", mission.equipReport);
+        
+            end.EntitySheetReportValueArr.Add(equipmentValue);
+            response.Reports.Add(end);
+        }
+
+        foreach (XHRescueMission mission in taskSys.XHRescueMissions)
+        {
+            ResportWithTaskName end = new ResportWithTaskName();
+            end.FirePointId = mission.FireGround.FirePointName;
+            // 所有飞机的数据
+            foreach (var kv in mission.singleReport)
+            {
+                EntitySheetReportValue aircraftValue = Util.GetSheetReportValue(kv.Key + "-巡护任务单机指标报告", kv.Value);
+                end.EntitySheetReportValueArr.Add(aircraftValue);
+            }
+        
+            // 总体数据
+            EntitySheetReportValue totalValue = Util.GetSheetReportValue("巡护任务总体指标报告", mission.totalXhReport);
+            end.EntitySheetReportValueArr.Add(totalValue);
+        
+            // 装备数据
+            EntitySheetReportValue equipmentValue = Util.GetSheetReportValue("装备体系评估报告", mission.equipReport);
+            end.EntitySheetReportValueArr.Add(equipmentValue);
+            
+            response.Reports.Add(end);
+        }
+        return UniTask.CompletedTask;
+    }
+}

+ 1 - 2
SimulationServer/MessageHandler/C2S_StmulationStartMessageHandler.cs

@@ -11,8 +11,7 @@ public class C2S_StmulationStartMessageHandler : AMHandler<C2S_StmulationStart>
     {
         SessionComponent.Instance.Session = session;
         
-        // TODO 读取配置文件
-        //Game.EventSystem.Publish(new ServerStart());
+        Game.EventSystem.Publish(new ServerStart());
         
         return UniTask.CompletedTask;
     }

+ 1 - 0
SimulationServer/MessageHandler/C2S_StmulationTimeScaleMessageHandler.cs

@@ -8,6 +8,7 @@ public class C2S_StmulationTimeScaleMessageHandler: AMHandler<C2S_StmulationTime
 {
     protected override UniTask Run(Session session, C2S_StmulationTimeScale message)
     {
+        SessionComponent.Instance.Session = session;
         Init.SimulationSpeed = message.TimeScale;
         return UniTask.CompletedTask;
     }

+ 23 - 0
SimulationServer/Utils/Util.cs

@@ -1,5 +1,6 @@
 using System.Text.Json.Nodes;
 using KYFramework;
+using KYFramework.Network;
 using Model;
 using SimulationCommon;
 using SimulationSingleServer.Utils;
@@ -117,4 +118,26 @@ public class Util
         return fuel.data[0];
     }
     
+    public static EntitySheetReportValue GetSheetReportValue(string name,Dictionary<string, Dictionary<string, List<string>>> report)
+    {
+        EntitySheetReportValue aircraftValue = new EntitySheetReportValue();
+        aircraftValue.Name = name;
+        //每架飞机的所有sheet
+        foreach (var kv1 in report)
+        {
+            SheetReportValue sheetValue = new SheetReportValue();
+            sheetValue.Name = kv1.Key;
+            aircraftValue.SheetReportValueArr.Add(sheetValue);
+            //每个sheet的所有数据
+            foreach (var kv2 in kv1.Value)
+            {
+                ReportValue reportValue = new ReportValue();
+                reportValue.Name = kv2.Key;
+                reportValue.Value = kv2.Value.First();
+                sheetValue.ValueArr.Add(reportValue);
+            }
+        }
+        return aircraftValue;
+    }
+    
 }

BIN
SimulationServer/bin/Debug/net7.0/KYFramework.dll


BIN
SimulationServer/bin/Debug/net7.0/KYFramework.pdb


BIN
SimulationServer/bin/Debug/net7.0/KYNetwork.dll


BIN
SimulationServer/bin/Debug/net7.0/KYNetwork.pdb


+ 32 - 67
SimulationServer/bin/Debug/net7.0/Missions/editor_config.json

@@ -1,108 +1,73 @@
 {
   "基地信息": [
     {
-      "基地名称": "根河敖鲁古雅机场",
+      "基地名称": "根河",
       "基地编号": 1,
-      "基地经度": 121.381,
-      "基地纬度": 50.7,
-      "基地海拔": 1100.0
-    },
-    {
-      "基地名称": "西昌青山机场",
-      "基地编号": 2,
-      "基地经度": 102.193,
-      "基地纬度": 27.989,
-      "基地海拔": 1500.0
+      "基地经度": 121.391666666667,
+      "基地纬度": 50.7016666666667,
+      "基地海拔": 0.0
     }
   ],
   "飞行器信息": [
     {
-      "机型": "Ka-32",
-      "飞机编号": "1-1",
+      "机型": "AC-313A",
+      "飞机编号": "AC-313A-根河-0",
       "类型": "飞机",
       "子类型": "直升机",
-      "最大起飞重量": 11000.0,
-      "最大载油量": 8000.0,
-      "最大载客数量": 16.0,
+      "最大起飞重量": 13800.0,
+      "最大载油量": 3100.0,
+      "最大载客数量": 27.0,
       "所属机场ID": 1
     },
     {
-      "机型": "Ka-32",
-      "飞机编号": "1-2",
+      "机型": "AC-313A",
+      "飞机编号": "AC-313A-根河-1",
       "类型": "飞机",
       "子类型": "直升机",
-      "最大起飞重量": 11000.0,
-      "最大载油量": 8000.0,
-      "最大载客数量": 16.0,
+      "最大起飞重量": 13800.0,
+      "最大载油量": 3100.0,
+      "最大载客数量": 27.0,
       "所属机场ID": 1
     },
     {
-      "机型": "M-171",
-      "飞机编号": "1-3",
+      "机型": "AC-313A",
+      "飞机编号": "AC-313A-根河-2",
       "类型": "飞机",
       "子类型": "直升机",
-      "最大起飞重量": 13000.0,
-      "最大载油量": 8000.0,
-      "最大载客数量": 24.0,
-      "所属机场ID": 1
-    },
-    {
-      "机型": "M-171",
-      "飞机编号": "1-4",
-      "类型": "飞机",
-      "子类型": "直升机",
-      "最大起飞重量": 13000.0,
-      "最大载油量": 8000.0,
-      "最大载客数量": 24.0,
+      "最大起飞重量": 13800.0,
+      "最大载油量": 3100.0,
+      "最大载客数量": 27.0,
       "所属机场ID": 1
     },
     {
       "机型": "Ka-32",
-      "飞机编号": "2-1",
+      "飞机编号": "Ka-32-根河-3",
       "类型": "飞机",
       "子类型": "直升机",
       "最大起飞重量": 11000.0,
-      "最大载油量": 8000.0,
-      "最大载客数量": 16.0,
-      "所属机场ID": 2
-    },
-    {
-      "机型": "M-171",
-      "飞机编号": "2-2",
-      "类型": "飞机",
-      "子类型": "直升机",
-      "最大起飞重量": 13000.0,
-      "最大载油量": 8000.0,
-      "最大载客数量": 24.0,
-      "所属机场ID": 2
+      "最大载油量": 2511.0,
+      "最大载客数量": 13.0,
+      "所属机场ID": 1
     },
     {
       "机型": "M-171",
-      "飞机编号": "2-3",
+      "飞机编号": "M-171-根河-4",
       "类型": "飞机",
       "子类型": "直升机",
       "最大起飞重量": 13000.0,
-      "最大载油量": 8000.0,
-      "最大载客数量": 24.0,
-      "所属机场ID": 2
+      "最大载油量": 3472.0,
+      "最大载客数量": 27.0,
+      "所属机场ID": 1
     }
   ],
   "火点": [
-    {
-      "火点ID": 1,
-      "火点经度": 121.123,
-      "火点纬度": 50.342,
-      "火点海拔": 2000.0,
-      "初始火场面积": 10000.0,
-      "初始火线长度": 0.0
-    },
     {
       "火点ID": 2,
-      "火点经度": 101.041,
-      "火点纬度": 30.125,
-      "火点海拔": 3000.0,
-      "初始火场面积": 10000.0,
-      "初始火线长度": 0.0
+      "火点经度": 119.931029684575,
+      "火点纬度": 50.6753415295982,
+      "火点海拔": 849.043177679918,
+      "初始火场面积": 3000.0,
+      "初始火线长度": 157259.08132008748
     }
   ],
   "天气信息": {

+ 149 - 27
SimulationServer/bin/Debug/net7.0/Missions/task_config.json

@@ -1,42 +1,164 @@
 {
-  "防火巡护任务": [
+  "灭火任务": [
+    {
+      "总灭火任务编号": 1,
+      "火点ID": 2,
+      "吊桶洒水灭火任务": [
+        {
+          "任务信息": {
+            "任务名称": "吊桶灭火",
+            "任务ID": "吊桶灭火_1_1",
+            "任务主要类型": "航空灭火",
+            "任务类型": "吊桶洒水灭火",
+            "开始时间": "2014/09/23 00:00:00",
+            "结束时间": "2014/09/23 00:00:00",
+            "应用机型": [
+              "AC-313A"
+            ],
+            "应用飞机编号": [
+              "AC-313A-根河-0"
+            ],
+            "起飞准备时间": 2.0
+          },
+          "取水点": [
+            {
+              "任务点经度": 120.401737540055,
+              "任务点纬度": 50.3796118866572,
+              "任务点海拔": 688.0
+            }
+          ],
+          "下一个任务ID": null
+        }
+      ],
+      "机降灭火任务": [
+        {
+          "任务信息": {
+            "任务名称": "机降灭火",
+            "任务ID": "机降灭火_1_2",
+            "任务主要类型": "航空灭火",
+            "任务类型": "机降灭火",
+            "开始时间": "2014/09/23 00:00:00",
+            "结束时间": "2014/09/23 00:00:00",
+            "应用机型": [
+              "AC-313A"
+            ],
+            "应用飞机编号": [
+              "AC-313A-根河-0"
+            ],
+            "起飞准备时间": 2.0
+          },
+          "机降人数": 35,
+          "地面部署人数": 0,
+          "机降点": [
+            {
+              "任务点经度": 120.209994448322,
+              "任务点纬度": 50.6895517142787,
+              "任务点海拔": 829.713326788634
+            }
+          ],
+          "下一个任务ID": null
+        }
+      ],
+      "索滑降灭火任务": [
+        {
+          "任务信息": {
+            "任务名称": "索滑降任务",
+            "任务ID": "索滑降任务_1_1",
+            "任务主要类型": "航空灭火",
+            "任务类型": "索滑降灭火",
+            "开始时间": "2014/09/23 00:00:00",
+            "结束时间": "2014/09/23 00:00:00",
+            "应用机型": [
+              "M-171"
+            ],
+            "应用飞机编号": [
+              "M-171-根河-4"
+            ],
+            "起飞准备时间": 2.0
+          },
+          "索滑降高度": 200.0,
+          "投送人数": 10,
+          "风速": 5.0,
+          "能见度": 5.0,
+          "索滑降速度": 3.0,
+          "索滑降点": [
+            {
+              "任务点经度": 120.209994448322,
+              "任务点纬度": 50.6895517142787,
+              "任务点海拔": 829.713326788634
+            }
+          ],
+          "下一个任务ID": null
+        }
+      ]
+    }
+  ],
+  "火场侦查任务": [
     {
-  
       "任务信息": {
-
-        "起飞准备时间": 600,
-        "任务名称": "防火巡护任务1",
-        "任务ID": "XH1",
+        "任务名称": "火场侦查任务",
+        "任务ID": "火场侦查任务_0_1",
         "任务主要类型": "航空灭火",
-        "任务类型": "防火巡护",
-        "开始时间": null,
-        "结束时间": null,
+        "任务类型": "火场侦察",
+        "开始时间": "2014/09/23 00:00:00",
+        "结束时间": "2014/09/23 00:00:00",
         "应用机型": [
-          "M-171"
+          "Ka-32"
         ],
         "应用飞机编号": [
-          "1-3"
-        ]
+          "Ka-32-根河-3"
+        ],
+        "起飞准备时间": 2.0
       },
-      "巡护航线参数": [
-        {
-          "巡护航线名称": "Y605",
-          "巡护航线点经度": 0.0,
-          "巡护航线点纬度": 0.0,
-          "巡护航线点海拔": 0.0
-        }
+      "矩形侦查区域边界点": [
+        [
+          119.836340240545,
+          50.7462755048075
+        ],
+        [
+          120.183952914874,
+          50.7500614750784
+        ],
+        [
+          120.186320215995,
+          50.5630705128614
+        ],
+        [
+          119.843230971184,
+          50.5588208380295
+        ]
       ],
-      "火点ID": 1,
+      "扫描线间距": 300.0,
+      "侦查飞行真高": 300.0,
+      "是否真实高度": true,
+      "是否环绕模式": true,
+      "环绕圈数": 1,
+      "火点ID": 2,
       "MissionPoints": [
         {
-          "任务点经度": 0.0,
-          "任务点纬度": 0.0,
-          "任务点海拔": 0.0
+          "任务点经度": 119.836340240545,
+          "任务点纬度": 50.7462755048075,
+          "任务点海拔": 762.460490911041
+        },
+        {
+          "任务点经度": 120.183952914874,
+          "任务点纬度": 50.7500614750784,
+          "任务点海拔": 950.22932349409
+        },
+        {
+          "任务点经度": 120.186320215995,
+          "任务点纬度": 50.5630705128614,
+          "任务点海拔": 739.60844498502
+        },
+        {
+          "任务点经度": 119.843230971184,
+          "任务点纬度": 50.5588208380295,
+          "任务点海拔": 846.089490891054
         }
       ],
-      "下一个任务ID": ""
+      "下一个任务ID": null
     }
-  ]
-
-
+  ],
+  "防火巡护任务": [],
+  "地面救援任务": null
 }

BIN
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/AC-313A-根河-0灭火任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/Ka-32-根河-0灭火任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/Ka-32-根河-2灭火任务单机指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/灭火任务总体指标报告.xls


BIN
SimulationServer/bin/Debug/net7.0/Reports/MH/2024-07-21/装备体系评估报告.xls


BIN
SimulationServer/bin/Debug/net7.0/SimulationCommon.dll


BIN
SimulationServer/bin/Debug/net7.0/SimulationCommon.pdb


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.dll


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.exe


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.pdb


BIN
SimulationServer/bin/Debug/net7.0/ThirdParty.dll


BIN
SimulationServer/bin/Debug/net7.0/ThirdParty.pdb


BIN
SimulationServer/bin/Debug/server.zip