feat(game): 支持玩家显示名称的多种数据源
- 在麻将游戏页面中添加本地缓存头像URL的优先级处理 - 为玩家座位信息添加自定义显示名称功能 - 支持从player_name或PlayerName字段获取玩家名称 - 实现当前用户显示名称的回退逻辑 - 更新API接口定义以支持可选的玩家名称字段
This commit is contained in:
@@ -131,6 +131,10 @@ function mapRoomPlayers(room: RoomItem): RoomPlayerState[] {
|
||||
.map((item, fallbackIndex) => ({
|
||||
index: Number.isFinite(item.index) ? item.index : fallbackIndex,
|
||||
playerId: item.player_id,
|
||||
displayName:
|
||||
(typeof item.player_name === 'string' && item.player_name) ||
|
||||
(typeof item.PlayerName === 'string' && item.PlayerName) ||
|
||||
(item.player_id === currentUserId.value ? displayName.value : undefined),
|
||||
ready: Boolean(item.ready),
|
||||
hand: [],
|
||||
melds: [],
|
||||
|
||||
Reference in New Issue
Block a user