|
|
@@ -552,6 +552,7 @@ export class MapEngine {
|
|
|
currentGpsTrack: LonLatPoint[]
|
|
|
currentGpsAccuracyMeters: number | null
|
|
|
courseData: OrienteeringCourseData | null
|
|
|
+ courseOverlayVisible: boolean
|
|
|
cpRadiusMeters: number
|
|
|
gameRuntime: GameRuntime
|
|
|
telemetryRuntime: TelemetryRuntime
|
|
|
@@ -674,6 +675,7 @@ export class MapEngine {
|
|
|
this.currentGpsTrack = []
|
|
|
this.currentGpsAccuracyMeters = null
|
|
|
this.courseData = null
|
|
|
+ this.courseOverlayVisible = false
|
|
|
this.cpRadiusMeters = 5
|
|
|
this.gameRuntime = new GameRuntime()
|
|
|
this.telemetryRuntime = new TelemetryRuntime()
|
|
|
@@ -851,10 +853,30 @@ export class MapEngine {
|
|
|
this.gameRuntime.clear()
|
|
|
this.telemetryRuntime.reset()
|
|
|
this.gamePresentation = EMPTY_GAME_PRESENTATION_STATE
|
|
|
+ this.courseOverlayVisible = !!this.courseData
|
|
|
this.clearSessionTimerInterval()
|
|
|
this.setCourseHeading(null)
|
|
|
}
|
|
|
|
|
|
+ clearFinishedTestOverlay(): void {
|
|
|
+ this.currentGpsPoint = null
|
|
|
+ this.currentGpsTrack = []
|
|
|
+ this.currentGpsAccuracyMeters = null
|
|
|
+ this.courseOverlayVisible = false
|
|
|
+ this.setCourseHeading(null)
|
|
|
+ }
|
|
|
+
|
|
|
+ handleClearMapTestArtifacts(): void {
|
|
|
+ this.clearFinishedTestOverlay()
|
|
|
+ this.setState({
|
|
|
+ gpsTracking: false,
|
|
|
+ gpsTrackingText: '测试痕迹已清空',
|
|
|
+ gpsCoordText: '--',
|
|
|
+ statusText: `已清空地图点位与轨迹 (${this.buildVersion})`,
|
|
|
+ }, true)
|
|
|
+ this.syncRenderer()
|
|
|
+ }
|
|
|
+
|
|
|
getHudTargetControlId(): string | null {
|
|
|
return this.gamePresentation.hud.hudTargetControlId
|
|
|
}
|
|
|
@@ -894,6 +916,7 @@ export class MapEngine {
|
|
|
const result = this.gameRuntime.loadDefinition(definition)
|
|
|
this.telemetryRuntime.loadDefinition(definition)
|
|
|
this.gamePresentation = result.presentation
|
|
|
+ this.courseOverlayVisible = true
|
|
|
this.telemetryRuntime.syncGameState(this.gameRuntime.definition, result.nextState, this.getHudTargetControlId())
|
|
|
this.refreshCourseHeadingFromPresentation()
|
|
|
this.updateSessionTimerLoop()
|
|
|
@@ -1172,6 +1195,12 @@ export class MapEngine {
|
|
|
|
|
|
applyGameEffects(effects: GameEffect[]): string | null {
|
|
|
this.feedbackDirector.handleEffects(effects)
|
|
|
+ if (effects.some((effect) => effect.type === 'session_finished')) {
|
|
|
+ this.setState({
|
|
|
+ gpsTracking: false,
|
|
|
+ gpsTrackingText: '测试结束,定位已停止',
|
|
|
+ }, true)
|
|
|
+ }
|
|
|
this.telemetryRuntime.syncGameState(this.gameRuntime.definition, this.gameRuntime.state, this.getHudTargetControlId())
|
|
|
this.updateSessionTimerLoop()
|
|
|
return this.resolveGameStatusText(effects)
|
|
|
@@ -1206,6 +1235,7 @@ export class MapEngine {
|
|
|
}
|
|
|
|
|
|
this.gamePresentation = this.gameRuntime.getPresentation()
|
|
|
+ this.courseOverlayVisible = true
|
|
|
this.refreshCourseHeadingFromPresentation()
|
|
|
const defaultStatusText = this.currentGpsPoint
|
|
|
? `顺序打点已开始 (${this.buildVersion})`
|
|
|
@@ -2250,7 +2280,7 @@ export class MapEngine {
|
|
|
gpsPoint: this.currentGpsPoint,
|
|
|
gpsCalibration: GPS_MAP_CALIBRATION,
|
|
|
gpsCalibrationOrigin: worldTileToLonLat({ x: this.defaultCenterTileX, y: this.defaultCenterTileY }, this.defaultZoom),
|
|
|
- course: this.courseData,
|
|
|
+ course: this.courseOverlayVisible ? this.courseData : null,
|
|
|
cpRadiusMeters: this.cpRadiusMeters,
|
|
|
controlVisualMode: this.gamePresentation.map.controlVisualMode,
|
|
|
showCourseLegs: this.gamePresentation.map.showCourseLegs,
|