diff --git a/data/default_fireunits.json b/data/default_fireunits.json deleted file mode 100644 index abeba18..0000000 --- a/data/default_fireunits.json +++ /dev/null @@ -1,63 +0,0 @@ -[ - { - "Id": "ground-standard", - "Name": "标准地基火力单元", - "PlatformType": 1, - "GunCount": 4, - "ChannelsPerGun": 4, - "ChannelInterval": 1.0, - "Cooldown": 5.0, - "AmmoChangeTime": 30.0, - "MuzzleVelocity": 800.0, - "AmmoTypes": [0, 1], - "RadarRange": 15000.0, - "EORange": 8000.0, - "IRRange": 5000.0 - }, - { - "Id": "ground-light", - "Name": "轻型地基火力单元", - "PlatformType": 1, - "GunCount": 2, - "ChannelsPerGun": 4, - "ChannelInterval": 1.0, - "Cooldown": 5.0, - "AmmoChangeTime": 30.0, - "MuzzleVelocity": 800.0, - "AmmoTypes": [0, 1], - "RadarRange": 10000.0, - "EORange": 6000.0, - "IRRange": 3000.0 - }, - { - "Id": "ground-heavy", - "Name": "重型地基火力单元", - "PlatformType": 1, - "GunCount": 6, - "ChannelsPerGun": 4, - "ChannelInterval": 1.0, - "Cooldown": 5.0, - "AmmoChangeTime": 30.0, - "MuzzleVelocity": 600.0, - "AmmoTypes": [0, 1, 2], - "RadarRange": 20000.0, - "EORange": 10000.0, - "IRRange": 6000.0 - }, - { - "Id": "air-standard", - "Name": "标准空基火力单元", - "PlatformType": 0, - "GunCount": 1, - "ChannelsPerGun": 8, - "ChannelInterval": 1.0, - "Cooldown": 5.0, - "AmmoChangeTime": 30.0, - "CruiseSpeed": 55.0, - "ReleaseAltitude": 1500.0, - "AmmoTypes": [0, 1], - "RadarRange": 0.0, - "EORange": 12000.0, - "IRRange": 8000.0 - } -] diff --git a/src/CounterDrone.Core/DefaultFireUnits.cs b/src/CounterDrone.Core/DefaultFireUnits.cs index 2bf2147..67fc059 100644 --- a/src/CounterDrone.Core/DefaultFireUnits.cs +++ b/src/CounterDrone.Core/DefaultFireUnits.cs @@ -1,6 +1,4 @@ using System.Collections.Generic; -using System.Text.Json; -using CounterDrone.Core.Models; namespace CounterDrone.Core { diff --git a/src/CounterDrone.Core/Services/ReportGenerator.cs b/src/CounterDrone.Core/Services/ReportGenerator.cs index c28f747..bf4cb44 100644 --- a/src/CounterDrone.Core/Services/ReportGenerator.cs +++ b/src/CounterDrone.Core/Services/ReportGenerator.cs @@ -86,24 +86,47 @@ namespace CounterDrone.Core.Services sb.AppendLine(); } + // 构建 PlatformId → 火力单元 映射(去重,五和六共用) + var platToEquip = new Dictionary(); + var unitLaunchCounts = new Dictionary(); + int platIdx = 1, unitNum = 0; + for (int ei = 0; ei < config.Equipment.Count; ei++) + { + var eq = config.Equipment[ei]; + if (eq.EquipmentRole != (int)EquipmentRole.LaunchPlatform) continue; + int channels = (eq.GunCount ?? 1) * (eq.ChannelsPerGun ?? 1); + for (int j = 0; j < eq.Quantity; j++) + { + unitNum++; + for (int c = 0; c < channels; c++) + platToEquip[$"plat_{platIdx++}"] = unitNum; + } + } + foreach (var e in events.Where(e => e.Type == SimEventType.MunitionLaunched)) + { + if (platToEquip.TryGetValue(e.SourceId, out var u)) + unitLaunchCounts[u] = unitLaunchCounts.GetValueOrDefault(u, 0) + 1; + } + // === 五、我方部署 === sb.AppendLine("## 五、我方部署"); sb.AppendLine(); - sb.AppendLine($"| 装备 | 数量 |"); + sb.AppendLine($"| 火力单元 | 发射数 |"); sb.AppendLine($"|------|------|"); - sb.AppendLine($"| 发射平台 | {platforms.Sum(p => p.Quantity)} 台 |"); - sb.AppendLine($"| 云团位置 | ({config.Cloud.PositionX:F0}, {config.Cloud.PositionY:F0}, {config.Cloud.PositionZ:F0}) |"); - sb.AppendLine($"| 释放高度 | {config.Cloud.DisperseHeight:F0} m |"); + foreach (var kv in unitLaunchCounts.OrderBy(kv => kv.Key)) + sb.AppendLine($"| #{kv.Key} | {kv.Value} |"); sb.AppendLine(); // === 六、事件时序 === sb.AppendLine("## 六、事件时序"); sb.AppendLine(); - sb.AppendLine("| 时间(s) | 事件 | 详情 |"); - sb.AppendLine("|---------|------|------|"); + sb.AppendLine("| 时间(s) | 事件 | 详情 | 火力单元 |"); + sb.AppendLine("|---------|------|------|:------:|"); int munitionIdx = 0, cloudIdx = 0; foreach (var e in events.OrderBy(e => e.OccurredAt)) { + string unitCell = e.Type == SimEventType.MunitionLaunched && platToEquip.TryGetValue(e.SourceId, out var u) + ? $"#{u}" : "-"; var desc = e.Type switch { SimEventType.MunitionLaunched => $"第 {++munitionIdx} 发", @@ -114,7 +137,7 @@ namespace CounterDrone.Core.Services SimEventType.SimulationEnd => "仿真结束", _ => e.Description, }; - sb.AppendLine($"| {e.OccurredAt:F1} | {TranslateEvent(e.Type)} | {desc} |"); + sb.AppendLine($"| {e.OccurredAt:F1} | {TranslateEvent(e.Type)} | {desc} | {unitCell} |"); } sb.AppendLine();