修复 Unity 编译错误:变量冲突、DroneWave.DroneType 不存在、nullable 警告

- SimulationBootstrap: scenario 变量名冲突 → sc
- ManagerVerification: DroneWave.DroneType → Target (DroneWave 无此属性)
- ReportManager: string? → 拆为两个重载避免 nullable annotation 警告
This commit is contained in:
tian 2026-06-18 15:27:13 +08:00
parent 0434920100
commit 46ce1234ee
3 changed files with 9 additions and 4 deletions

View File

@ -56,7 +56,7 @@ namespace CounterDrone.Unity
var droneGroup = new DroneWave
{
WaveId = "default",
DroneType = detail.Targets[0].DroneType,
Target = detail.Targets[0],
Route = detail.Routes[0],
Waypoints = detail.WaypointGroups["default"],
};

View File

@ -33,12 +33,17 @@ namespace CounterDrone.Unity
public PagedResult<SimulationReport> Search(string kw, string from, string to, int page, int size)
=> _service.SearchReports(kw, from, to, page, size);
public string Export(string reportId, string? outputDir = null)
public string Export(string reportId, string outputDir)
{
var dir = outputDir ?? System.IO.Path.Combine(_paths.GetDataRoot(), "reports");
return _service.ExportToFile(reportId, dir);
}
public string Export(string reportId)
{
return Export(reportId, System.IO.Path.Combine(_paths.GetDataRoot(), "reports"));
}
[ContextMenu("Verify")]
void Verify()
{

View File

@ -66,8 +66,8 @@ namespace CounterDrone.Unity
// 方式2用 DefaultData 预设组装自定义想定
var defaults = DefaultData.Load(paths);
var scenario = scenario.CreateScenario("Unity Demo", "");
scenarioId = scenario.Id;
var sc = scenario.CreateScenario("Unity Demo", "");
scenarioId = sc.Id;
scenario.SaveScene(scenarioId, defaults.Environments.First(w => w.Id == "sunny-calm").ToCombatScene());
scenario.SaveTarget(scenarioId, defaults.Drones.First(p => p.Id == "shahed").ToDroneProfile());