1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using KYFramework;
- namespace SimulationServer;
- public class SJTotalTaskPerformance
- {
- public string 任务准备时间;
- public string 任务成功率;
- }
- public class SJTotalTaskPerformanceComponent : Component
- {
- public SJTotalTaskPerformance SJTotalTaskPerformance = new SJTotalTaskPerformance();
- public void FillData()
- {
- var mission = GetParent<SeaSJRescueMission>();
- float 识别成功率 = mission.aircrafts.FindAll(a => a.Success).Count / mission.aircrafts.Count;
- double 任务准备时间 = 0;
- int 任务成功次数 = 0;
- foreach (var aircraft in mission.aircrafts)
- {
- 任务准备时间 += aircraft.TaskReadyTime;
- 任务成功次数 += aircraft.Success ? 1 : 0;
- }
- SJTotalTaskPerformance.任务准备时间 = 任务准备时间.ToString();
- SJTotalTaskPerformance.任务成功率 = (任务成功次数 / mission.aircrafts.Count).ToString();
- }
- public Dictionary<string, Dictionary<string, string>> GetReport()
- {
- Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
- report["总任务表现"] = new Dictionary<string, string>
- {
- { "任务准备时间", SJTotalTaskPerformance.任务准备时间.ToString() },
- { "任务成功率", SJTotalTaskPerformance.任务成功率.ToString() },
- };
- return report;
- }
- }
|