12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using Cysharp.Threading.Tasks;
- using KYFramework;
- using KYFramework.Network;
- namespace SimulationServer;
- [Event]
- 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)
- {
- EntitySheetReportValue aircraftValue = GetSheetReportValue(kv.Key + "-巡护任务单机指标报告", kv.Value);
- end.EntitySheetReportValueArr.Add(aircraftValue);
- }
-
- // 总体数据
- EntitySheetReportValue totalValue = GetSheetReportValue("巡护任务总体指标报告", mhSimulationOver.Mission.totalXhReport);
- end.EntitySheetReportValueArr.Add(totalValue);
-
- // 装备数据
- EntitySheetReportValue equipmentValue = GetSheetReportValue("装备体系评估报告", mhSimulationOver.Mission.equipReport);
- end.EntitySheetReportValueArr.Add(equipmentValue);
-
- SessionComponent.Instance.Session.Send(end);
-
- return UniTask.CompletedTask;
- }
-
- public 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;
- }
- }
|