feat: 收敛玩法运行时配置并加入故障恢复

This commit is contained in:
2026-04-01 13:04:26 +08:00
parent 1635a11780
commit 3ef841ecc7
73 changed files with 8820 additions and 2122 deletions

View File

@@ -126,7 +126,7 @@ export class CourseLabelRenderer {
const offsetX = this.getMetric(scene, controlRadiusMeters * LABEL_OFFSET_X_RATIO)
const offsetY = this.getMetric(scene, controlRadiusMeters * LABEL_OFFSET_Y_RATIO)
if (scene.controlVisualMode === 'multi-target') {
if (scene.gameMode === 'score-o' || scene.controlVisualMode === 'multi-target') {
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'
@@ -139,7 +139,7 @@ export class CourseLabelRenderer {
ctx.fillStyle = this.getScoreLabelColor(scene, control.sequence)
ctx.translate(control.point.x, control.point.y)
ctx.rotate(scene.rotationRad)
ctx.fillText(String(control.sequence), 0, scoreOffsetY)
ctx.fillText(this.getControlLabelText(scene, control.sequence), 0, scoreOffsetY)
ctx.restore()
}
} else {
@@ -388,6 +388,16 @@ export class CourseLabelRenderer {
: rgbaToCss(resolvedStyle.color, 0.98)
}
getControlLabelText(scene: MapScene, sequence: number): string {
if (scene.gameMode === 'score-o') {
const score = scene.controlScoresBySequence[sequence]
if (typeof score === 'number' && Number.isFinite(score)) {
return String(score)
}
}
return String(sequence)
}
clearCanvas(ctx: any): void {
ctx.setTransform(1, 0, 0, 1, 0, 0)
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)