mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 16:05:12 +08:00
refactor: 优化UI组件结构与积分系统
重构部分UI组件脚本结构,统一导入风格,提升可维护性。CardUnlockOverlay解锁条件弹窗改为列表展示,提升可读性。修复QueueNotifications滚动区域高度。ScrollableDialogContent增加最大高度。StarsBackground与ParticlesBg组件代码格式优化。App.vue引入玩家积分定时更新逻辑,NPC成长系统补充间谍探测器修复。
This commit is contained in:
@@ -331,6 +331,7 @@
|
||||
} from '@/components/ui/alert-dialog'
|
||||
import { BuildingType, TechnologyType, ShipType, DefenseType, OfficerType } from '@/types/game'
|
||||
import * as npcBehaviorLogic from '@/logic/npcBehaviorLogic'
|
||||
import * as publicLogic from '@/logic/publicLogic'
|
||||
import { Home } from 'lucide-vue-next'
|
||||
|
||||
const router = useRouter()
|
||||
@@ -340,6 +341,11 @@
|
||||
const { t } = useI18n()
|
||||
const { BUILDINGS, TECHNOLOGIES, SHIPS, DEFENSES, OFFICERS } = useGameConfig()
|
||||
|
||||
// 更新玩家积分的辅助函数
|
||||
const updatePlayerPoints = () => {
|
||||
gameStore.player.points = publicLogic.calculatePlayerPoints(gameStore.player)
|
||||
}
|
||||
|
||||
const goHome = () => {
|
||||
router.push('/')
|
||||
}
|
||||
@@ -407,22 +413,26 @@
|
||||
const setBuildingLevel = (building: BuildingType, level: number) => {
|
||||
if (selectedPlanet.value) {
|
||||
selectedPlanet.value.buildings[building] = level
|
||||
updatePlayerPoints()
|
||||
}
|
||||
}
|
||||
|
||||
const setTechnologyLevel = (tech: TechnologyType, level: number) => {
|
||||
gameStore.player.technologies[tech] = level
|
||||
updatePlayerPoints()
|
||||
}
|
||||
|
||||
const setShipCount = (ship: ShipType, count: number) => {
|
||||
if (selectedPlanet.value) {
|
||||
selectedPlanet.value.fleet[ship] = (selectedPlanet.value.fleet[ship] || 0) + count
|
||||
updatePlayerPoints()
|
||||
}
|
||||
}
|
||||
|
||||
const setDefenseCount = (defense: DefenseType, count: number) => {
|
||||
if (selectedPlanet.value) {
|
||||
selectedPlanet.value.defense[defense] = (selectedPlanet.value.defense[defense] || 0) + count
|
||||
updatePlayerPoints()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,7 +624,7 @@
|
||||
const maxAllResources = () => {
|
||||
if (!selectedPlanet.value) return
|
||||
|
||||
const maxAmount = 1000000000 // 10亿
|
||||
const maxAmount = 1000000000000000000
|
||||
selectedPlanet.value.resources.metal = maxAmount
|
||||
selectedPlanet.value.resources.crystal = maxAmount
|
||||
selectedPlanet.value.resources.deuterium = maxAmount
|
||||
@@ -708,6 +718,9 @@
|
||||
}
|
||||
})
|
||||
|
||||
// 更新玩家积分(因为建筑/科技/舰队/防御可能已改变)
|
||||
updatePlayerPoints()
|
||||
|
||||
toast.success(
|
||||
t('gmView.completeQueuesSuccess', {
|
||||
buildingCount,
|
||||
|
||||
Reference in New Issue
Block a user