feat(game): 添加游戏准备状态功能

- 在 SeatPlayerCard 组件中添加 isReady 属性用于显示准备状态
- 添加准备/取消准备按钮,支持玩家切换准备状态
- 实现 WebSocket 消息处理以同步玩家准备状态
- 添加 CSS 样式显示准备状态标签和准备按钮
- 优化用户 ID 解析逻辑,支持多种字段格式
- 修复座位索引计算逻辑,确保相对位置正确显示
- 添加认证会话管理功能,确保用户信息同步加载
- 实现房间玩家状态更新的消息处理机制
This commit is contained in:
2026-03-26 17:18:29 +08:00
parent 603f910e8b
commit 0fa3c4f1df
6 changed files with 292 additions and 9 deletions

View File

@@ -429,6 +429,22 @@
color: #eef5ff;
}
.picture-scene .player-meta .ready-chip {
display: inline-flex;
align-items: center;
justify-content: center;
margin-top: 4px;
padding: 1px 8px;
border-radius: 999px;
color: #f7f2dd;
font-size: 10px;
font-weight: 700;
background: linear-gradient(180deg, rgba(214, 173, 58, 0.82), rgba(125, 91, 20, 0.92));
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.22),
0 2px 6px rgba(0, 0, 0, 0.2);
}
.picture-scene .player-badge.seat-right .player-meta,
.picture-scene .player-badge.seat-left .player-meta {
display: flex;
@@ -575,6 +591,57 @@
pointer-events: none;
}
.ready-toggle {
position: absolute;
right: 120px;
bottom: 70px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
min-width: 138px;
height: 44px;
padding: 0 16px 0 14px;
border: 1px solid rgba(220, 191, 118, 0.24);
border-radius: 999px;
background:
linear-gradient(180deg, rgba(14, 55, 40, 0.92), rgba(8, 36, 27, 0.96)),
radial-gradient(circle at 20% 24%, rgba(237, 214, 157, 0.08), transparent 34%);
box-shadow:
inset 0 1px 0 rgba(255, 244, 214, 0.1),
inset 0 -1px 0 rgba(0, 0, 0, 0.22),
0 8px 18px rgba(0, 0, 0, 0.2);
z-index: 4;
animation: ready-toggle-pop 180ms ease-out;
}
.ready-toggle-label {
color: #e5c472;
font-size: 14px;
font-weight: 800;
letter-spacing: 0.5px;
text-shadow:
-1px 0 rgba(0, 0, 0, 0.38),
0 1px rgba(0, 0, 0, 0.38),
1px 0 rgba(0, 0, 0, 0.38),
0 -1px rgba(0, 0, 0, 0.38);
}
.ready-toggle:active {
transform: translateY(1px) scale(0.96);
}
@keyframes ready-toggle-pop {
from {
opacity: 0;
transform: translateY(10px) scale(0.94);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
.center-desk {
position: absolute;
left: 50%;