mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-07-11 00:12:39 +08:00
feat: 添加了浏览器通知和页面内通知
暂包含建造完成和科研完成
This commit is contained in:
@@ -122,7 +122,8 @@ export const createBuildQueueItem = (buildingType: BuildingType, targetLevel: nu
|
||||
export const completeBuildQueue = (
|
||||
planet: Planet,
|
||||
now: number,
|
||||
onPointsEarned?: (points: number, type: 'building' | 'ship' | 'defense', itemType: string, level?: number, quantity?: number) => void
|
||||
onPointsEarned?: (points: number, type: 'building' | 'ship' | 'defense', itemType: string, level?: number, quantity?: number) => void,
|
||||
onCompleted?: (type: 'building' | 'ship' | 'defense' | 'demolish', itemType: string, level?: number, quantity?: number) => void
|
||||
): void => {
|
||||
planet.buildQueue = planet.buildQueue.filter(item => {
|
||||
if (now >= item.endTime) {
|
||||
@@ -137,6 +138,10 @@ export const completeBuildQueue = (
|
||||
const points = pointsLogic.calculateBuildingPoints(item.itemType as BuildingType, oldLevel, newLevel)
|
||||
onPointsEarned(points, 'building', item.itemType, newLevel)
|
||||
}
|
||||
|
||||
if (onCompleted) {
|
||||
onCompleted('building', item.itemType, newLevel)
|
||||
}
|
||||
} else if (item.type === 'ship') {
|
||||
const shipType = item.itemType as ShipType
|
||||
const quantity = item.quantity || 0
|
||||
|
||||
Reference in New Issue
Block a user