feat:修改英文双引号

This commit is contained in:
kevinzhu committed 2026-04-30 09:17:31 +08:00
commit 4a2be3b4d0
1351 files changed
+56547

No files matched your search

@@ -0,0 +1,115 @@
import { getPublicPath } from '@/lib/utils'
import { PLACE_REQUIRED_COUNTS } from './lobby.config'
export const BADGE_SCENE_GROUPS = {
1: [1, 2],
2: [3, 4],
3: [5, 6],
} as const
export const BADGE_UNLOCK_VIDEO_MAP = {
1: getPublicPath('video/nieer/nieer_2_2.mp4'),
2: getPublicPath('video/nieer/nieer_2_3.mp4'),
3: getPublicPath('video/nieer/nieer_2_6.mp4'),
} as const
export const BADGE_CONFIG = [
{
id: 1,
className: 'top-0 left-36',
},
{
id: 2,
className: 'top-0 left-146',
},
{
id: 3,
className: 'top-0 right-36',
},
] as const
export const PLACE_SEQUENCE = [1, 2, 3, 4, 5, 6] as const
export type PlaceCompletionMap = Record<(typeof PLACE_SEQUENCE)[number], boolean>
export const getPlaceCompletionMap = (
visitedReflectionCursors: Record<string, Set<number>>
): PlaceCompletionMap => {
const getVisitedCount = (placeName: string): number =>
visitedReflectionCursors[placeName]?.size ?? 0
return {
1: getVisitedCount('place1') >= (PLACE_REQUIRED_COUNTS[1] ?? 0),
2: getVisitedCount('place2') >= (PLACE_REQUIRED_COUNTS[2] ?? 0),
3: getVisitedCount('place3') >= (PLACE_REQUIRED_COUNTS[3] ?? 0),
4: getVisitedCount('place4') >= (PLACE_REQUIRED_COUNTS[4] ?? 0),
5: getVisitedCount('place5') >= (PLACE_REQUIRED_COUNTS[5] ?? 0),
6: getVisitedCount('place6') >= (PLACE_REQUIRED_COUNTS[6] ?? 0),
}
}
export const getUnlockedBadgeIds = (
placeCompletion: PlaceCompletionMap
): Array<keyof typeof BADGE_SCENE_GROUPS> => {
return (
Object.entries(BADGE_SCENE_GROUPS) as unknown as Array<
[keyof typeof BADGE_SCENE_GROUPS, readonly number[]]
>
)
.filter(([, sceneIds]) =>
sceneIds.every((sceneId) => placeCompletion[sceneId as keyof PlaceCompletionMap])
)
.map(([badgeId]) => badgeId)
}
export const getBadgeUnlockedMap = (placeCompletion: PlaceCompletionMap) => ({
1: placeCompletion[1] && placeCompletion[2],
2: placeCompletion[3] && placeCompletion[4],
3: placeCompletion[5] && placeCompletion[6],
})
export const getUnlockedByIdMap = (placeCompletion: PlaceCompletionMap) =>
({
1: true,
2: placeCompletion[1],
3: placeCompletion[2],
4: placeCompletion[3],
5: placeCompletion[4],
6: placeCompletion[5],
}) as const
export const getGuideSceneId = (placeCompletion: PlaceCompletionMap) => {
const nextScene = PLACE_SEQUENCE.find((sceneId) => !placeCompletion[sceneId])
return nextScene ?? 6
}
export const getAllPlacesCompleted = (placeCompletion: PlaceCompletionMap) =>
PLACE_SEQUENCE.every((sceneId) => placeCompletion[sceneId])
export const getUnlockVideoSrcForScene = (
sceneId: number,
visitedReflectionCursors: Record<string, Set<number>>
): string | undefined => {
const previousPlaceCompletion = getPlaceCompletionMap(visitedReflectionCursors)
const previousBadges = new Set(getUnlockedBadgeIds(previousPlaceCompletion))
const nextVisitedReflectionCursors: Record<string, Set<number>> = Object.fromEntries(
Object.entries(visitedReflectionCursors).map(([placeName, cursorIds]) => [
placeName,
new Set(cursorIds),
])
)
const currentPlaceName = `place${sceneId}`
const requiredCount = PLACE_REQUIRED_COUNTS[sceneId] ?? 0
nextVisitedReflectionCursors[currentPlaceName] = new Set(
Array.from({ length: requiredCount }, (_, index) => index + 1)
)
const nextPlaceCompletion = getPlaceCompletionMap(nextVisitedReflectionCursors)
const unlockedBadgeId = getUnlockedBadgeIds(nextPlaceCompletion).find(
(badgeId) => !previousBadges.has(badgeId)
)
return unlockedBadgeId ? BADGE_UNLOCK_VIDEO_MAP[unlockedBadgeId] : undefined
}