feat:碎片完善

This commit is contained in:
zhongyidian committed 2026-01-11 18:18:20 +08:00
1 parent ec7e8e2bd2
commit 046501705f
74 files changed
+1602 -172

No files matched your search

@@ -8,6 +8,9 @@ import { YinyuanClues } from "./YinyuanClues";
import { YinyuanQuizzes } from "./YinyuanQuizzes";
import { YinyuanGuides } from "./YinyuanGuides";
import { useYinyuanState } from "./useYinyuanState";
import { usePuzzleAnimation } from "@/contexts/PuzzleAnimationContext";
import { usePuzzleStore } from "@/store/puzzleStore";
import { starName } from "../constants";
import type { FileType } from "../shared/types";
import type { ClueData } from "@/components/layout";
@@ -24,8 +27,6 @@ export interface YinyuanBattleProps {
onClueClick: (clue: ClueData, clueKey: string) => void;
/** 播放视频回调 */
onPlayVideo: (fileType: FileType) => void;
/** 银元之战解决状态变化回调 */
onSolvedChange?: (solved: boolean) => void;
}
/**
@@ -39,16 +40,10 @@ export const YinyuanBattle = ({
onFileClick,
onClueClick,
onPlayVideo,
onSolvedChange,
}: YinyuanBattleProps) => {
const state = useYinyuanState();
// 当银元之战解决状态变化时,通知父组件
useEffect(() => {
if (onSolvedChange) {
onSolvedChange(state.isYinyuanSolved);
}
}, [state.isYinyuanSolved, onSolvedChange]);
const { triggerPuzzleAnimation } = usePuzzleAnimation();
const { isPuzzleUnlocked } = usePuzzleStore();
// 监听"前往解决"按钮出现的条件,显示第一个提示
useEffect(() => {
@@ -157,6 +152,12 @@ export const YinyuanBattle = ({
// 关闭聚光灯、标记银元之战为已解决、显示走势图
state.setIsYinyuanSolved(true);
state.setShowSuccessAlert(false);
// 检查碎片13是否已解锁,如果未解锁则触发动画
const pieceId = 13;
if (!isPuzzleUnlocked(starName, pieceId)) {
triggerPuzzleAnimation(pieceId);
}
};
// 处理走势图点击