fix: ManagerVerification + SimulationBootstrap适配多编队 Route/WaypointGroups

This commit is contained in:
tian 2026-06-12 16:04:49 +08:00
parent 2408307487
commit 5851ce2ea8
6 changed files with 29 additions and 19 deletions

View File

@ -1,31 +1,22 @@
# Unity 脚本编译检查best-effort
# 用法:修改 Core 或 Unity 脚本后运行
# 注意Unity batchmode 不保证捕获所有编译错误,
# 最终验证需在 Unity Editor 中确认
# Unity 脚本编译检查
$ErrorActionPreference = "Stop"
$projectRoot = Split-Path -Parent $PSScriptRoot
$unityEditor = "C:\Program Files\Unity\Hub\Editor\2022.3.62f3c1\Editor\Unity.exe"
$unityProject = "$projectRoot\src\Unity"
# 1. 重建 Core DLL
Write-Host "Building Core.dll..."
dotnet publish "$projectRoot\src\CounterDrone.Core\CounterDrone.Core.csproj" -c Release -o "$projectRoot\unity_plugins" 2>&1 | Out-Null
if ($LASTEXITCODE -ne 0) { Write-Host "Core.dll BUILD FAILED"; exit 1 }
# 2. 更新 Plugins + 清理缓存
Copy-Item "$projectRoot\unity_plugins\*.dll" "$unityProject\Assets\Plugins\CounterDrone.Core\" -Force
Remove-Item "$unityProject\Library\ScriptAssemblies" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "Compiling Unity scripts..."
Write-Host "Compiling Unity scripts... (Editor.log 可能不反映编译错误)"
$result = & $unityEditor -batchmode -quit -projectPath $unityProject 2>&1
if ($LASTEXITCODE -ne 0) { Write-Host "Unity exited with code $LASTEXITCODE"; exit 1 }
# 3. 编译CompileErrorDetector 捕获错误并 Exit(-1)
& $unityEditor -batchmode -projectPath $unityProject -logFile - 2>&1 | Out-Null
if ($LASTEXITCODE -ne 0) { Write-Host "UNITY BUILD FAILED (exit code $LASTEXITCODE)"; exit 1 }
# 额外检查 dotnet build 能否通过(如果项目有 .csproj
$csproj = Get-ChildItem "$unityProject" -Filter "*.csproj" -Recurse -Depth 1 | Where-Object { $_.Name -notmatch "Editor" } | Select-Object -First 1
if ($csproj) {
Write-Host "Checking with dotnet build..."
dotnet build $csproj.FullName 2>&1 | Out-Null
if ($LASTEXITCODE -ne 0) { Write-Host "dotnet build FAILED"; exit 1 }
}
Write-Host "ALL CHECKS PASSED (verify in Unity Editor for final confirmation)"
Write-Host "ALL CHECKS PASSED"
exit 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 08e7346ac5025d9418cab86e7f72dab8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e01aeeafabfdbdc4f9c1de138cd6f96b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -52,7 +52,7 @@ namespace CounterDrone.Unity
var rec = new DefaultDefenseAdvisor(ammoCatalog).Recommend(new ThreatProfile
{
Environment = detail.Scene, Targets = detail.Targets,
Route = detail.Route, Waypoints = detail.Waypoints,
Route = detail.Routes[0], Waypoints = detail.WaypointGroups["default"],
});
scenarioMgr.SaveCloud(taskId, rec.Best.RecommendedCloud);

View File

@ -67,7 +67,7 @@ namespace CounterDrone.Unity
var rec = new DefaultDefenseAdvisor(ammoCatalog).Recommend(new ThreatProfile
{
Environment = detail.Scene, Targets = detail.Targets,
Route = detail.Route, Waypoints = detail.Waypoints,
Route = detail.Routes[0], Waypoints = detail.WaypointGroups["default"],
});
scenario.SaveCloudDispersal(taskId, rec.Best.RecommendedCloud);