refactor(game): 重构缺门花色处理逻辑并优化组件结构
- 移除硬编码的花色图标导入,改用动态加载方式 - 添加新的 flowerColorMap 配置文件统一管理缺门图标 - 引入 clearActiveRoom 函数用于清理活动房间状态 - 在游戏数据解析中添加缺失花色的读取函数 - 当房间数据为空时自动清理房间状态并跳转回大厅 - 统一玩家缺门花色数据处理逻辑 - 注释掉浮动状态显示区域以优化界面布局 - 调整CSS样式中缺门标记尺寸和旋转效果 - 在游戏存储模块中添加清除快照功能 - 重构座位玩家卡片组件中的花色图标计算逻辑 - 优化花色标签映射和归一化处理函数
This commit is contained in:
@@ -3,7 +3,7 @@ import type {
|
||||
ActiveRoomState,
|
||||
ActiveRoomSelectionInput,
|
||||
} from './state'
|
||||
import { readActiveRoomSnapshot, saveActiveRoom } from './storage'
|
||||
import { clearActiveRoomSnapshot, readActiveRoomSnapshot, saveActiveRoom } from './storage'
|
||||
|
||||
const activeRoom = ref<ActiveRoomState | null>(readActiveRoomSnapshot())
|
||||
|
||||
@@ -39,6 +39,11 @@ export function setActiveRoom(input: ActiveRoomSelectionInput) {
|
||||
saveActiveRoom(next)
|
||||
}
|
||||
|
||||
export function clearActiveRoom() {
|
||||
activeRoom.value = null
|
||||
clearActiveRoomSnapshot()
|
||||
}
|
||||
|
||||
// 使用房间状态
|
||||
export function useActiveRoomState() {
|
||||
return activeRoom
|
||||
|
||||
Reference in New Issue
Block a user