完善多赛道联调与全局产品架构

This commit is contained in:
2026-04-02 18:11:43 +08:00
parent 6964e26ec9
commit 0e28f70bad
45 changed files with 4819 additions and 282 deletions

View File

@@ -22,9 +22,17 @@ export interface BusinessLaunchContext {
realtimeToken?: string | null
}
export interface GameVariantLaunchContext {
variantId?: string | null
variantName?: string | null
routeCode?: string | null
assignmentMode?: string | null
}
export interface GameLaunchEnvelope {
config: GameConfigLaunchRequest
business: BusinessLaunchContext | null
variant?: GameVariantLaunchContext | null
}
export interface MapPageLaunchOptions {
@@ -46,6 +54,9 @@ export interface MapPageLaunchOptions {
sessionTokenExpiresAt?: string
realtimeEndpoint?: string
realtimeToken?: string
variantId?: string
variantName?: string
assignmentMode?: string
}
type PendingGameLaunchStore = Record<string, GameLaunchEnvelope>
@@ -121,6 +132,28 @@ function buildBusinessLaunchContext(options?: MapPageLaunchOptions | null): Busi
}
}
function buildVariantLaunchContext(options?: MapPageLaunchOptions | null): GameVariantLaunchContext | null {
if (!options) {
return null
}
const variantId = normalizeOptionalString(options.variantId)
const variantName = normalizeOptionalString(options.variantName)
const routeCode = normalizeOptionalString(options.routeCode)
const assignmentMode = normalizeOptionalString(options.assignmentMode)
if (!variantId && !variantName && !routeCode && !assignmentMode) {
return null
}
return {
variantId,
variantName,
routeCode,
assignmentMode,
}
}
function loadPendingGameLaunchStore(): PendingGameLaunchStore {
try {
const stored = wx.getStorageSync(PENDING_GAME_LAUNCH_STORAGE_KEY)
@@ -146,6 +179,7 @@ export function getDemoGameLaunchEnvelope(preset: DemoGamePreset = 'classic'): G
business: {
source: 'demo',
},
variant: null,
}
}
@@ -217,6 +251,7 @@ export function resolveGameLaunchEnvelope(options?: MapPageLaunchOptions | null)
routeCode: normalizeOptionalString(options ? options.routeCode : undefined),
},
business: buildBusinessLaunchContext(options),
variant: buildVariantLaunchContext(options),
}
}