feat: 更新光标组件和场景交互

- 在 Cursor 组件中添加禁用状态,增强用户交互体验。
- 更新多个场景以使用新的光标控制逻辑,确保光标的启用状态与展品访问状态相匹配。
- 在信件组件中添加输入校验功能,提升用户填写体验。
- 调整文本内容和引导对话,确保信息准确性和一致性。
This commit is contained in:
zhongyidian committed 2026-01-14 18:40:52 +08:00
1 parent a6570efa19
commit d7ff7d3a45
25 files changed
+769 -158

No files matched your search

+15 -1
View File
@@ -9,10 +9,11 @@ import {
} from "@/components";
import { useNavigate, useParams } from "react-router-dom";
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
import { useState } from "react";
import { useState, useMemo } from "react";
import Cursor from "@/components/cursor";
import { usePuzzleAnimation } from "@/contexts/PuzzleAnimationContext";
import { useChenyunStore } from "@/store/chenyunStore";
import { useCursorController } from "@/hooks/useCursorController";
// starName 固定为 chenyun
const starName = "chenyun";
@@ -53,6 +54,16 @@ const ChenyunPlace1 = () => {
const visitedExhibits = getVisitedExhibits(place);
const visited = new Set(visitedExhibits);
// Cursor 控制器:使用依赖映射实现自动解锁
// cursor 1 初始启用,cursor 2 依赖展品1(当展品1被访问后自动解锁)
const { isEnabled } = useCursorController({
initialEnabled: [1],
dependencies: {
2: [1], // cursor 2 依赖展品 1,当展品1被访问后自动解锁
},
visited, // 传入数组,而不是 Set
});
const handleOpenExhibit = (index: 1 | 2) => {
setActiveExhibitId(index);
// ExhibitOverlay 打开时会自动通过 onOpen 通知 ResidenceLayout 执行动画
@@ -104,12 +115,14 @@ const ChenyunPlace1 = () => {
className="absolute left-145 top-100"
onClick={() => handleOpenExhibit(1)}
read={visited.has(1)}
disabled={!isEnabled(1)}
/>
{/* 展品2 */}
<Cursor
className="absolute left-198 top-100"
onClick={() => handleOpenExhibit(2)}
read={visited.has(2)}
disabled={!isEnabled(2)}
/>
{/* 展品3 */}
{/* <Cursor
@@ -150,6 +163,7 @@ const ChenyunPlace1 = () => {
onClose={() => {
if (activeExhibitId !== null) {
markExhibitVisited(place, activeExhibitId);
// cursor 状态会根据 visited 自动更新,无需手动调用 enable
}
setActiveExhibitId(null);
}}