feat:修改英文双引号
This commit is contained in:
commit
4a2be3b4d0
1351 files changed
+56547
No files matched your search
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* 线索状态管理 Hook
|
||||
* 管理所有线索的查看状态,并提供计算属性
|
||||
*/
|
||||
import { useState, useMemo } from 'react'
|
||||
import type { ClueStates, ClueKey } from './types'
|
||||
|
||||
/**
|
||||
* 初始化线索状态
|
||||
*/
|
||||
const initialClueStates: ClueStates = {
|
||||
'yinyuan-clue1': false,
|
||||
'yinyuan-clue2': false,
|
||||
'yinyuan-phone': false,
|
||||
'mimian-intelligence': false,
|
||||
'mimian-distribution': false,
|
||||
'mimian-dialogue': false,
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索状态管理 Hook
|
||||
* @returns 线索状态和计算属性
|
||||
*/
|
||||
export const useClueStates = () => {
|
||||
// 记录每个线索的查看状态
|
||||
const [clueStates, setClueStates] = useState<ClueStates>(initialClueStates)
|
||||
|
||||
/**
|
||||
* 判断银元之战的所有线索是否都已查看
|
||||
* 需要查看:线索1、线索2、电话
|
||||
*/
|
||||
const isYinyuanAllViewed = useMemo(() => {
|
||||
return clueStates['yinyuan-clue1'] && clueStates['yinyuan-clue2'] && clueStates['yinyuan-phone']
|
||||
}, [clueStates])
|
||||
|
||||
/**
|
||||
* 判断米棉之战的所有线索是否都已查看
|
||||
* 需要查看:投机商情报、全国物资分布、对话
|
||||
*/
|
||||
const isMimianAllViewed = useMemo(() => {
|
||||
return (
|
||||
clueStates['mimian-intelligence'] &&
|
||||
clueStates['mimian-distribution'] &&
|
||||
clueStates['mimian-dialogue']
|
||||
)
|
||||
}, [clueStates])
|
||||
|
||||
/**
|
||||
* 标记线索为已查看
|
||||
* @param clueKey 线索键名
|
||||
*/
|
||||
const markClueAsViewed = (clueKey: ClueKey) => {
|
||||
setClueStates((prev) => ({
|
||||
...prev,
|
||||
[clueKey]: true,
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新线索状态
|
||||
* @param updates 要更新的线索状态
|
||||
*/
|
||||
const updateClueStates = (updates: Partial<ClueStates>) => {
|
||||
setClueStates((prev) => ({
|
||||
...prev,
|
||||
...updates,
|
||||
}))
|
||||
}
|
||||
|
||||
return {
|
||||
clueStates,
|
||||
setClueStates,
|
||||
isYinyuanAllViewed,
|
||||
isMimianAllViewed,
|
||||
markClueAsViewed,
|
||||
updateClueStates,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user