对接文档 V1.7:数据分层架构 + ScenarioDrone/ScenarioUnit 外键引用
This commit is contained in:
parent
1aa927e471
commit
184213b3c5
@ -1,6 +1,6 @@
|
||||
# 后端对接文档(Unity 前端)
|
||||
|
||||
> **版本**:V1.6
|
||||
> **版本**:V1.7
|
||||
> **日期**:2026-06-18
|
||||
> **Unity 版本**:2022.3.62f3c1
|
||||
|
||||
@ -72,20 +72,23 @@ var scenarioId = demos.Items[0].Id;
|
||||
// 方式 B:自定义
|
||||
var sc = scenario.CreateScenario("我的想定", "");
|
||||
scenario.SaveScene(sc.Id, new CombatScene { WindSpeed = 5, WindDirection = (int)WindDirection.E });
|
||||
|
||||
// 无人机:引用 DroneSpec (基础数据) + 想定特有字段
|
||||
scenario.SaveScenarioDrone(sc.Id, new ScenarioDrone {
|
||||
WaveId = "w1", Model = "Shahed-136", Description = "活塞巡飞弹",
|
||||
Quantity = 1, DroneType = (int)DroneType.FixedWing,
|
||||
TypicalSpeed = 200, TypicalAltitude = 500
|
||||
DroneSpecId = "shahed", WaveId = "w1", Quantity = 3
|
||||
});
|
||||
|
||||
// 部署:引用 FireUnitSpec (基础数据) + 想定特有字段
|
||||
scenario.SaveDeployment(sc.Id, new List<ScenarioUnit> {
|
||||
new() { FireUnitSpecId = "ground-light", Quantity = 2,
|
||||
PositionX = 5000, PositionY = 0, PositionZ = 50,
|
||||
AerosolType = 0, MunitionCount = 8, Description = "地面轻型平台" }
|
||||
});
|
||||
|
||||
scenario.SaveRoute(sc.Id, "w1", new RoutePlan(), new List<Waypoint> {
|
||||
new() { PosX = 0, PosY = 500, PosZ = 0, Speed = 200 },
|
||||
new() { PosX = 10000, PosY = 500, PosZ = 0, Speed = 200 }
|
||||
});
|
||||
scenario.SaveDeployment(sc.Id, new List<ScenarioUnit> {
|
||||
new() { EquipmentRole = 1, PlatformType = 1, Quantity = 1,
|
||||
PositionX = 5000, AerosolType = 0, MunitionCount = 8,
|
||||
Description = "地面轻型平台" }
|
||||
});
|
||||
scenario.SaveCloud(sc.Id, new CloudDispersal { AerosolType = 0, DisperseHeight = 500 });
|
||||
scenario.UpdateStep(sc.Id, 5);
|
||||
```
|
||||
@ -209,54 +212,78 @@ replay.TotalFrames / replay.GetFrame(index)
|
||||
|------|------|
|
||||
| **DroneEntity** | Id, PosX/Y/Z, Hp, Status, DroneType, Wingspan, CruiseSpeed, Route, TraveledArc, TotalArc, Progress |
|
||||
| **CloudEntity** | Id, PosX/Y/Z, Radius, Density, Phase, Elapsed, IsDissipated |
|
||||
| **MunitionEntity** | Id, PosX/Y/Z, Velocity, Start, LaunchTime, ElapsedTime, LaunchAngle, Azimuth, MuzzleVelocity, FlightDuration, Target, HasArrived |
|
||||
| **PlatformEntity** | Id, PosX/Y/Z, CurrentVelocity, State, MunitionCount, Cooldown, MuzzleVelocity, CruiseSpeed, ReleaseAltitude, Target, FlightDistance |
|
||||
| **MunitionEntity** | Id, PosX/Y/Z, Velocity, Start, LaunchTime, ElapsedTime, LaunchAngle, Azimuth, MuzzleVelocity, FlightDuration, TargetX/Y/Z, HasArrived |
|
||||
| **PlatformEntity** | Id, PosX/Y/Z, CurrentVelocity, State, MunitionCount, Cooldown, MuzzleVelocity, CruiseSpeed, ReleaseAltitude, TargetX/Y/Z, FlightDistance |
|
||||
| **DetectionEntity** | Id, PosX/Y/Z, Source, IsInRange(), IsDetected() |
|
||||
|
||||
---
|
||||
|
||||
## 七、核心模型
|
||||
|
||||
### 7.1 数据库表
|
||||
### 7.1 数据分层
|
||||
|
||||
```
|
||||
基础数据(全局模板) 想定数据(归属 ScenarioId)
|
||||
───────────────── ──────────────────────────
|
||||
DroneSpec ScenarioDrone (DroneSpecId FK)
|
||||
FireUnitSpec ScenarioUnit (FireUnitSpecId / SensorSpecId FK)
|
||||
SensorSpec
|
||||
AmmunitionSpec
|
||||
EnvironmentSpec
|
||||
FormationTemplate
|
||||
RouteTemplate
|
||||
ModelInfo
|
||||
```
|
||||
|
||||
### 7.2 数据库表
|
||||
|
||||
| 模型 | SQLite 表 | 说明 |
|
||||
|------|------|------|
|
||||
| `Scenario` | `Scenario` | 想定任务 |
|
||||
| `CombatScene` | `CombatScene` | 作战环境 |
|
||||
| `ScenarioDrone` | `ScenarioDrone` | 无人机批次参数 |
|
||||
| `ScenarioUnit` | `ScenarioUnit` | 装备部署 |
|
||||
| `ScenarioDrone` | `ScenarioDrone` | 无人机批次(引用 DroneSpec) |
|
||||
| `ScenarioUnit` | `ScenarioUnit` | 装备部署(引用 FireUnitSpec/SensorSpec) |
|
||||
| `CloudDispersal` | `CloudDispersal` | 云团抛撒配置 |
|
||||
| `RoutePlan` | `RoutePlan` | 航路规划 |
|
||||
| `Waypoint` | `Waypoint` | 航路点 |
|
||||
| `ControlZone` | `ControlZone` | 管控区域 |
|
||||
| `SimulationReport` | `SimulationReport` | 仿真报告 |
|
||||
| `AmmunitionSpec` | `AmmunitionSpec` | 弹药基础参数 |
|
||||
| `DroneSpec` | `DroneSpec` | 无人机基础模板 |
|
||||
| `FireUnitSpec` | `FireUnitSpec` | 火力单元基础模板 |
|
||||
| `SensorSpec` | `SensorSpec` | 传感器基础模板 |
|
||||
| `AmmunitionSpec` | `AmmunitionSpec` | 弹药基础参数 |
|
||||
| `EnvironmentSpec` | `EnvironmentSpec` | 环境基础模板 |
|
||||
| `FormationTemplate` | `FormationTemplate` | 编队基础模板 |
|
||||
| `RouteTemplate` | `RouteTemplate` | 航线基础模板 |
|
||||
| `ModelInfo` | `ModelInfo` | 3D 模型元数据 |
|
||||
|
||||
### 7.2 关键属性
|
||||
### 7.3 关键属性
|
||||
|
||||
| 模型 | 属性 | 类型 | 说明 |
|
||||
|------|------|------|------|
|
||||
| `ScenarioDrone` | `Model` | string | 型号 |
|
||||
| `ScenarioDrone` | `Description` | string | 描述/用途 |
|
||||
| `ScenarioDrone` | `DroneType` | DroneType | Rotor / FixedWing / HighSpeed |
|
||||
| `ScenarioDrone` | `PowerType` | PowerType | Electric / Piston / Jet |
|
||||
| `ScenarioDrone` | `TypicalSpeed` | double | 典型速度 (km/h) |
|
||||
| `ScenarioDrone` | `TypicalAltitude` | double | 典型高度 (m) |
|
||||
| `Scenario` | `ScenarioNumber` | string | 想定编号(唯一) |
|
||||
| `Scenario` | `Description` | string | 想定描述 |
|
||||
| `ScenarioDrone` | `DroneSpecId` | string | FK → DroneSpec |
|
||||
| `ScenarioDrone` | `WaveId` | string | 批次 ID |
|
||||
| `ScenarioDrone` | `Quantity` | int | 数量 |
|
||||
| `ScenarioUnit` | `FireUnitSpecId` | string | FK → FireUnitSpec(发射平台) |
|
||||
| `ScenarioUnit` | `SensorSpecId` | string | FK → SensorSpec(探测设备) |
|
||||
| `ScenarioUnit` | `PositionX/Y/Z` | double | 部署位置 |
|
||||
| `ScenarioUnit` | `AerosolType` | int? | 挂载弹药类型 |
|
||||
| `ScenarioUnit` | `MunitionCount` | int? | 弹药数量 |
|
||||
| `ScenarioUnit` | `Description` | string | 部署备注 |
|
||||
| `ScenarioUnit` | `MuzzleVelocity` | double? | 初速 (m/s) |
|
||||
| `ScenarioUnit` | `CruiseSpeed` | double? | 巡航速度 (m/s),空基专用 |
|
||||
| `DroneSpec` | `Model` | string | 型号 |
|
||||
| `DroneSpec` | `Description` | string | 描述/用途 |
|
||||
| `DroneSpec` | `DroneType` | DroneType | Rotor / FixedWing / HighSpeed |
|
||||
| `DroneSpec` | `PowerType` | PowerType | Electric / Piston / Jet |
|
||||
| `DroneSpec` | `TypicalSpeed` | double | 典型速度 (km/h) |
|
||||
| `DroneSpec` | `TypicalAltitude` | double | 典型高度 (m) |
|
||||
| `FireUnitSpec` | `Description` | string | 描述/用途 |
|
||||
| `FireUnitSpec` | `MuzzleVelocity` | double | 初速 (m/s) |
|
||||
| `FireUnitSpec` | `CruiseSpeed` | double | 巡航速度 (m/s) |
|
||||
| `FireUnitSpec` | `RadarRange` | double | 雷达距离 (m) |
|
||||
| `Scenario` | `ScenarioNumber` | string | 想定编号(唯一) |
|
||||
| `Scenario` | `Description` | string | 想定描述 |
|
||||
| `SimulationReport` | `DroneCount` | int | 无人机总数 |
|
||||
| `SimulationReport` | `UnitCount` | int | 装备总数 |
|
||||
|
||||
---
|
||||
|
||||
@ -291,4 +318,4 @@ dotnet publish -c Release -o ../../unity_plugins
|
||||
|------|------|
|
||||
| 架构设计 | `docs/design/architecture/总体架构设计.md` |
|
||||
| 实体事件映射 | `docs/design/technical/仿真器实体与事件映射.md` |
|
||||
| 测试状态 | **238 测试,11 秒(全部通过)** |
|
||||
| 测试状态 | **238 测试,10 秒(全部通过)** |
|
||||
|
||||
Loading…
Reference in New Issue
Block a user