feat(game): 添加麻将牌图片映射配置并优化成都麻将页面
- 新增 tileMap.ts 配置文件,定义麻将牌图片映射逻辑 - 实现根据花色和点数获取对应图片路径的功能 - 添加麻将牌验证和基础牌生成工具函数 - 在 ChengduGamePage.vue 中导入并使用 getTileImage 函数 - 添加服务器响应日志用于调试 - 优化玩家手牌显示区域的布局结构
This commit is contained in:
@@ -37,6 +37,7 @@ import {useGameStore} from '../store/gameStore'
|
||||
import {setActiveRoom, useActiveRoomState} from '../store'
|
||||
import type {PlayerState} from '../types/state'
|
||||
import type {Tile} from '../types/tile'
|
||||
import {getTileImage} from "../config/tileMap.ts";
|
||||
|
||||
const gameStore = useGameStore()
|
||||
const activeRoom = useActiveRoomState()
|
||||
@@ -451,6 +452,7 @@ function handleRoomInfoResponse(message: unknown): void {
|
||||
const summary = asRecord(payload.summary) ?? asRecord(payload.room_summary) ?? null
|
||||
const publicState = asRecord(payload.public) ?? asRecord(payload.public_state) ?? null
|
||||
const privateState = asRecord(payload.private) ?? asRecord(payload.private_state) ?? null
|
||||
console.log("server response payload: " + payload)
|
||||
const roomId =
|
||||
readString(summary ?? {}, 'room_id', 'roomId') ||
|
||||
readString(publicState ?? {}, 'room_id', 'roomId') ||
|
||||
@@ -1455,8 +1457,8 @@ onBeforeUnmount(() => {
|
||||
<span class="ready-toggle-label">开始游戏</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="player-hand" v-if="myHandTiles.length > 0">
|
||||
|
||||
<button
|
||||
v-for="tile in myHandTiles"
|
||||
:key="tile.id"
|
||||
|
||||
Reference in New Issue
Block a user