feat: 更新光标组件和场景交互
- 在 Cursor 组件中添加禁用状态,增强用户交互体验。 - 更新多个场景以使用新的光标控制逻辑,确保光标的启用状态与展品访问状态相匹配。 - 在信件组件中添加输入校验功能,提升用户填写体验。 - 调整文本内容和引导对话,确保信息准确性和一致性。
This commit is contained in:
1 parent
a6570efa19
commit
d7ff7d3a45
25 files changed
+769
-158
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
} from "@/components";
|
||||
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useCursorController } from "@/hooks/useCursorController";
|
||||
|
||||
const starName = "huangyanpei";
|
||||
|
||||
@@ -25,6 +26,11 @@ const HuangyanpeiPlace2 = () => {
|
||||
|
||||
const [activeExhibitId, setActiveExhibitId] = useState<1 | 2 | null>(null);
|
||||
const [visited, setVisited] = useState<Set<number>>(new Set());
|
||||
const { isEnabled } = useCursorController({
|
||||
initialEnabled: [1],
|
||||
dependencies: { 2: [1] },
|
||||
visited,
|
||||
});
|
||||
|
||||
// GuideSteps 当前步骤
|
||||
const [guideStep, setGuideStep] = useState(0);
|
||||
@@ -87,11 +93,13 @@ const HuangyanpeiPlace2 = () => {
|
||||
className="absolute left-132 top-132"
|
||||
onClick={() => handleOpenExhibit(1)}
|
||||
read={visited.has(1)}
|
||||
disabled={!isEnabled(1)}
|
||||
/>
|
||||
<Cursor
|
||||
className="absolute left-240 top-132"
|
||||
onClick={() => handleOpenExhibit(2)}
|
||||
read={visited.has(2)}
|
||||
disabled={!isEnabled(2)}
|
||||
/>
|
||||
|
||||
{completed && (
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
import { SuccessAlert } from "@/components/layout";
|
||||
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useCursorController } from "@/hooks/useCursorController";
|
||||
|
||||
const starName = "huangyanpei";
|
||||
|
||||
@@ -30,6 +31,11 @@ const HuangyanpeiPlace3 = () => {
|
||||
null
|
||||
);
|
||||
const [visited, setVisited] = useState<Set<number>>(new Set());
|
||||
const { isEnabled } = useCursorController({
|
||||
initialEnabled: [1],
|
||||
dependencies: { 2: [1], 3: [1, 2] },
|
||||
visited,
|
||||
});
|
||||
|
||||
// 光标3的引导对话状态
|
||||
const [guide3Visible, setGuide3Visible] = useState(false);
|
||||
@@ -121,18 +127,21 @@ const HuangyanpeiPlace3 = () => {
|
||||
className="absolute left-32 top-105"
|
||||
onClick={() => handleOpenExhibit(1)}
|
||||
read={visited.has(1)}
|
||||
disabled={!isEnabled(1)}
|
||||
/>
|
||||
{/* 光标2 */}
|
||||
<Cursor
|
||||
className="absolute left-172 top-90"
|
||||
onClick={() => handleOpenExhibit(2)}
|
||||
read={visited.has(2)}
|
||||
disabled={!isEnabled(2)}
|
||||
/>
|
||||
{/* 光标3 */}
|
||||
<Cursor
|
||||
className="absolute right-92 top-108"
|
||||
onClick={() => handleOpenExhibit(3)}
|
||||
read={visited.has(3)}
|
||||
disabled={!isEnabled(3)}
|
||||
/>
|
||||
|
||||
{completed && (
|
||||
|
||||
@@ -13,6 +13,7 @@ import { SuccessAlert } from "@/components/layout";
|
||||
import { getBackgroundImage, getStaticImage, getPublicPath } from "@/lib/utils";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import type { VideoRef } from "@/components/video";
|
||||
import { useCursorController } from "@/hooks/useCursorController";
|
||||
|
||||
const starName = "huangyanpei";
|
||||
|
||||
@@ -34,6 +35,16 @@ const HuangyanpeiPlace4 = () => {
|
||||
1 | 2 | 3 | 4 | 5 | null
|
||||
>(null);
|
||||
const [visited, setVisited] = useState<Set<number>>(new Set());
|
||||
const { isEnabled } = useCursorController({
|
||||
initialEnabled: [1],
|
||||
dependencies: {
|
||||
3: [1],
|
||||
4: [3],
|
||||
5: [4],
|
||||
// 2 已注释,不计入顺序
|
||||
},
|
||||
visited,
|
||||
});
|
||||
|
||||
// 光标1的引导对话状态
|
||||
const [guide1Visible, setGuide1Visible] = useState(false);
|
||||
@@ -125,6 +136,7 @@ const HuangyanpeiPlace4 = () => {
|
||||
onClick={() => handleOpenExhibit(1)}
|
||||
size={1}
|
||||
read={visited.has(1)}
|
||||
disabled={!isEnabled(1)}
|
||||
/>
|
||||
{/* 光标2 */}
|
||||
{/* <Cursor
|
||||
@@ -137,18 +149,21 @@ const HuangyanpeiPlace4 = () => {
|
||||
className="absolute left-125 top-100"
|
||||
onClick={() => handleOpenExhibit(3)}
|
||||
read={visited.has(3)}
|
||||
disabled={!isEnabled(3)}
|
||||
/>
|
||||
{/* 光标4 */}
|
||||
<Cursor
|
||||
className="absolute right-62 top-102"
|
||||
onClick={() => handleOpenExhibit(4)}
|
||||
read={visited.has(4)}
|
||||
disabled={!isEnabled(4)}
|
||||
/>
|
||||
{/* 光标5 */}
|
||||
<Cursor
|
||||
className="absolute right-205 top-110"
|
||||
onClick={() => handleOpenExhibit(5)}
|
||||
read={visited.has(5)}
|
||||
disabled={!isEnabled(5)}
|
||||
/>
|
||||
|
||||
{completed && (
|
||||
|
||||
@@ -13,6 +13,7 @@ import { SuccessAlert } from "@/components/layout";
|
||||
import { getBackgroundImage, getStaticImage, getPublicPath } from "@/lib/utils";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import type { VideoRef } from "@/components/video";
|
||||
import { useCursorController } from "@/hooks/useCursorController";
|
||||
|
||||
const starName = "huangyanpei";
|
||||
|
||||
@@ -42,6 +43,13 @@ const HuangyanpeiPlace5 = () => {
|
||||
// 成功提示状态
|
||||
const [showSuccessAlert, setShowSuccessAlert] = useState(false);
|
||||
|
||||
// 光标顺序:1 -> 2(需完成1后解锁2)
|
||||
const { isEnabled } = useCursorController({
|
||||
initialEnabled: [1],
|
||||
dependencies: { 2: [1] },
|
||||
visited,
|
||||
});
|
||||
|
||||
const handleOpenExhibit = (index: 1 | 2) => {
|
||||
if (index === 2) {
|
||||
// 展品2:点击时显示对话,再显示视频
|
||||
@@ -101,12 +109,14 @@ const HuangyanpeiPlace5 = () => {
|
||||
className="absolute left-35 top-108"
|
||||
onClick={() => handleOpenExhibit(1)}
|
||||
read={visited.has(1)}
|
||||
disabled={!isEnabled(1)}
|
||||
/>
|
||||
{/* 光标2 */}
|
||||
<Cursor
|
||||
className="absolute right-112 top-108"
|
||||
onClick={() => handleOpenExhibit(2)}
|
||||
read={visited.has(2)}
|
||||
disabled={!isEnabled(2)}
|
||||
/>
|
||||
|
||||
{completed && (
|
||||
|
||||
Reference in new issue
Block a user