mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
feat: 新增战报弹窗与舰队模拟器,重构UI组件
新增 BattleReportDialog、SpyReportDialog、NumberWithTooltip 等组件,完善舰队模拟器功能。重构并引入 Sheet、Sidebar、Tooltip、Skeleton 等 UI 组件,优化界面结构。实现 battle.worker 支持战斗计算,增加 universeStore、fleetStorageLogic 等核心逻辑,完善多语言与类型定义。
This commit is contained in:
@@ -22,9 +22,7 @@ export const useGameStore = defineStore('game', {
|
||||
} as Player,
|
||||
currentPlanetId: '',
|
||||
isDark: '',
|
||||
locale: 'zh-CN' as Locale,
|
||||
sidebarCollapsed: window.innerWidth < 1024 ? false : true,
|
||||
universePlanets: {} as Record<string, Planet>
|
||||
locale: 'zh-CN' as Locale
|
||||
}),
|
||||
getters: {
|
||||
currentPlanet(): Planet | undefined {
|
||||
|
||||
26
src/stores/universeStore.ts
Normal file
26
src/stores/universeStore.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import type { Planet, DebrisField } from '@/types/game'
|
||||
import pkg from '../../package.json'
|
||||
import { encryptData, decryptData } from '@/utils/crypto'
|
||||
|
||||
/**
|
||||
* 宇宙地图 Store
|
||||
* 存储宇宙中的所有星球和残骸场
|
||||
* 使用普通 localStorage 存储,不加密(地图数据是静态/共享数据)
|
||||
*/
|
||||
export const useUniverseStore = defineStore('universe', {
|
||||
state: () => ({
|
||||
// 宇宙星球地图:key 格式为 "galaxy:system:position"
|
||||
planets: {} as Record<string, Planet>,
|
||||
// 残骸场:key 格式为 "galaxy:system:position"
|
||||
debrisFields: {} as Record<string, DebrisField>
|
||||
}),
|
||||
persist: {
|
||||
key: `${pkg.name}-universe`,
|
||||
storage: localStorage,
|
||||
serializer: {
|
||||
serialize: state => encryptData(state),
|
||||
deserialize: value => decryptData(value)
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user