Refine telemetry-driven HUD and fitness feedback
This commit is contained in:
@@ -17,6 +17,7 @@ type MapPageData = MapEngineViewState & {
|
||||
showDebugPanel: boolean
|
||||
statusBarHeight: number
|
||||
topInsetHeight: number
|
||||
hudPanelIndex: number
|
||||
panelTimerText: string
|
||||
panelMileageText: string
|
||||
panelDistanceValueText: string
|
||||
@@ -29,7 +30,7 @@ type MapPageData = MapEngineViewState & {
|
||||
showRightButtonGroups: boolean
|
||||
showBottomDebugButton: boolean
|
||||
}
|
||||
const INTERNAL_BUILD_VERSION = 'map-build-134'
|
||||
const INTERNAL_BUILD_VERSION = 'map-build-157'
|
||||
const REMOTE_GAME_CONFIG_URL = 'https://oss-mbh5.colormaprun.com/wxmini/test/game.json'
|
||||
let mapEngine: MapEngine | null = null
|
||||
function buildSideButtonVisibility(mode: SideButtonMode) {
|
||||
@@ -94,12 +95,28 @@ Page({
|
||||
showDebugPanel: false,
|
||||
statusBarHeight: 0,
|
||||
topInsetHeight: 12,
|
||||
hudPanelIndex: 0,
|
||||
panelTimerText: '00:00:00',
|
||||
panelMileageText: '0m',
|
||||
panelDistanceValueText: '108',
|
||||
panelDistanceValueText: '--',
|
||||
panelDistanceUnitText: '',
|
||||
panelProgressText: '0/0',
|
||||
gameSessionStatus: 'idle',
|
||||
panelSpeedValueText: '0',
|
||||
panelTelemetryTone: 'blue',
|
||||
panelHeartRateZoneNameText: '--',
|
||||
panelHeartRateZoneRangeText: '',
|
||||
heartRateConnected: false,
|
||||
heartRateStatusText: '心率带未连接',
|
||||
heartRateDeviceText: '--',
|
||||
panelHeartRateValueText: '--',
|
||||
panelHeartRateUnitText: '',
|
||||
panelCaloriesValueText: '0',
|
||||
panelCaloriesUnitText: 'kcal',
|
||||
panelAverageSpeedValueText: '0',
|
||||
panelAverageSpeedUnitText: 'km/h',
|
||||
panelAccuracyValueText: '--',
|
||||
panelAccuracyUnitText: '',
|
||||
punchButtonText: '打点',
|
||||
punchButtonEnabled: false,
|
||||
punchHintText: '等待进入检查点范围',
|
||||
@@ -140,12 +157,28 @@ Page({
|
||||
showDebugPanel: false,
|
||||
statusBarHeight,
|
||||
topInsetHeight: Math.max(statusBarHeight + 12, menuButtonBottom + 20),
|
||||
hudPanelIndex: 0,
|
||||
panelTimerText: '00:00:00',
|
||||
panelMileageText: '0m',
|
||||
panelDistanceValueText: '108',
|
||||
panelDistanceValueText: '--',
|
||||
panelDistanceUnitText: '',
|
||||
panelProgressText: '0/0',
|
||||
gameSessionStatus: 'idle',
|
||||
panelSpeedValueText: '0',
|
||||
panelTelemetryTone: 'blue',
|
||||
panelHeartRateZoneNameText: '--',
|
||||
panelHeartRateZoneRangeText: '',
|
||||
heartRateConnected: false,
|
||||
heartRateStatusText: '心率带未连接',
|
||||
heartRateDeviceText: '--',
|
||||
panelHeartRateValueText: '--',
|
||||
panelHeartRateUnitText: '',
|
||||
panelCaloriesValueText: '0',
|
||||
panelCaloriesUnitText: 'kcal',
|
||||
panelAverageSpeedValueText: '0',
|
||||
panelAverageSpeedUnitText: 'km/h',
|
||||
panelAccuracyValueText: '--',
|
||||
panelAccuracyUnitText: '',
|
||||
punchButtonText: '打点',
|
||||
punchButtonEnabled: false,
|
||||
punchHintText: '等待进入检查点范围',
|
||||
@@ -201,10 +234,10 @@ Page({
|
||||
return
|
||||
}
|
||||
|
||||
const errorMessage = error && error.message ? error.message : '鏈煡閿欒'
|
||||
const errorMessage = error && error.message ? error.message : '未知错误'
|
||||
this.setData({
|
||||
configStatusText: `杞藉叆澶辫触: ${errorMessage}`,
|
||||
statusText: `杩滅▼鍦板浘閰嶇疆杞藉叆澶辫触: ${errorMessage} (${INTERNAL_BUILD_VERSION})`,
|
||||
configStatusText: `载入失败: ${errorMessage}`,
|
||||
statusText: `远程地图配置载入失败: ${errorMessage} (${INTERNAL_BUILD_VERSION})`,
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -235,7 +268,7 @@ Page({
|
||||
const labelCanvasRef = canvasRes[1] as any
|
||||
if (!canvasRef || !canvasRef.node) {
|
||||
page.setData({
|
||||
statusText: `WebGL 寮曟搸鍒濆鍖栧け璐?(${INTERNAL_BUILD_VERSION})`,
|
||||
statusText: `WebGL 引擎初始化失败 (${INTERNAL_BUILD_VERSION})`,
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -343,6 +376,60 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
handleConnectHeartRate() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleConnectHeartRate()
|
||||
}
|
||||
},
|
||||
|
||||
handleDisconnectHeartRate() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleDisconnectHeartRate()
|
||||
}
|
||||
},
|
||||
|
||||
handleDebugHeartRateBlue() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleDebugHeartRateTone('blue')
|
||||
}
|
||||
},
|
||||
|
||||
handleDebugHeartRatePurple() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleDebugHeartRateTone('purple')
|
||||
}
|
||||
},
|
||||
|
||||
handleDebugHeartRateGreen() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleDebugHeartRateTone('green')
|
||||
}
|
||||
},
|
||||
|
||||
handleDebugHeartRateYellow() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleDebugHeartRateTone('yellow')
|
||||
}
|
||||
},
|
||||
|
||||
handleDebugHeartRateOrange() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleDebugHeartRateTone('orange')
|
||||
}
|
||||
},
|
||||
|
||||
handleDebugHeartRateRed() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleDebugHeartRateTone('red')
|
||||
}
|
||||
},
|
||||
|
||||
handleClearDebugHeartRate() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleClearDebugHeartRate()
|
||||
}
|
||||
},
|
||||
|
||||
handleToggleOsmReference() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleToggleOsmReference()
|
||||
@@ -373,6 +460,12 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
handleHudPanelChange(event: WechatMiniprogram.CustomEvent<{ current: number }>) {
|
||||
this.setData({
|
||||
hudPanelIndex: event.detail.current || 0,
|
||||
})
|
||||
},
|
||||
|
||||
handleCycleSideButtons() {
|
||||
this.setData(buildSideButtonVisibility(getNextSideButtonMode(this.data.sideButtonMode)))
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user