feat(game): 添加奖池功能支持

- 在国际化文件中添加奖池相关的翻译配置
- 定义 JackpotPoolState 和 GameJackpotPoolDto 类型接口
- 在 DashboardState 中添加 jackpotPool 字段
- 实现 normalizeJackpotPoolState 函数处理奖池数据转换
- 更新游戏 API 中的初始化和数据归一化逻辑
- 添加 Oxanium 字体依赖并配置奖池金额字体样式
- 实现 JackpotPoolTicker 组件显示动态增长的奖池金额
- 在消息广播组件中集成奖池显示功能
- 更新实时同步钩子中的奖池数据处理逻辑
This commit is contained in:
JiaJun
2026-07-15 15:09:42 +08:00
parent 2c1a69dd9a
commit fe3b839297
14 changed files with 286 additions and 55 deletions

View File

@@ -30,6 +30,7 @@ import type {
GameBootstrapSnapshot,
GameCell,
GameCellDto,
GameJackpotPoolDto,
GameLobbyInitDto,
GameLobbyInitResult,
GameLobbyPeriodDto,
@@ -40,6 +41,7 @@ import type {
GameRoundFeedDto,
HistoryEntry,
HistoryEntryDto,
JackpotPoolState,
NoticeConfirmDto,
NoticeDetailDto,
NoticeListDto,
@@ -164,10 +166,33 @@ function normalizeAnnouncementState(dto: AnnouncementStateDto) {
} satisfies AnnouncementState
}
function normalizeJackpotPoolState(
dto: GameJackpotPoolDto | null | undefined,
updatedAt: string | null,
) {
if (!dto) {
return null
}
const current = Number(dto.current)
const speed = Number(dto.speed)
if (!Number.isFinite(current) || !Number.isFinite(speed)) {
return null
}
return {
current,
speedPerSecond: Math.max(0, speed),
updatedAt,
} satisfies JackpotPoolState
}
function normalizeDashboardState(dto: DashboardStateDto) {
return {
countdownMs: dto.countdown_ms,
featuredCellId: dto.featured_cell_id,
jackpotPool: normalizeJackpotPoolState(dto.jackpot_pool, dto.updated_at),
onlinePlayers: dto.online_players,
tableLimitMax: dto.table_limit_max,
tableLimitMin: dto.table_limit_min,
@@ -334,6 +359,7 @@ export function normalizeGameLobbyInit(dto: GameLobbyInitDto) {
dashboard: {
countdownMs: 0,
featuredCellId: null,
jackpotPool: normalizeJackpotPoolState(dto.jackpot_pool, baseIso),
onlinePlayers: 0,
tableLimitMax: Number(dto.bet_config.max_bet_per_number) || 0,
tableLimitMin: Number(dto.bet_config.min_bet_per_number) || 0,