feat: 添加了浏览器通知和页面内通知

暂包含建造完成和科研完成
This commit is contained in:
StarsEnd
2025-12-18 01:34:29 +08:00
parent 2e3ac1231f
commit e8590d54c7
10 changed files with 327 additions and 11 deletions

View File

@@ -98,7 +98,8 @@ export const completeResearchQueue = (
researchQueue: BuildQueueItem[],
technologies: Partial<Record<TechnologyType, number>>,
now: number,
onPointsEarned?: (points: number, type: 'technology', itemType: string, level: number) => void
onPointsEarned?: (points: number, type: 'technology', itemType: string, level: number) => void,
onCompleted?: (type: 'technology', itemType: string, level: number) => void
): BuildQueueItem[] => {
return researchQueue.filter(item => {
if (now >= item.endTime) {
@@ -112,6 +113,12 @@ export const completeResearchQueue = (
const points = pointsLogic.calculateTechnologyPoints(item.itemType as TechnologyType, oldLevel, newLevel)
onPointsEarned(points, 'technology', item.itemType, newLevel)
}
// 通知完成
if (onCompleted) {
onCompleted('technology', item.itemType, newLevel)
}
return false
}
return true