完善文创展示控制与结果层基础
This commit is contained in:
@@ -13,10 +13,12 @@ import { type OrienteeringCourseData } from '../../utils/orienteeringCourse'
|
||||
import { isTileWithinBounds, type RemoteMapConfig, type TileZoomBounds } from '../../utils/remoteMapConfig'
|
||||
import { formatAnimationLevelText, resolveAnimationLevel, type AnimationLevel } from '../../utils/animationLevel'
|
||||
import { GameRuntime } from '../../game/core/gameRuntime'
|
||||
import { type GameControlDisplayContentOverride } from '../../game/core/gameDefinition'
|
||||
import { type GameEffect, type GameResult } from '../../game/core/gameResult'
|
||||
import { buildGameDefinitionFromCourse } from '../../game/content/courseToGameDefinition'
|
||||
import { FeedbackDirector } from '../../game/feedback/feedbackDirector'
|
||||
import { EMPTY_GAME_PRESENTATION_STATE, type GamePresentationState } from '../../game/presentation/presentationState'
|
||||
import { buildResultSummarySnapshot, type ResultSummarySnapshot } from '../../game/result/resultSummary'
|
||||
import { TelemetryRuntime } from '../../game/telemetry/telemetryRuntime'
|
||||
import { getHeartRateToneSampleBpm, type HeartRateTone } from '../../game/telemetry/telemetryConfig'
|
||||
|
||||
@@ -257,6 +259,8 @@ export interface MapEngineGameInfoSnapshot {
|
||||
globalRows: MapEngineGameInfoRow[]
|
||||
}
|
||||
|
||||
export type MapEngineResultSnapshot = ResultSummarySnapshot
|
||||
|
||||
const VIEW_SYNC_KEYS: Array<keyof MapEngineViewState> = [
|
||||
'animationLevel',
|
||||
'buildVersion',
|
||||
@@ -868,6 +872,7 @@ export class MapEngine {
|
||||
configSchemaVersion: string
|
||||
configVersion: string
|
||||
controlScoreOverrides: Record<string, number>
|
||||
controlContentOverrides: Record<string, GameControlDisplayContentOverride>
|
||||
defaultControlScore: number | null
|
||||
gameRuntime: GameRuntime
|
||||
telemetryRuntime: TelemetryRuntime
|
||||
@@ -882,6 +887,8 @@ export class MapEngine {
|
||||
autoFinishOnLastControl: boolean
|
||||
punchFeedbackTimer: number
|
||||
contentCardTimer: number
|
||||
currentContentCardPriority: number
|
||||
shownContentCardKeys: Record<string, true>
|
||||
mapPulseTimer: number
|
||||
stageFxTimer: number
|
||||
sessionTimerInterval: number
|
||||
@@ -1076,8 +1083,8 @@ export class MapEngine {
|
||||
showPunchFeedback: (text, tone, motionClass) => {
|
||||
this.showPunchFeedback(text, tone, motionClass)
|
||||
},
|
||||
showContentCard: (title, body, motionClass) => {
|
||||
this.showContentCard(title, body, motionClass)
|
||||
showContentCard: (title, body, motionClass, options) => {
|
||||
this.showContentCard(title, body, motionClass, options)
|
||||
},
|
||||
setPunchButtonFxClass: (className) => {
|
||||
this.setPunchButtonFxClass(className)
|
||||
@@ -1118,6 +1125,7 @@ export class MapEngine {
|
||||
this.configSchemaVersion = '1'
|
||||
this.configVersion = ''
|
||||
this.controlScoreOverrides = {}
|
||||
this.controlContentOverrides = {}
|
||||
this.defaultControlScore = null
|
||||
this.gameRuntime = new GameRuntime()
|
||||
this.telemetryRuntime = new TelemetryRuntime()
|
||||
@@ -1134,6 +1142,8 @@ export class MapEngine {
|
||||
this.gpsLockEnabled = false
|
||||
this.punchFeedbackTimer = 0
|
||||
this.contentCardTimer = 0
|
||||
this.currentContentCardPriority = 0
|
||||
this.shownContentCardKeys = {}
|
||||
this.mapPulseTimer = 0
|
||||
this.stageFxTimer = 0
|
||||
this.sessionTimerInterval = 0
|
||||
@@ -1405,6 +1415,15 @@ export class MapEngine {
|
||||
}
|
||||
}
|
||||
|
||||
getResultSceneSnapshot(): MapEngineResultSnapshot {
|
||||
return buildResultSummarySnapshot(
|
||||
this.gameRuntime.definition,
|
||||
this.gameRuntime.state,
|
||||
this.telemetryRuntime.getPresentation(),
|
||||
this.state.mapName || (this.gameRuntime.definition ? this.gameRuntime.definition.title : '本局结果'),
|
||||
)
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
this.clearInertiaTimer()
|
||||
this.clearPreviewResetTimer()
|
||||
@@ -1586,6 +1605,7 @@ export class MapEngine {
|
||||
this.skipRadiusMeters,
|
||||
this.skipRequiresConfirm,
|
||||
this.controlScoreOverrides,
|
||||
this.controlContentOverrides,
|
||||
this.defaultControlScore,
|
||||
)
|
||||
const result = this.gameRuntime.loadDefinition(definition)
|
||||
@@ -1723,6 +1743,12 @@ export class MapEngine {
|
||||
panelProgressFxClass: '',
|
||||
panelDistanceFxClass: '',
|
||||
}, true)
|
||||
this.currentContentCardPriority = 0
|
||||
}
|
||||
|
||||
resetSessionContentExperienceState(): void {
|
||||
this.shownContentCardKeys = {}
|
||||
this.currentContentCardPriority = 0
|
||||
}
|
||||
|
||||
clearSessionTimerInterval(): void {
|
||||
@@ -1878,7 +1904,22 @@ export class MapEngine {
|
||||
}, 1400) as unknown as number
|
||||
}
|
||||
|
||||
showContentCard(title: string, body: string, motionClass = ''): void {
|
||||
showContentCard(title: string, body: string, motionClass = '', options?: { contentKey?: string; autoPopup?: boolean; once?: boolean; priority?: number }): void {
|
||||
const autoPopup = !options || options.autoPopup !== false
|
||||
const once = !!(options && options.once)
|
||||
const priority = options && typeof options.priority === 'number' ? options.priority : 0
|
||||
const contentKey = options && options.contentKey ? options.contentKey : ''
|
||||
|
||||
if (!autoPopup) {
|
||||
return
|
||||
}
|
||||
if (once && contentKey && this.shownContentCardKeys[contentKey]) {
|
||||
return
|
||||
}
|
||||
if (this.state.contentCardVisible && priority < this.currentContentCardPriority) {
|
||||
return
|
||||
}
|
||||
|
||||
this.clearContentCardTimer()
|
||||
this.setState({
|
||||
contentCardVisible: true,
|
||||
@@ -1886,8 +1927,13 @@ export class MapEngine {
|
||||
contentCardBody: body,
|
||||
contentCardFxClass: motionClass,
|
||||
}, true)
|
||||
this.currentContentCardPriority = priority
|
||||
if (once && contentKey) {
|
||||
this.shownContentCardKeys[contentKey] = true
|
||||
}
|
||||
this.contentCardTimer = setTimeout(() => {
|
||||
this.contentCardTimer = 0
|
||||
this.currentContentCardPriority = 0
|
||||
this.setState({
|
||||
contentCardVisible: false,
|
||||
contentCardFxClass: '',
|
||||
@@ -1897,6 +1943,7 @@ export class MapEngine {
|
||||
|
||||
closeContentCard(): void {
|
||||
this.clearContentCardTimer()
|
||||
this.currentContentCardPriority = 0
|
||||
this.setState({
|
||||
contentCardVisible: false,
|
||||
contentCardFxClass: '',
|
||||
@@ -1955,11 +2002,19 @@ export class MapEngine {
|
||||
}
|
||||
|
||||
if (this.gameRuntime.state.status !== 'idle') {
|
||||
return
|
||||
if (this.gameRuntime.state.status === 'finished' || this.gameRuntime.state.status === 'failed') {
|
||||
const reloadedResult = this.loadGameDefinitionFromCourse()
|
||||
if (!reloadedResult || !this.gameRuntime.state) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
this.feedbackDirector.reset()
|
||||
this.resetTransientGameUiState()
|
||||
this.resetSessionContentExperienceState()
|
||||
this.clearStartSessionResidue()
|
||||
|
||||
if (!this.locationController.listening) {
|
||||
@@ -1985,9 +2040,10 @@ export class MapEngine {
|
||||
}
|
||||
|
||||
this.courseOverlayVisible = true
|
||||
const gameModeText = this.gameMode === 'score-o' ? '积分赛' : '顺序打点'
|
||||
const defaultStatusText = this.currentGpsPoint
|
||||
? `顺序打点已开始 (${this.buildVersion})`
|
||||
: `顺序打点已开始,GPS定位启动中 (${this.buildVersion})`
|
||||
? `${gameModeText}已开始 (${this.buildVersion})`
|
||||
: `${gameModeText}已开始,GPS定位启动中 (${this.buildVersion})`
|
||||
this.commitGameResult(gameResult, defaultStatusText)
|
||||
}
|
||||
|
||||
@@ -2000,6 +2056,7 @@ export class MapEngine {
|
||||
if (!this.courseData) {
|
||||
this.clearGameRuntime()
|
||||
this.resetTransientGameUiState()
|
||||
this.resetSessionContentExperienceState()
|
||||
this.feedbackDirector.handleEffects([{ type: 'session_cancelled' }])
|
||||
this.setState({
|
||||
gpsTracking: false,
|
||||
@@ -2012,6 +2069,7 @@ export class MapEngine {
|
||||
|
||||
this.loadGameDefinitionFromCourse()
|
||||
this.resetTransientGameUiState()
|
||||
this.resetSessionContentExperienceState()
|
||||
this.feedbackDirector.handleEffects([{ type: 'session_cancelled' }])
|
||||
this.setState({
|
||||
gpsTracking: false,
|
||||
@@ -2384,6 +2442,7 @@ export class MapEngine {
|
||||
this.configSchemaVersion = config.configSchemaVersion
|
||||
this.configVersion = config.configVersion
|
||||
this.controlScoreOverrides = config.controlScoreOverrides
|
||||
this.controlContentOverrides = config.controlContentOverrides
|
||||
this.defaultControlScore = config.defaultControlScore
|
||||
this.gameMode = config.gameMode
|
||||
this.punchPolicy = config.punchPolicy
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { type GameDefinition, type GameControl, type PunchPolicyType } from '../core/gameDefinition'
|
||||
import {
|
||||
type GameDefinition,
|
||||
type GameControl,
|
||||
type GameControlDisplayContent,
|
||||
type GameControlDisplayContentOverride,
|
||||
type PunchPolicyType,
|
||||
} from '../core/gameDefinition'
|
||||
import { type OrienteeringCourseData } from '../../utils/orienteeringCourse'
|
||||
|
||||
function sortBySequence<T extends { sequence: number | null }>(items: T[]): T[] {
|
||||
@@ -13,6 +19,23 @@ function buildDisplayBody(label: string, sequence: number | null): string {
|
||||
return label
|
||||
}
|
||||
|
||||
function applyDisplayContentOverride(
|
||||
baseContent: GameControlDisplayContent,
|
||||
override: GameControlDisplayContentOverride | undefined,
|
||||
): GameControlDisplayContent {
|
||||
if (!override) {
|
||||
return baseContent
|
||||
}
|
||||
|
||||
return {
|
||||
title: override.title || baseContent.title,
|
||||
body: override.body || baseContent.body,
|
||||
autoPopup: override.autoPopup !== undefined ? override.autoPopup : baseContent.autoPopup,
|
||||
once: override.once !== undefined ? override.once : baseContent.once,
|
||||
priority: override.priority !== undefined ? override.priority : baseContent.priority,
|
||||
}
|
||||
}
|
||||
|
||||
export function buildGameDefinitionFromCourse(
|
||||
course: OrienteeringCourseData,
|
||||
controlRadiusMeters: number,
|
||||
@@ -25,20 +48,29 @@ export function buildGameDefinitionFromCourse(
|
||||
skipRadiusMeters = 30,
|
||||
skipRequiresConfirm = true,
|
||||
controlScoreOverrides: Record<string, number> = {},
|
||||
controlContentOverrides: Record<string, GameControlDisplayContentOverride> = {},
|
||||
defaultControlScore: number | null = null,
|
||||
): GameDefinition {
|
||||
const controls: GameControl[] = []
|
||||
|
||||
for (const start of course.layers.starts) {
|
||||
for (let startIndex = 0; startIndex < course.layers.starts.length; startIndex += 1) {
|
||||
const start = course.layers.starts[startIndex]
|
||||
const startId = `start-${startIndex + 1}`
|
||||
controls.push({
|
||||
id: `start-${controls.length + 1}`,
|
||||
id: startId,
|
||||
code: start.label || 'S',
|
||||
label: start.label || 'Start',
|
||||
kind: 'start',
|
||||
point: start.point,
|
||||
sequence: null,
|
||||
score: null,
|
||||
displayContent: null,
|
||||
displayContent: applyDisplayContentOverride({
|
||||
title: '比赛开始',
|
||||
body: `${start.label || '开始点'}已激活,按提示前往下一个目标点。`,
|
||||
autoPopup: true,
|
||||
once: false,
|
||||
priority: 1,
|
||||
}, controlContentOverrides[startId]),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -56,23 +88,35 @@ export function buildGameDefinitionFromCourse(
|
||||
point: control.point,
|
||||
sequence: control.sequence,
|
||||
score,
|
||||
displayContent: {
|
||||
displayContent: applyDisplayContentOverride({
|
||||
title: score !== null ? `收集 ${label} (+${score}分)` : `收集 ${label}`,
|
||||
body: score !== null ? `${buildDisplayBody(label, control.sequence)} · ${score}分` : buildDisplayBody(label, control.sequence),
|
||||
},
|
||||
autoPopup: true,
|
||||
once: false,
|
||||
priority: 1,
|
||||
}, controlContentOverrides[controlId]),
|
||||
})
|
||||
}
|
||||
|
||||
for (const finish of course.layers.finishes) {
|
||||
for (let finishIndex = 0; finishIndex < course.layers.finishes.length; finishIndex += 1) {
|
||||
const finish = course.layers.finishes[finishIndex]
|
||||
const finishId = `finish-${finishIndex + 1}`
|
||||
const legacyFinishId = `finish-${controls.length + 1}`
|
||||
controls.push({
|
||||
id: `finish-${controls.length + 1}`,
|
||||
id: finishId,
|
||||
code: finish.label || 'F',
|
||||
label: finish.label || 'Finish',
|
||||
kind: 'finish',
|
||||
point: finish.point,
|
||||
sequence: null,
|
||||
score: null,
|
||||
displayContent: null,
|
||||
displayContent: applyDisplayContentOverride({
|
||||
title: '完成路线',
|
||||
body: `${finish.label || '结束点'}已完成,准备查看本局结果。`,
|
||||
autoPopup: true,
|
||||
once: false,
|
||||
priority: 2,
|
||||
}, controlContentOverrides[finishId] || controlContentOverrides[legacyFinishId]),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@ export type PunchPolicyType = 'enter' | 'enter-confirm'
|
||||
export interface GameControlDisplayContent {
|
||||
title: string
|
||||
body: string
|
||||
autoPopup: boolean
|
||||
once: boolean
|
||||
priority: number
|
||||
}
|
||||
|
||||
export interface GameControlDisplayContentOverride {
|
||||
title?: string
|
||||
body?: string
|
||||
autoPopup?: boolean
|
||||
once?: boolean
|
||||
priority?: number
|
||||
}
|
||||
|
||||
export interface GameControl {
|
||||
|
||||
@@ -5,7 +5,7 @@ export type GameEffect =
|
||||
| { type: 'session_started' }
|
||||
| { type: 'session_cancelled' }
|
||||
| { type: 'punch_feedback'; text: string; tone: 'neutral' | 'success' | 'warning' }
|
||||
| { type: 'control_completed'; controlId: string; controlKind: 'start' | 'control' | 'finish'; sequence: number | null; label: string; displayTitle: string; displayBody: string }
|
||||
| { type: 'control_completed'; controlId: string; controlKind: 'start' | 'control' | 'finish'; sequence: number | null; label: string; displayTitle: string; displayBody: string; displayAutoPopup: boolean; displayOnce: boolean; displayPriority: number }
|
||||
| { type: 'guidance_state_changed'; guidanceState: GuidanceState; controlId: string | null }
|
||||
| { type: 'session_finished' }
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
|
||||
export interface UiEffectHost {
|
||||
showPunchFeedback: (text: string, tone: 'neutral' | 'success' | 'warning', motionClass?: string) => void
|
||||
showContentCard: (title: string, body: string, motionClass?: string) => void
|
||||
showContentCard: (title: string, body: string, motionClass?: string, options?: { contentKey?: string; autoPopup?: boolean; once?: boolean; priority?: number }) => void
|
||||
setPunchButtonFxClass: (className: string) => void
|
||||
setHudProgressFxClass: (className: string) => void
|
||||
setHudDistanceFxClass: (className: string) => void
|
||||
@@ -262,6 +262,12 @@ export class UiEffectDirector {
|
||||
effect.displayTitle,
|
||||
effect.displayBody,
|
||||
cue ? this.getContentCardMotionClass(cue.contentCardMotion) : '',
|
||||
{
|
||||
contentKey: effect.controlId,
|
||||
autoPopup: effect.displayAutoPopup,
|
||||
once: effect.displayOnce,
|
||||
priority: effect.displayPriority,
|
||||
},
|
||||
)
|
||||
if (cue && cue.mapPulseMotion !== 'none') {
|
||||
this.host.showMapPulse(effect.controlId, this.getMapPulseMotionClass(cue.mapPulseMotion))
|
||||
|
||||
91
miniprogram/game/result/resultSummary.ts
Normal file
91
miniprogram/game/result/resultSummary.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import { type GameDefinition } from '../core/gameDefinition'
|
||||
import { type GameSessionState } from '../core/gameSessionState'
|
||||
import { type TelemetryPresentation } from '../telemetry/telemetryPresentation'
|
||||
|
||||
export interface ResultSummaryRow {
|
||||
label: string
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface ResultSummarySnapshot {
|
||||
title: string
|
||||
subtitle: string
|
||||
heroLabel: string
|
||||
heroValue: string
|
||||
rows: ResultSummaryRow[]
|
||||
}
|
||||
|
||||
function resolveTitle(definition: GameDefinition | null, mapTitle: string): string {
|
||||
if (mapTitle) {
|
||||
return mapTitle
|
||||
}
|
||||
if (definition && definition.title) {
|
||||
return definition.title
|
||||
}
|
||||
return '本局结果'
|
||||
}
|
||||
|
||||
function buildHeroValue(definition: GameDefinition | null, sessionState: GameSessionState, telemetryPresentation: TelemetryPresentation): string {
|
||||
if (definition && definition.mode === 'score-o') {
|
||||
return `${sessionState.score}`
|
||||
}
|
||||
return telemetryPresentation.timerText
|
||||
}
|
||||
|
||||
function buildHeroLabel(definition: GameDefinition | null): string {
|
||||
return definition && definition.mode === 'score-o' ? '本局得分' : '本局用时'
|
||||
}
|
||||
|
||||
function buildSubtitle(sessionState: GameSessionState): string {
|
||||
if (sessionState.status === 'finished') {
|
||||
return '本局已完成'
|
||||
}
|
||||
if (sessionState.status === 'failed') {
|
||||
return '本局已结束'
|
||||
}
|
||||
return '对局摘要'
|
||||
}
|
||||
|
||||
export function buildResultSummarySnapshot(
|
||||
definition: GameDefinition | null,
|
||||
sessionState: GameSessionState | null,
|
||||
telemetryPresentation: TelemetryPresentation,
|
||||
mapTitle: string,
|
||||
): ResultSummarySnapshot {
|
||||
const resolvedSessionState: GameSessionState = sessionState || {
|
||||
status: 'idle',
|
||||
startedAt: null,
|
||||
endedAt: null,
|
||||
completedControlIds: [],
|
||||
skippedControlIds: [],
|
||||
currentTargetControlId: null,
|
||||
inRangeControlId: null,
|
||||
score: 0,
|
||||
guidanceState: 'searching',
|
||||
modeState: null,
|
||||
}
|
||||
const skippedCount = resolvedSessionState.skippedControlIds.length
|
||||
const totalControlCount = definition
|
||||
? definition.controls.filter((control) => control.kind === 'control').length
|
||||
: 0
|
||||
const averageHeartRateText = telemetryPresentation.heartRateValueText !== '--'
|
||||
? `${telemetryPresentation.heartRateValueText} ${telemetryPresentation.heartRateUnitText || 'bpm'}`
|
||||
: '--'
|
||||
|
||||
return {
|
||||
title: resolveTitle(definition, mapTitle),
|
||||
subtitle: buildSubtitle(resolvedSessionState),
|
||||
heroLabel: buildHeroLabel(definition),
|
||||
heroValue: buildHeroValue(definition, resolvedSessionState, telemetryPresentation),
|
||||
rows: [
|
||||
{ label: '状态', value: resolvedSessionState.status === 'finished' ? '完成' : (resolvedSessionState.status === 'failed' ? '结束' : '进行中') },
|
||||
{ label: '完成点数', value: totalControlCount > 0 ? `${resolvedSessionState.completedControlIds.length}/${totalControlCount}` : `${resolvedSessionState.completedControlIds.length}` },
|
||||
{ label: '跳过点数', value: `${skippedCount}` },
|
||||
{ label: '累计里程', value: telemetryPresentation.mileageText },
|
||||
{ label: '平均速度', value: `${telemetryPresentation.averageSpeedValueText}${telemetryPresentation.averageSpeedUnitText}` },
|
||||
{ label: '当前得分', value: `${resolvedSessionState.score}` },
|
||||
{ label: '累计消耗', value: `${telemetryPresentation.caloriesValueText}${telemetryPresentation.caloriesUnitText}` },
|
||||
{ label: '平均心率', value: averageHeartRateText },
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -287,8 +287,11 @@ function buildCompletedEffect(control: GameControl): GameEffect {
|
||||
controlKind: 'start',
|
||||
sequence: null,
|
||||
label: control.label,
|
||||
displayTitle: '比赛开始',
|
||||
displayBody: '已完成开始点打卡,前往 1 号点。',
|
||||
displayTitle: control.displayContent ? control.displayContent.title : '比赛开始',
|
||||
displayBody: control.displayContent ? control.displayContent.body : '已完成开始点打卡,前往 1 号点。',
|
||||
displayAutoPopup: control.displayContent ? control.displayContent.autoPopup : true,
|
||||
displayOnce: control.displayContent ? control.displayContent.once : false,
|
||||
displayPriority: control.displayContent ? control.displayContent.priority : 1,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,8 +302,11 @@ function buildCompletedEffect(control: GameControl): GameEffect {
|
||||
controlKind: 'finish',
|
||||
sequence: null,
|
||||
label: control.label,
|
||||
displayTitle: '比赛结束',
|
||||
displayBody: '已完成终点打卡,本局结束。',
|
||||
displayTitle: control.displayContent ? control.displayContent.title : '比赛结束',
|
||||
displayBody: control.displayContent ? control.displayContent.body : '已完成终点打卡,本局结束。',
|
||||
displayAutoPopup: control.displayContent ? control.displayContent.autoPopup : true,
|
||||
displayOnce: control.displayContent ? control.displayContent.once : false,
|
||||
displayPriority: control.displayContent ? control.displayContent.priority : 2,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,6 +322,9 @@ function buildCompletedEffect(control: GameControl): GameEffect {
|
||||
label: control.label,
|
||||
displayTitle,
|
||||
displayBody,
|
||||
displayAutoPopup: control.displayContent ? control.displayContent.autoPopup : true,
|
||||
displayOnce: control.displayContent ? control.displayContent.once : false,
|
||||
displayPriority: control.displayContent ? control.displayContent.priority : 1,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -249,8 +249,11 @@ function buildCompletedEffect(control: GameControl): GameEffect {
|
||||
controlKind: 'start',
|
||||
sequence: null,
|
||||
label: control.label,
|
||||
displayTitle: '比赛开始',
|
||||
displayBody: '已完成开始点打卡,开始自由打点。',
|
||||
displayTitle: control.displayContent ? control.displayContent.title : '比赛开始',
|
||||
displayBody: control.displayContent ? control.displayContent.body : '已完成开始点打卡,开始自由打点。',
|
||||
displayAutoPopup: control.displayContent ? control.displayContent.autoPopup : true,
|
||||
displayOnce: control.displayContent ? control.displayContent.once : false,
|
||||
displayPriority: control.displayContent ? control.displayContent.priority : 1,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,8 +264,11 @@ function buildCompletedEffect(control: GameControl): GameEffect {
|
||||
controlKind: 'finish',
|
||||
sequence: null,
|
||||
label: control.label,
|
||||
displayTitle: '比赛结束',
|
||||
displayBody: '已完成终点打卡,本局结束。',
|
||||
displayTitle: control.displayContent ? control.displayContent.title : '比赛结束',
|
||||
displayBody: control.displayContent ? control.displayContent.body : '已完成终点打卡,本局结束。',
|
||||
displayAutoPopup: control.displayContent ? control.displayContent.autoPopup : true,
|
||||
displayOnce: control.displayContent ? control.displayContent.once : false,
|
||||
displayPriority: control.displayContent ? control.displayContent.priority : 2,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,6 +281,9 @@ function buildCompletedEffect(control: GameControl): GameEffect {
|
||||
label: control.label,
|
||||
displayTitle: control.displayContent ? control.displayContent.title : `收集 ${sequenceText}`,
|
||||
displayBody: control.displayContent ? control.displayContent.body : control.label,
|
||||
displayAutoPopup: control.displayContent ? control.displayContent.autoPopup : true,
|
||||
displayOnce: control.displayContent ? control.displayContent.once : false,
|
||||
displayPriority: control.displayContent ? control.displayContent.priority : 1,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
MapEngine,
|
||||
type MapEngineGameInfoRow,
|
||||
type MapEngineGameInfoSnapshot,
|
||||
type MapEngineResultSnapshot,
|
||||
type MapEngineStageRect,
|
||||
type MapEngineViewState,
|
||||
} from '../../engine/map/mapEngine'
|
||||
@@ -64,6 +65,7 @@ type StoredUserSettings = {
|
||||
type MapPageData = MapEngineViewState & {
|
||||
showDebugPanel: boolean
|
||||
showGameInfoPanel: boolean
|
||||
showResultScene: boolean
|
||||
showSystemSettingsPanel: boolean
|
||||
showCenterScaleRuler: boolean
|
||||
showPunchHintBanner: boolean
|
||||
@@ -78,6 +80,11 @@ type MapPageData = MapEngineViewState & {
|
||||
gameInfoSubtitle: string
|
||||
gameInfoLocalRows: MapEngineGameInfoRow[]
|
||||
gameInfoGlobalRows: MapEngineGameInfoRow[]
|
||||
resultSceneTitle: string
|
||||
resultSceneSubtitle: string
|
||||
resultSceneHeroLabel: string
|
||||
resultSceneHeroValue: string
|
||||
resultSceneRows: MapEngineGameInfoRow[]
|
||||
panelTimerText: string
|
||||
panelMileageText: string
|
||||
panelDistanceValueText: string
|
||||
@@ -121,7 +128,7 @@ type MapPageData = MapEngineViewState & {
|
||||
showRightButtonGroups: boolean
|
||||
showBottomDebugButton: boolean
|
||||
}
|
||||
const INTERNAL_BUILD_VERSION = 'map-build-283'
|
||||
const INTERNAL_BUILD_VERSION = 'map-build-291'
|
||||
const USER_SETTINGS_STORAGE_KEY = 'cmr_user_settings_v1'
|
||||
const CLASSIC_REMOTE_GAME_CONFIG_URL = 'https://oss-mbh5.colormaprun.com/gotomars/event/classic-sequential.json'
|
||||
const SCORE_O_REMOTE_GAME_CONFIG_URL = 'https://oss-mbh5.colormaprun.com/gotomars/event/score-o.json'
|
||||
@@ -494,7 +501,7 @@ function buildSideButtonState(data: Pick<MapPageData, 'sideButtonMode' | 'showGa
|
||||
: data.gpsLockEnabled
|
||||
? 'active'
|
||||
: 'default'
|
||||
const sideButton4State: SideActionButtonState = data.gameSessionStatus === 'idle' ? 'default' : 'active'
|
||||
const sideButton4State: SideActionButtonState = data.gameSessionStatus === 'running' ? 'active' : 'muted'
|
||||
const sideButton11State: SideActionButtonState = data.showGameInfoPanel ? 'active' : 'default'
|
||||
const sideButton12State: SideActionButtonState = data.showSystemSettingsPanel ? 'active' : 'default'
|
||||
const sideButton13State: SideActionButtonState = data.showCenterScaleRuler ? 'active' : 'default'
|
||||
@@ -690,10 +697,21 @@ function buildEmptyGameInfoSnapshot(): MapEngineGameInfoSnapshot {
|
||||
}
|
||||
}
|
||||
|
||||
function buildEmptyResultSceneSnapshot(): MapEngineResultSnapshot {
|
||||
return {
|
||||
title: '本局结果',
|
||||
subtitle: '未开始',
|
||||
heroLabel: '本局用时',
|
||||
heroValue: '--',
|
||||
rows: [],
|
||||
}
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
showDebugPanel: false,
|
||||
showGameInfoPanel: false,
|
||||
showResultScene: false,
|
||||
showSystemSettingsPanel: false,
|
||||
showCenterScaleRuler: false,
|
||||
statusBarHeight: 0,
|
||||
@@ -714,6 +732,11 @@ Page({
|
||||
gameInfoSubtitle: '未开始',
|
||||
gameInfoLocalRows: [],
|
||||
gameInfoGlobalRows: buildEmptyGameInfoSnapshot().globalRows,
|
||||
resultSceneTitle: '本局结果',
|
||||
resultSceneSubtitle: '未开始',
|
||||
resultSceneHeroLabel: '本局用时',
|
||||
resultSceneHeroValue: '--',
|
||||
resultSceneRows: buildEmptyResultSceneSnapshot().rows,
|
||||
panelTimerText: '00:00:00',
|
||||
panelMileageText: '0m',
|
||||
panelActionTagText: '目标',
|
||||
@@ -942,6 +965,22 @@ Page({
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof nextPatch.gameSessionStatus === 'string') {
|
||||
if (
|
||||
nextPatch.gameSessionStatus !== this.data.gameSessionStatus
|
||||
&& (nextPatch.gameSessionStatus === 'finished' || nextPatch.gameSessionStatus === 'failed')
|
||||
) {
|
||||
this.syncResultSceneSnapshot()
|
||||
nextData.showResultScene = true
|
||||
nextData.showDebugPanel = false
|
||||
nextData.showGameInfoPanel = false
|
||||
nextData.showSystemSettingsPanel = false
|
||||
clearGameInfoPanelSyncTimer()
|
||||
} else if (nextPatch.gameSessionStatus === 'running' || nextPatch.gameSessionStatus === 'idle') {
|
||||
nextData.showResultScene = false
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(nextData).length || Object.keys(derivedPatch).length) {
|
||||
this.setData({
|
||||
...nextData,
|
||||
@@ -1341,6 +1380,16 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
handleConnectAllMockSources() {
|
||||
if (!mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleConnectMockLocationBridge()
|
||||
mapEngine.handleSetMockLocationMode()
|
||||
mapEngine.handleSetMockHeartRateMode()
|
||||
mapEngine.handleConnectMockHeartRateBridge()
|
||||
},
|
||||
|
||||
handleMockBridgeUrlInput(event: WechatMiniprogram.Input) {
|
||||
this.setData({
|
||||
mockBridgeUrlDraft: event.detail.value,
|
||||
@@ -1485,7 +1534,7 @@ Page({
|
||||
},
|
||||
|
||||
handleForceExitGame() {
|
||||
if (!mapEngine || this.data.gameSessionStatus === 'idle') {
|
||||
if (!mapEngine || this.data.gameSessionStatus !== 'running') {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1555,6 +1604,21 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
syncResultSceneSnapshot() {
|
||||
if (!mapEngine) {
|
||||
return
|
||||
}
|
||||
|
||||
const snapshot = mapEngine.getResultSceneSnapshot()
|
||||
this.setData({
|
||||
resultSceneTitle: snapshot.title,
|
||||
resultSceneSubtitle: snapshot.subtitle,
|
||||
resultSceneHeroLabel: snapshot.heroLabel,
|
||||
resultSceneHeroValue: snapshot.heroValue,
|
||||
resultSceneRows: snapshot.rows,
|
||||
})
|
||||
},
|
||||
|
||||
scheduleGameInfoPanelSnapshotSync() {
|
||||
if (!this.data.showGameInfoPanel) {
|
||||
clearGameInfoPanelSyncTimer()
|
||||
@@ -1614,6 +1678,27 @@ Page({
|
||||
|
||||
handleGameInfoPanelTap() {},
|
||||
|
||||
handleResultSceneTap() {},
|
||||
|
||||
handleCloseResultScene() {
|
||||
this.setData({
|
||||
showResultScene: false,
|
||||
})
|
||||
},
|
||||
|
||||
handleRestartFromResult() {
|
||||
if (!mapEngine) {
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
showResultScene: false,
|
||||
}, () => {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleStartGame()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
handleOpenSystemSettingsPanel() {
|
||||
clearGameInfoPanelSyncTimer()
|
||||
this.setData({
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</view>
|
||||
|
||||
|
||||
<view class="map-stage__overlay-center-layer" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showSystemSettingsPanel}}">
|
||||
<view class="map-stage__overlay-center-layer" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showResultScene && !showSystemSettingsPanel}}">
|
||||
<view class="center-scale-ruler" wx:if="{{centerScaleRulerVisible}}" style="left: {{centerScaleRulerCenterXPx}}px; top: {{centerScaleRulerZeroYPx}}px; height: {{centerScaleRulerHeightPx}}px;">
|
||||
<view class="center-scale-ruler__axis" style="bottom: {{centerScaleRulerAxisBottomPx}}px;"></view>
|
||||
<view class="center-scale-ruler__arrow"></view>
|
||||
@@ -46,7 +46,7 @@
|
||||
<view wx:for="{{centerScaleRulerMajorMarks}}" wx:key="key" class="center-scale-ruler__label" style="top: {{item.topPx}}px;">{{item.label}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="map-stage__overlay">
|
||||
<view class="map-stage__overlay" wx:if="{{!showResultScene}}">
|
||||
<view class="map-stage__bottom">
|
||||
<view class="compass-widget">
|
||||
<view class="compass-widget__heading-wrap">
|
||||
@@ -80,18 +80,18 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="game-punch-hint" wx:if="{{showPunchHintBanner && punchHintText}}" style="top: {{topInsetHeight}}px;" catchtouchstart="handlePunchHintTap" catchtouchmove="handlePunchHintTap" catchtouchend="handlePunchHintTap">
|
||||
<view class="game-punch-hint" wx:if="{{!showResultScene && showPunchHintBanner && punchHintText}}" style="top: {{topInsetHeight}}px;" catchtouchstart="handlePunchHintTap" catchtouchmove="handlePunchHintTap" catchtouchend="handlePunchHintTap">
|
||||
<view class="game-punch-hint__text">{{punchHintText}}</view>
|
||||
<view class="game-punch-hint__close" catchtouchstart="handlePunchHintTap" catchtouchmove="handlePunchHintTap" catchtouchend="handlePunchHintTap" catchtap="handleClosePunchHint">×</view>
|
||||
</view>
|
||||
|
||||
<cover-view class="map-side-toggle {{sideButtonPlacement === 'right' ? 'map-side-toggle--right' : 'map-side-toggle--left'}}" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showSystemSettingsPanel}}" style="top: {{topInsetHeight}}px;" bindtap="handleCycleSideButtons">
|
||||
<cover-view class="map-side-toggle {{sideButtonPlacement === 'right' ? 'map-side-toggle--right' : 'map-side-toggle--left'}}" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showResultScene && !showSystemSettingsPanel}}" style="top: {{topInsetHeight}}px;" bindtap="handleCycleSideButtons">
|
||||
<cover-view class="map-side-button map-side-button--icon">
|
||||
<cover-image class="map-side-button__image" src="{{sideToggleIconSrc}}"></cover-image>
|
||||
</cover-view>
|
||||
</cover-view>
|
||||
|
||||
<cover-view class="map-side-column {{sideButtonPlacement === 'right' ? 'map-side-column--right-group' : 'map-side-column--left'}} map-side-column--left-group" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showSystemSettingsPanel && showLeftButtonGroup}}" style="top: {{topInsetHeight}}px;">
|
||||
<cover-view class="map-side-column {{sideButtonPlacement === 'right' ? 'map-side-column--right-group' : 'map-side-column--left'}} map-side-column--left-group" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showResultScene && !showSystemSettingsPanel && showLeftButtonGroup}}" style="top: {{topInsetHeight}}px;">
|
||||
<cover-view class="map-side-button map-side-button--icon" bindtap="handleToggleMapRotateMode"><cover-image class="map-side-button__rotate-image {{orientationMode === 'heading-up' ? 'map-side-button__rotate-image--active' : ''}}" src="../../assets/btn_map_rotate_cropped.png"></cover-image></cover-view>
|
||||
<cover-view class="{{sideButton2Class}}" bindtap="handleToggleGpsLock">
|
||||
<cover-image
|
||||
@@ -111,15 +111,15 @@
|
||||
<cover-view class="{{sideButton4Class}}" bindtap="handleForceExitGame"><cover-image class="map-side-button__action-image" src="../../assets/btn_exit.png"></cover-image></cover-view>
|
||||
</cover-view>
|
||||
|
||||
<cover-view class="map-punch-button {{punchButtonEnabled ? 'map-punch-button--active' : ''}} {{punchButtonFxClass}}" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showSystemSettingsPanel}}" bindtap="handlePunchAction">
|
||||
<cover-view class="map-punch-button {{punchButtonEnabled ? 'map-punch-button--active' : ''}} {{punchButtonFxClass}}" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showResultScene && !showSystemSettingsPanel}}" bindtap="handlePunchAction">
|
||||
<cover-view class="map-punch-button__text">{{punchButtonText}}</cover-view>
|
||||
</cover-view>
|
||||
|
||||
<cover-view class="screen-button-layer screen-button-layer--start-left" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showSystemSettingsPanel && showBottomDebugButton && gameSessionStatus === 'idle'}}" bindtap="handleStartGame">
|
||||
<cover-view class="screen-button-layer screen-button-layer--start-left" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showResultScene && !showSystemSettingsPanel && showBottomDebugButton && gameSessionStatus !== 'running'}}" bindtap="handleStartGame">
|
||||
<cover-view class="screen-button-layer__text screen-button-layer__text--start">开始</cover-view>
|
||||
</cover-view>
|
||||
|
||||
<cover-view class="screen-button-layer screen-button-layer--bottom-left" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showSystemSettingsPanel && showBottomDebugButton}}" bindtap="handleToggleDebugPanel">
|
||||
<cover-view class="screen-button-layer screen-button-layer--bottom-left" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showResultScene && !showSystemSettingsPanel && showBottomDebugButton}}" bindtap="handleToggleDebugPanel">
|
||||
<cover-view class="screen-button-layer__icon">
|
||||
<cover-view class="screen-button-layer__line"></cover-view>
|
||||
<cover-view class="screen-button-layer__stand"></cover-view>
|
||||
@@ -127,7 +127,7 @@
|
||||
<cover-view class="screen-button-layer__text">调试</cover-view>
|
||||
</cover-view>
|
||||
|
||||
<swiper wx:if="{{!showGameInfoPanel && !showSystemSettingsPanel}}" class="race-panel-swiper" current="{{hudPanelIndex}}" bindchange="handleHudPanelChange" duration="220" easing-function="easeOutCubic">
|
||||
<swiper wx:if="{{!showGameInfoPanel && !showResultScene && !showSystemSettingsPanel}}" class="race-panel-swiper" current="{{hudPanelIndex}}" bindchange="handleHudPanelChange" duration="220" easing-function="easeOutCubic">
|
||||
<swiper-item>
|
||||
<view class="race-panel race-panel--tone-{{panelTelemetryTone}}">
|
||||
<view class="race-panel__tag race-panel__tag--top-left">{{panelActionTagText}}</view>
|
||||
@@ -232,7 +232,7 @@
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="race-panel-pager" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showSystemSettingsPanel}}">
|
||||
<view class="race-panel-pager" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showResultScene && !showSystemSettingsPanel}}">
|
||||
<view class="race-panel-pager__dot {{hudPanelIndex === 0 ? 'race-panel-pager__dot--active' : ''}}"></view>
|
||||
<view class="race-panel-pager__dot {{hudPanelIndex === 1 ? 'race-panel-pager__dot--active' : ''}}"></view>
|
||||
</view>
|
||||
@@ -276,6 +276,31 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="result-scene-modal" wx:if="{{showResultScene}}" bindtap="handleCloseResultScene">
|
||||
<view class="result-scene-modal__dialog" catchtap="handleResultSceneTap">
|
||||
<view class="result-scene-modal__eyebrow">RESULT</view>
|
||||
<view class="result-scene-modal__title">{{resultSceneTitle}}</view>
|
||||
<view class="result-scene-modal__subtitle">{{resultSceneSubtitle}}</view>
|
||||
|
||||
<view class="result-scene-modal__hero">
|
||||
<view class="result-scene-modal__hero-label">{{resultSceneHeroLabel}}</view>
|
||||
<view class="result-scene-modal__hero-value">{{resultSceneHeroValue}}</view>
|
||||
</view>
|
||||
|
||||
<view class="result-scene-modal__rows">
|
||||
<view class="result-scene-modal__row" wx:for="{{resultSceneRows}}" wx:key="label">
|
||||
<text class="result-scene-modal__row-label">{{item.label}}</text>
|
||||
<text class="result-scene-modal__row-value">{{item.value}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="result-scene-modal__actions">
|
||||
<view class="result-scene-modal__action result-scene-modal__action--secondary" bindtap="handleCloseResultScene">返回地图</view>
|
||||
<view class="result-scene-modal__action result-scene-modal__action--primary" bindtap="handleRestartFromResult">再来一局</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="game-info-modal" wx:if="{{showSystemSettingsPanel}}" bindtap="handleCloseSystemSettingsPanel">
|
||||
<view class="game-info-modal__dialog" catchtap="handleSystemSettingsPanelTap">
|
||||
<view class="game-info-modal__header">
|
||||
@@ -525,6 +550,9 @@
|
||||
<view class="debug-section__title">Sensors</view>
|
||||
<view class="debug-section__desc">定位、罗盘与心率带连接状态</view>
|
||||
</view>
|
||||
<view class="control-row">
|
||||
<view class="control-chip control-chip--primary" bindtap="handleConnectAllMockSources">一键连接模拟源</view>
|
||||
</view>
|
||||
<view class="debug-group-title">定位</view>
|
||||
<view class="info-panel__row">
|
||||
<text class="info-panel__label">GPS</text>
|
||||
|
||||
@@ -1327,6 +1327,130 @@
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.result-scene-modal {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 28rpx;
|
||||
box-sizing: border-box;
|
||||
background: rgba(7, 18, 12, 0.38);
|
||||
z-index: 32;
|
||||
}
|
||||
|
||||
.result-scene-modal__dialog {
|
||||
width: 100%;
|
||||
max-width: 680rpx;
|
||||
padding: 36rpx 32rpx 30rpx;
|
||||
border-radius: 40rpx;
|
||||
background: rgba(248, 251, 244, 0.98);
|
||||
box-shadow: 0 22rpx 68rpx rgba(7, 18, 12, 0.24);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.result-scene-modal__eyebrow {
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
letter-spacing: 4rpx;
|
||||
color: #5f7a65;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.result-scene-modal__title {
|
||||
margin-top: 14rpx;
|
||||
font-size: 46rpx;
|
||||
line-height: 1.08;
|
||||
font-weight: 700;
|
||||
color: #163020;
|
||||
}
|
||||
|
||||
.result-scene-modal__subtitle {
|
||||
margin-top: 12rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.35;
|
||||
color: #5f7a65;
|
||||
}
|
||||
|
||||
.result-scene-modal__hero {
|
||||
margin-top: 28rpx;
|
||||
padding: 26rpx 24rpx 22rpx;
|
||||
border-radius: 28rpx;
|
||||
background: linear-gradient(180deg, rgba(35, 135, 87, 0.12), rgba(35, 135, 87, 0.06));
|
||||
}
|
||||
|
||||
.result-scene-modal__hero-label {
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
color: #4d6852;
|
||||
}
|
||||
|
||||
.result-scene-modal__hero-value {
|
||||
margin-top: 12rpx;
|
||||
font-size: 68rpx;
|
||||
line-height: 1;
|
||||
font-weight: 800;
|
||||
color: #163020;
|
||||
}
|
||||
|
||||
.result-scene-modal__rows {
|
||||
margin-top: 24rpx;
|
||||
border-radius: 28rpx;
|
||||
overflow: hidden;
|
||||
background: rgba(22, 48, 32, 0.04);
|
||||
}
|
||||
|
||||
.result-scene-modal__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-bottom: 1rpx solid rgba(22, 48, 32, 0.08);
|
||||
}
|
||||
|
||||
.result-scene-modal__row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.result-scene-modal__row-label {
|
||||
font-size: 24rpx;
|
||||
color: #5f7a65;
|
||||
}
|
||||
|
||||
.result-scene-modal__row-value {
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
color: #163020;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.result-scene-modal__actions {
|
||||
margin-top: 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.result-scene-modal__action {
|
||||
flex: 1;
|
||||
padding: 24rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.result-scene-modal__action--secondary {
|
||||
background: rgba(22, 48, 32, 0.08);
|
||||
color: #163020;
|
||||
}
|
||||
|
||||
.result-scene-modal__action--primary {
|
||||
background: #163020;
|
||||
color: #f7fbf2;
|
||||
}
|
||||
|
||||
.debug-section--info {
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { lonLatToWorldTile, webMercatorToLonLat, type LonLatPoint } from './proj
|
||||
import { parseOrienteeringCourseKml, type OrienteeringCourseData } from './orienteeringCourse'
|
||||
import { mergeGameAudioConfig, type AudioCueKey, type GameAudioConfig, type GameAudioConfigOverrides, type PartialAudioCueConfig } from '../game/audio/audioConfig'
|
||||
import { mergeTelemetryConfig, type TelemetryConfig } from '../game/telemetry/telemetryConfig'
|
||||
import { type GameControlDisplayContentOverride } from '../game/core/gameDefinition'
|
||||
import {
|
||||
mergeGameHapticsConfig,
|
||||
mergeGameUiEffectsConfig,
|
||||
@@ -55,6 +56,7 @@ export interface RemoteMapConfig {
|
||||
skipRequiresConfirm: boolean
|
||||
autoFinishOnLastControl: boolean
|
||||
controlScoreOverrides: Record<string, number>
|
||||
controlContentOverrides: Record<string, GameControlDisplayContentOverride>
|
||||
defaultControlScore: number | null
|
||||
telemetryConfig: TelemetryConfig
|
||||
audioConfig: GameAudioConfig
|
||||
@@ -81,6 +83,7 @@ interface ParsedGameConfig {
|
||||
skipRequiresConfirm: boolean
|
||||
autoFinishOnLastControl: boolean
|
||||
controlScoreOverrides: Record<string, number>
|
||||
controlContentOverrides: Record<string, GameControlDisplayContentOverride>
|
||||
defaultControlScore: number | null
|
||||
telemetryConfig: TelemetryConfig
|
||||
audioConfig: GameAudioConfig
|
||||
@@ -759,6 +762,7 @@ function parseGameConfigFromJson(text: string, gameConfigUrl: string): ParsedGam
|
||||
? rawPlayfield.controlOverrides as Record<string, unknown>
|
||||
: null
|
||||
const controlScoreOverrides: Record<string, number> = {}
|
||||
const controlContentOverrides: Record<string, GameControlDisplayContentOverride> = {}
|
||||
if (rawControlOverrides) {
|
||||
const keys = Object.keys(rawControlOverrides)
|
||||
for (const key of keys) {
|
||||
@@ -770,6 +774,27 @@ function parseGameConfigFromJson(text: string, gameConfigUrl: string): ParsedGam
|
||||
if (Number.isFinite(scoreValue)) {
|
||||
controlScoreOverrides[key] = scoreValue
|
||||
}
|
||||
const titleValue = typeof (item as Record<string, unknown>).title === 'string'
|
||||
? ((item as Record<string, unknown>).title as string).trim()
|
||||
: ''
|
||||
const bodyValue = typeof (item as Record<string, unknown>).body === 'string'
|
||||
? ((item as Record<string, unknown>).body as string).trim()
|
||||
: ''
|
||||
const autoPopupValue = (item as Record<string, unknown>).autoPopup
|
||||
const onceValue = (item as Record<string, unknown>).once
|
||||
const priorityNumeric = Number((item as Record<string, unknown>).priority)
|
||||
const hasAutoPopup = typeof autoPopupValue === 'boolean'
|
||||
const hasOnce = typeof onceValue === 'boolean'
|
||||
const hasPriority = Number.isFinite(priorityNumeric)
|
||||
if (titleValue || bodyValue || hasAutoPopup || hasOnce || hasPriority) {
|
||||
controlContentOverrides[key] = {
|
||||
...(titleValue ? { title: titleValue } : {}),
|
||||
...(bodyValue ? { body: bodyValue } : {}),
|
||||
...(hasAutoPopup ? { autoPopup: !!autoPopupValue } : {}),
|
||||
...(hasOnce ? { once: !!onceValue } : {}),
|
||||
...(hasPriority ? { priority: Math.max(0, Math.round(priorityNumeric)) } : {}),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,6 +884,7 @@ function parseGameConfigFromJson(text: string, gameConfigUrl: string): ParsedGam
|
||||
true,
|
||||
),
|
||||
controlScoreOverrides,
|
||||
controlContentOverrides,
|
||||
defaultControlScore: rawScoring && rawScoring.defaultControlScore !== undefined
|
||||
? parsePositiveNumber(rawScoring.defaultControlScore, 10)
|
||||
: null,
|
||||
@@ -921,6 +947,7 @@ function parseGameConfigFromYaml(text: string, gameConfigUrl: string): ParsedGam
|
||||
skipRequiresConfirm: parseBoolean(config.skiprequiresconfirm, true),
|
||||
autoFinishOnLastControl: parseBoolean(config.autofinishonlastcontrol, true),
|
||||
controlScoreOverrides: {},
|
||||
controlContentOverrides: {},
|
||||
defaultControlScore: null,
|
||||
telemetryConfig: parseTelemetryConfig({
|
||||
heartRate: {
|
||||
@@ -1206,6 +1233,7 @@ export async function loadRemoteMapConfig(gameConfigUrl: string): Promise<Remote
|
||||
skipRequiresConfirm: gameConfig.skipRequiresConfirm,
|
||||
autoFinishOnLastControl: gameConfig.autoFinishOnLastControl,
|
||||
controlScoreOverrides: gameConfig.controlScoreOverrides,
|
||||
controlContentOverrides: gameConfig.controlContentOverrides,
|
||||
defaultControlScore: gameConfig.defaultControlScore,
|
||||
telemetryConfig: gameConfig.telemetryConfig,
|
||||
audioConfig: gameConfig.audioConfig,
|
||||
|
||||
Reference in New Issue
Block a user