feat(ui): 添加首次游玩教程弹窗——5步引导含故事背景/部署操作/波次机制/开会激励/兵力建议,localStorage记录已读

This commit is contained in:
Cloud Bot
2026-03-24 09:33:47 +00:00
parent de17de46e1
commit dc9904b3f9
2 changed files with 438 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
'use client'
import { useEffect, useRef, useState, useCallback } from 'react'
import { TutorialModal, useTutorial } from './TutorialModal'
// ── 塔的完整元数据(用于底部面板 + Tooltip ──────────────────────────────
interface TowerInfo {
@@ -672,12 +673,13 @@ export default function GamePage() {
const [selectedTower, setSelectedTower] = useState<TowerType | null>(null)
const [gameReady, setGameReady] = useState(false)
const [waveStarted, setWaveStarted] = useState(false)
const [inMeeting, setInMeeting] = useState(false) // 开会=游戏暂停
const [inMeeting, setInMeeting] = useState(false)
const [waveBtn, setWaveBtn] = useState<{ text: string; disabled: boolean }>({
text: '▶ 召唤下一波',
disabled: false,
})
const selectedTowerRef = useRef<TowerType | null>(null)
const { show: showTutorial, dismiss: dismissTutorial } = useTutorial()
const handleMeeting = useCallback(() => {
if (!gameReady) return
@@ -985,6 +987,11 @@ export default function GamePage() {
canAfford={hc >= hoveredTower.cost}
/>
)}
{/* 首次游玩教程弹窗 */}
{showTutorial && (
<TutorialModal onClose={dismissTutorial} />
)}
</div>
)
}