From 60445abd42bf8dd8549d05ac11ee1e01c79f610a Mon Sep 17 00:00:00 2001 From: Super_Z <1401203083@qq.com> Date: Tue, 23 Jun 2026 15:22:43 +0000 Subject: [PATCH] =?UTF-8?q?v0.5:=20=E6=B7=B1=E7=A9=BA=E4=BF=A1=E6=A0=87?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=20+=20=E7=BC=96=E5=B9=B4=E5=8F=B2=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=20BUG=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新功能:深空信标(Deep Space Beacon) - 每日挑战:UTC 日期种子确定性生成,5 种类型 × 3 档难度 - 本地排行榜 Top 20,奖牌图标 + 难度色点 + 今日高亮 - 进度追踪独立 localStorage,不污染 GameState - 倒计时 + 领取奖励发放到游戏状态 BUG 修复:编年史历史条目显示原始 tide 键名 - 新增 regenerateLoreFromEntry(),显示时重新生成 lore - 修复 v0.4 之前条目 lore 中 tide_ruins 等原始键名 UI:第 7 标签页「信标」+ 统计面板「信标最高分」行 版本号 v0.4 → v0.5 详见 docs/10-深空信标系统-v0.5.md --- src/app/page.tsx | 66 ++++- src/components/game/BeaconPanel.tsx | 301 ++++++++++++++++++++ src/components/game/ChronicleDialog.tsx | 5 +- src/lib/game/beacon.ts | 357 ++++++++++++++++++++++++ src/lib/game/chronicle.ts | 22 +- src/store/gameStore.ts | 58 ++++ worklog.md | 55 +++- 7 files changed, 844 insertions(+), 20 deletions(-) create mode 100644 src/components/game/BeaconPanel.tsx create mode 100644 src/lib/game/beacon.ts diff --git a/src/app/page.tsx b/src/app/page.tsx index abebfd79f..1f58a8b1d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -15,6 +15,7 @@ import { AchievementNotifier } from "@/components/game/AchievementNotifier"; import { ConstellationPanel } from "@/components/game/ConstellationPanel"; import { ConstellationDialog } from "@/components/game/ConstellationDialog"; import { ChronicleDialog } from "@/components/game/ChronicleDialog"; +import { BeaconPanel } from "@/components/game/BeaconPanel"; import { StarTideNotifier, StarTideIndicator, @@ -36,11 +37,13 @@ import { Github, Trophy, Star, + Radio, } from "lucide-react"; import { TECH_TREE, FRAGMENTS, formatNum } from "@/lib/game/config"; import { ACHIEVEMENTS } from "@/lib/game/achievements"; import { TIDE_EVENTS } from "@/lib/game/starTide"; import { CONSTELLATION_PERKS } from "@/lib/game/constellation"; +import { generateDailyChallenge, loadDailyProgress, loadLeaderboard } from "@/lib/game/beacon"; export default function Page() { useGameLoop(); @@ -67,6 +70,29 @@ export default function Page() { const hasActiveExpedition = useGameStore((s) => !!s.activeExpedition && !s.activeExpedition.finished); const chronicleCount = useGameStore((s) => s.chronicle?.length ?? 0); + // 深空信标:检测是否有可领取的奖励(独立 localStorage) + const [beaconClaimable, setBeaconClaimable] = useState(false); + useEffect(() => { + let cancelled = false; + const check = () => { + try { + const c = generateDailyChallenge(); + const p = loadDailyProgress(); + if (!cancelled) { + setBeaconClaimable(p.completedAt !== null && !p.claimed && p.dateKey === c.dateKey); + } + } catch { + if (!cancelled) setBeaconClaimable(false); + } + }; + check(); + const id = setInterval(check, 2000); + return () => { + cancelled = true; + clearInterval(id); + }; + }, []); + // 挂载检测:避免持久化 store 在 SSR/CSR 间产生 hydration 不一致 useEffect(() => { // eslint-disable-next-line react-hooks/set-state-in-effect @@ -138,7 +164,7 @@ export default function Page() {
- ECHO NEXUS · v0.4 + ECHO NEXUS · v0.5
+ {challenge.desc} +
+ + {/* 进度条 */} +