feat(game): 添加成都麻将游戏页面和大厅功能
- 实现 ChengduGamePage.vue 组件,包含完整的麻将游戏界面 - 实现 HallPage.vue 组件,支持房间列表展示、创建和加入功能 - 添加 mahjong API 接口用于房间管理操作 - 集成 store 状态管理和本地存储功能 - 实现 ChengduBottomActions 等游戏控制组件 - 添加 websocket 连接和游戏会话管理逻辑 - 实现游戏倒计时、结算等功能模块
This commit is contained in:
@@ -5,7 +5,7 @@ import { AuthExpiredError, type AuthSession } from '../api/authed-request'
|
||||
import { createRoom, joinRoom, listRooms, type RoomItem } from '../api/mahjong'
|
||||
import { getUserInfo, type UserInfo } from '../api/user'
|
||||
import refreshIcon from '../assets/images/icons/refresh.svg'
|
||||
import { setActiveRoom } from '../store'
|
||||
import { setRoomMetaSnapshot } from '../store'
|
||||
import type { RoomPlayerState } from '../store/state'
|
||||
import type { StoredAuth } from '../types/session'
|
||||
import { clearAuth, readStoredAuth, writeStoredAuth } from '../utils/auth-storage'
|
||||
@@ -254,7 +254,7 @@ async function submitCreateRoom(): Promise<void> {
|
||||
)
|
||||
|
||||
createdRoom.value = room
|
||||
setActiveRoom({
|
||||
setRoomMetaSnapshot({
|
||||
roomId: room.room_id,
|
||||
roomName: room.name,
|
||||
gameType: room.game_type,
|
||||
@@ -301,7 +301,7 @@ async function handleJoinRoom(room?: { roomId?: string; roomName?: string }): Pr
|
||||
roomSubmitting.value = true
|
||||
try {
|
||||
const joinedRoom = await joinRoom(session, { roomId: targetRoomId }, syncAuth)
|
||||
setActiveRoom({
|
||||
setRoomMetaSnapshot({
|
||||
roomId: joinedRoom.room_id,
|
||||
roomName: joinedRoom.name,
|
||||
gameType: joinedRoom.game_type,
|
||||
@@ -355,7 +355,7 @@ async function enterCreatedRoom(): Promise<void> {
|
||||
}
|
||||
|
||||
showCreatedModal.value = false
|
||||
setActiveRoom({
|
||||
setRoomMetaSnapshot({
|
||||
roomId: createdRoom.value.room_id,
|
||||
roomName: createdRoom.value.name,
|
||||
gameType: createdRoom.value.game_type,
|
||||
|
||||
Reference in New Issue
Block a user