|
@@ -37,12 +37,12 @@ public class CreateMHTaskEventHandler : AEvent<CreateMHTask>
|
|
|
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++)
|
|
|
+ if (mhTask.aircraftInfos == null) continue;
|
|
|
+ for (int i = 0; i < mhTask.aircraftInfos.Length; i++)
|
|
|
{
|
|
|
//飞机参数
|
|
|
var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
|
|
|
- a => a.AircraftID == mhTask.missionInformation.aircraftInfos[i].AircraftType);
|
|
|
+ a => a.AircraftID == mhTask.aircraftInfos[i].AircraftType);
|
|
|
//基地
|
|
|
var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
|
|
|
|
|
@@ -51,8 +51,8 @@ public class CreateMHTaskEventHandler : AEvent<CreateMHTask>
|
|
|
|
|
|
AircraftMH aircraft = ComponentFactory.Create<AircraftMH, FlightPlanEditor>(flightPlanEditor);
|
|
|
|
|
|
- aircraft.Name = mhTask.missionInformation.aircraftInfos[i].AircraftType;
|
|
|
- aircraft.AircraftId = mhTask.missionInformation.aircraftInfos[i].AircraftId;
|
|
|
+ aircraft.Name = mhTask.aircraftInfos[i].AircraftType;
|
|
|
+ aircraft.AircraftId = mhTask.aircraftInfos[i].AircraftId;
|
|
|
|
|
|
aircraft.fireGround = fireGround;
|
|
|
aircraft.mhRescueMission = mission;
|
|
@@ -71,12 +71,12 @@ public class CreateMHTaskEventHandler : AEvent<CreateMHTask>
|
|
|
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++)
|
|
|
+ if (dmmhTask.aircraftInfos == null) continue;
|
|
|
+ for (int i = 0; i < dmmhTask.aircraftInfos.Length; i++)
|
|
|
{
|
|
|
//飞机参数
|
|
|
var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
|
|
|
- a => a.AircraftID == dmmhTask.missionInformation.aircraftInfos[i].AircraftType);
|
|
|
+ a => a.AircraftID == dmmhTask.aircraftInfos[i].AircraftType);
|
|
|
//基地
|
|
|
var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
|
|
|
|
|
@@ -85,7 +85,7 @@ public class CreateMHTaskEventHandler : AEvent<CreateMHTask>
|
|
|
|
|
|
AircraftMHWithPersion aircraftWithPerson = ComponentFactory.Create<AircraftMHWithPersion, FlightPlanEditor>(flightPlanEditor);
|
|
|
mission.End += aircraftWithPerson.End;
|
|
|
- aircraftWithPerson.Name = dmmhTask.missionInformation.aircraftInfos[i].AircraftType;
|
|
|
+ aircraftWithPerson.Name = dmmhTask.aircraftInfos[i].AircraftType;
|
|
|
aircraftWithPerson.fireGround = fireGround;
|
|
|
aircraftWithPerson.mhRescueMission = mission;
|
|
|
aircraftWithPerson.GroundPersonnel = (int)dmmhTask.GroundPersonnel;
|
|
@@ -93,7 +93,7 @@ public class CreateMHTaskEventHandler : AEvent<CreateMHTask>
|
|
|
aircraftWithPerson.NextMissionId = dmmhTask.NextTaskId;
|
|
|
aircraftWithPerson.TaskName = dmmhTask.missionInformation.MissionName;
|
|
|
aircraftWithPerson.TaskReadyTime = dmmhTask.missionInformation.TakeoffPreparationTime;
|
|
|
- aircraftWithPerson.AircraftId = dmmhTask.missionInformation.aircraftInfos[i].AircraftId;
|
|
|
+ aircraftWithPerson.AircraftId = dmmhTask.aircraftInfos[i].AircraftId;
|
|
|
|
|
|
mission.aircrafts.Add(aircraftWithPerson);
|
|
|
Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
|
|
@@ -103,22 +103,38 @@ public class CreateMHTaskEventHandler : AEvent<CreateMHTask>
|
|
|
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++)
|
|
|
+ if (shjTask.aircraftInfos == null) continue;
|
|
|
+ for (int i = 0; i < shjTask.aircraftInfos.Length; i++)
|
|
|
{
|
|
|
//飞机参数
|
|
|
var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
|
|
|
- a => a.AircraftID == shjTask.missionInformation.aircraftInfos[i].AircraftType);
|
|
|
+ a => a.AircraftID == shjTask.aircraftInfos[i].AircraftType);
|
|
|
//基地
|
|
|
var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
|
|
|
|
|
|
+ MissionPoint missionPoint = null;
|
|
|
+ foreach (var item in shjTask.SHJParameters)
|
|
|
+ {
|
|
|
+ if (aircraftParameter.Id == item.AircraftId)
|
|
|
+ missionPoint = item.MissionPoints[0];
|
|
|
+ }
|
|
|
//创建飞行计划编辑器
|
|
|
- var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather, originBase, shjTask.MissionPoints[0], new[] { point });
|
|
|
+ var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather, originBase, missionPoint, new[] { point });
|
|
|
|
|
|
AircraftSHJ aircraftSHJ = ComponentFactory.Create<AircraftSHJ, FlightPlanEditor, SHJTask>(flightPlanEditor, shjTask);
|
|
|
mission.End += aircraftSHJ.End;
|
|
|
- aircraftSHJ.AircraftId = shjTask.missionInformation.aircraftInfos[i].AircraftId;
|
|
|
+ aircraftSHJ.AircraftId = shjTask.aircraftInfos[i].AircraftId;
|
|
|
aircraftSHJ.TaskReadyTime = shjTask.missionInformation.TakeoffPreparationTime;
|
|
|
+ foreach (var item in config.MHTaskConfig.sHJTask)
|
|
|
+ {
|
|
|
+ foreach (var item1 in item.SHJParameters)
|
|
|
+ {
|
|
|
+ if (aircraftSHJ.AircraftId == item1.AircraftId)
|
|
|
+ {
|
|
|
+ aircraftSHJ.SHJParameter = item1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
mission.aircrafts.Add(aircraftSHJ);
|
|
|
Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
|
|
|
}
|
|
@@ -139,11 +155,11 @@ public class CreateZCTaskEventHandler : AEvent<CreateZCTask>
|
|
|
|
|
|
FirePoint point = config.EditorConfig.firePoints.Find(f => f.FirePointId == config.ZCTask.FirePointId);
|
|
|
|
|
|
- for (int i = 0; i < config.ZCTask.missionInformation.aircraftInfos.Length; i++)
|
|
|
+ for (int i = 0; i < config.ZCTask.aircraftInfos.Length; i++)
|
|
|
{
|
|
|
//飞机参数
|
|
|
var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
|
|
|
- a => a.AircraftID == config.ZCTask.missionInformation.aircraftInfos[i].AircraftType);
|
|
|
+ a => a.AircraftID == config.ZCTask.aircraftInfos[i].AircraftType);
|
|
|
//基地
|
|
|
var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
|
|
|
|
|
@@ -157,6 +173,14 @@ public class CreateZCTaskEventHandler : AEvent<CreateZCTask>
|
|
|
aircraft.AddComponent<TaskPerformanceComponent>();
|
|
|
aircraft.AddComponent<EconomicalComponent>();
|
|
|
aircraft.TaskReadyTime = config.ZCTask.missionInformation.TakeoffPreparationTime;
|
|
|
+ aircraft.AircraftId = config.ZCTask.aircraftInfos[i].AircraftId;
|
|
|
+ foreach (var item in config.ZCTask.ZCMethods)
|
|
|
+ {
|
|
|
+ if(aircraft.AircraftId == item.AircraftId)
|
|
|
+ {
|
|
|
+ aircraft.ZCMethod = item;
|
|
|
+ }
|
|
|
+ }
|
|
|
Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
|
|
|
mission.AircraftZCs.Add(aircraft);
|
|
|
}
|
|
@@ -182,11 +206,11 @@ public class CreateXHTaskEventHandler : AEvent<CreateXHTask>
|
|
|
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++)
|
|
|
+ for (int i = 0; i < config.XHTask.aircraftInfos.Length; i++)
|
|
|
{
|
|
|
//飞机参数
|
|
|
var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
|
|
|
- a => a.AircraftID == config.XHTask.missionInformation.aircraftInfos[i].AircraftType);
|
|
|
+ a => a.AircraftID == config.XHTask.aircraftInfos[i].AircraftType);
|
|
|
//基地
|
|
|
var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
|
|
|
|
|
@@ -216,13 +240,13 @@ public class CreateXHTaskEventHandler : AEvent<CreateXHTask>
|
|
|
var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather, originBase, airRoutes, config.XHTask.MissionPoints[0], new[] { point });
|
|
|
|
|
|
AircraftXH aircraft = ComponentFactory.Create<AircraftXH, FlightPlanEditor, string, string>(flightPlanEditor,
|
|
|
- config.XHTask.missionInformation.aircraftInfos[i].AircraftType, config.XHTask.missionInformation.aircraftInfos[i].AircraftId);
|
|
|
+ config.XHTask.aircraftInfos[i].AircraftType, config.XHTask.aircraftInfos[i].AircraftId);
|
|
|
|
|
|
aircraft.TaskReadyTime = config.XHTask.missionInformation.TakeoffPreparationTime;
|
|
|
|
|
|
|
|
|
|
|
|
- Log.Info($"Name:{config.XHTask.missionInformation.MissionName} AircraftId:{config.XHTask.missionInformation.aircraftInfos[i].AircraftId}");
|
|
|
+ Log.Info($"Name:{config.XHTask.missionInformation.MissionName} AircraftId:{config.XHTask.aircraftInfos[i].AircraftId}");
|
|
|
|
|
|
mission.AircraftXHs.Add(aircraft);
|
|
|
|
|
@@ -247,26 +271,31 @@ public class CreateSeaSJEventHandler : AEvent<CreateSeaSJTask>
|
|
|
mission.MissionId = $"海上搜索救援任务 {config.SeaSJTask.missionInformation.MissionName}";
|
|
|
mission.ExecutionContext = config.EditorConfig.runCounts;
|
|
|
mission.AddComponent<SJTotalTaskPerformanceComponent>();
|
|
|
- for (int i = 0; i < config.SeaSJTask.missionInformation.aircraftInfos.Length; i++)
|
|
|
+ for (int i = 0; i < config.SeaSJTask.aircraftInfos.Length; i++)
|
|
|
{
|
|
|
//飞机参数
|
|
|
var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
|
|
|
- a => a.AircraftID == config.SeaSJTask.missionInformation.aircraftInfos[i].AircraftType);
|
|
|
+ a => a.AircraftID == config.SeaSJTask.aircraftInfos[i].AircraftType);
|
|
|
//基地
|
|
|
var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
|
|
|
|
|
|
- TargetPoint targetPoint = config.EditorConfig.targetPoints.Find(t => t.TargetPointId == config.SeaSJTask.TargetPointId);
|
|
|
+ TargetPoint targetPoint = config.EditorConfig.targetPoints.Find(t => t.TargetPointId == config.SeaSJTask.missionInformation.TargetPointId);
|
|
|
//创建飞行计划编辑器
|
|
|
var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather, originBase, new TargetPoint[] { targetPoint });
|
|
|
|
|
|
|
|
|
|
|
|
AircraftSJ aircraft = ComponentFactory.Create<AircraftSJ, FlightPlanEditor>(flightPlanEditor);
|
|
|
- aircraft.Name = config.SeaSJTask.missionInformation.aircraftInfos[i].AircraftType;
|
|
|
+ aircraft.Name = config.SeaSJTask.aircraftInfos[i].AircraftType;
|
|
|
aircraft.TaskReadyTime = config.SeaSJTask.missionInformation.TakeoffPreparationTime;
|
|
|
mission.aircrafts.Add(aircraft);
|
|
|
aircraft.taskContent = config.SeaSJTask;
|
|
|
- aircraft.AircraftId = config.SeaSJTask.missionInformation.aircraftInfos[i].AircraftId;
|
|
|
+ aircraft.AircraftId = config.SeaSJTask.aircraftInfos[i].AircraftId;
|
|
|
+ foreach (var item in config.SeaSJTask.SearchModes)
|
|
|
+ {
|
|
|
+ if (aircraft.AircraftId == item.AircraftId)
|
|
|
+ aircraft.SearchMode = item;
|
|
|
+ }
|
|
|
aircraft.AddComponent<SJStaticCapacityComponent>();
|
|
|
Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
|
|
|
}
|
|
@@ -286,24 +315,24 @@ public class CreateLandSJEventHandler : AEvent<CreateLandSXTask>
|
|
|
mission.MissionId = $"陆上搜索救援任务 {config.LandSXTask.missionInformation.MissionName}";
|
|
|
mission.ExecutionContext = config.EditorConfig.runCounts;
|
|
|
//mission.AddComponent<SJTotalTaskPerformanceComponent>();
|
|
|
- for (int i = 0; i < config.LandSXTask.missionInformation.aircraftInfos.Length; i++)
|
|
|
+ for (int i = 0; i < config.LandSXTask.aircraftInfos.Length; i++)
|
|
|
{
|
|
|
//飞机参数
|
|
|
var aircraftParameter = config.EditorConfig.aircraftParameters.Find(
|
|
|
- a => a.AircraftID == config.LandSXTask.missionInformation.aircraftInfos[i].AircraftType);
|
|
|
+ a => a.AircraftID == config.LandSXTask.aircraftInfos[i].AircraftType);
|
|
|
//基地
|
|
|
var originBase = config.EditorConfig.bases.Find(b => b.BaseId == aircraftParameter.AirportId);
|
|
|
|
|
|
- TargetPoint targetPoint = config.EditorConfig.targetPoints.Find(t => t.TargetPointId == config.LandSXTask.TargetPointId);
|
|
|
+ TargetPoint targetPoint = config.EditorConfig.targetPoints.Find(t => t.TargetPointId == config.LandSXTask.missionInformation.TargetPointId);
|
|
|
//创建飞行计划编辑器
|
|
|
var flightPlanEditor = FlightPlanEditor.Create(aircraftParameter, config.EditorConfig.cityWeather, originBase, new TargetPoint[] { targetPoint });
|
|
|
|
|
|
AircraftLandSJ aircraft = ComponentFactory.Create<AircraftLandSJ, FlightPlanEditor>(flightPlanEditor);
|
|
|
- aircraft.Name = config.LandSXTask.missionInformation.aircraftInfos[i].AircraftType;
|
|
|
+ aircraft.Name = config.LandSXTask.aircraftInfos[i].AircraftType;
|
|
|
aircraft.TaskReadyTime = config.LandSXTask.missionInformation.TakeoffPreparationTime;
|
|
|
mission.aircrafts.Add(aircraft);
|
|
|
aircraft.taskContent = config.LandSXTask;
|
|
|
- aircraft.AircraftId = config.LandSXTask.missionInformation.aircraftInfos[i].AircraftId;
|
|
|
+ aircraft.AircraftId = config.LandSXTask.aircraftInfos[i].AircraftId;
|
|
|
aircraft.MissionEndPoint = new MissionEndPoint
|
|
|
{
|
|
|
MissionEndPointLongitude = targetPoint.TargetPointLongitude,
|
|
@@ -311,6 +340,12 @@ public class CreateLandSJEventHandler : AEvent<CreateLandSXTask>
|
|
|
MissionEndPointHeight = targetPoint.TargetPointHeight
|
|
|
};
|
|
|
|
|
|
+ foreach (var item in config.LandSXTask.SearchModes)
|
|
|
+ {
|
|
|
+ if (item.AircraftId == aircraft.AircraftId)
|
|
|
+ aircraft.SearchMissionMode = item;
|
|
|
+ }
|
|
|
+
|
|
|
aircraft.AddComponent<SJStaticCapacityComponent>(); // 陆上搜救是否需要新建SJStaticCapacityComponent?
|
|
|
Log.Info($"创建机型 : {flightPlanEditor.aircraftparameter.AircraftID}");
|
|
|
}
|