Feat: Add splash layer (#29)

Add splash layer, support game start, settings, exit
Modify settings layer, add "go back to splash" and "exit"
Add character threshold for history input
Closes #28
This commit is contained in:
4thfever
2026-01-13 22:00:23 +08:00
committed by GitHub
parent 224e3e76f0
commit 0d34b27fff
9 changed files with 460 additions and 9 deletions

View File

@@ -56,8 +56,18 @@ export function useGameInit(options: UseGameInitOptions = {}) {
if (!res) return
// Idle check
if (res.status === 'idle' && prevStatus !== 'idle') {
options.onIdle?.()
if (res.status === 'idle') {
if (prevStatus !== 'idle') {
options.onIdle?.()
}
// 如果后端是 idle确保前端状态也是重置的
if (isInitialized.value) {
systemStore.setInitialized(false)
worldStore.reset()
}
// 重置预加载标记
mapPreloaded.value = false
avatarsPreloaded.value = false
}
// 提前加载地图
@@ -75,7 +85,8 @@ export function useGameInit(options: UseGameInitOptions = {}) {
// 状态跃迁:非 Ready -> Ready
if (prevStatus !== 'ready' && res.status === 'ready') {
await initializeGame()
stopPolling()
// 不要停止轮询,否则 reset 之后无法检测到状态变化
// stopPolling()
}
} catch (e) {
console.error('Failed to fetch init status:', e)