From 9faad2f96350eda382ad14fa9c5c3e30ea78a5d4 Mon Sep 17 00:00:00 2001 From: lovezhangchuangxin <2911331070@qq.com> Date: Tue, 3 Dec 2024 11:09:47 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat(core,=20game):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=A7=91=E6=8A=80=E5=BB=BA=E7=AD=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/config/structure.ts | 130 +++++- packages/core/src/structure/index.ts | 2 + packages/core/src/structure/producer.ts | 3 +- packages/core/src/structure/storage.ts | 2 +- packages/core/src/structure/technology.ts | 29 ++ packages/core/src/structure/types.ts | 21 +- packages/game/components.d.ts | 2 + packages/game/src/views/planet/PlanetPage.vue | 397 ++-------------- packages/game/src/views/planet/ShowPanel.vue | 423 ++++++++++++++++++ 9 files changed, 635 insertions(+), 374 deletions(-) create mode 100644 packages/core/src/structure/technology.ts create mode 100644 packages/game/src/views/planet/ShowPanel.vue diff --git a/packages/core/src/config/structure.ts b/packages/core/src/config/structure.ts index 7f163e4..f86226f 100644 --- a/packages/core/src/config/structure.ts +++ b/packages/core/src/config/structure.ts @@ -1,7 +1,10 @@ import { StructureConfig } from '../structure/types' import { ResourceType } from './resource' -export const StructureConfigs: StructureConfig = { +/** + * 基地建筑 + */ +export const BaseStructureConfigs: StructureConfig = { solarPlant: { id: 'solarPlant', name: '太阳能电站', @@ -132,10 +135,131 @@ export const StructureConfigs: StructureConfig = { }), priority: 120, }, -} as const +} + +/** + * 科技建筑 + */ +export const TechnologyStructureConfigs: StructureConfig = { + 'spy-technology': { + id: 'spy-technology', + name: '间谍技术', + description: '间谍技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'computer-technology': { + id: 'computer-technology', + name: '计算机技术', + description: '计算机技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'weapons-technology': { + id: 'weapons-technology', + name: '武器技术', + description: '武器技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'shield-technology': { + id: 'shield-technology', + name: '护盾技术', + description: '护盾技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'armor-technology': { + id: 'armor-technology', + name: '装甲技术', + description: '装甲技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'energy-technology': { + id: 'energy-technology', + name: '能量技术', + description: '能量技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'hyperspace-technology': { + id: 'hyperspace-technology', + name: '超空间技术', + description: '超空间技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'combustion-technology': { + id: 'combustion-technology', + name: '燃烧技术', + description: '燃烧技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'laser-technology': { + id: 'laser-technology', + name: '激光技术', + description: '激光技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'ion-technology': { + id: 'ion-technology', + name: '离子技术', + description: '离子技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, + 'plasma-technology': { + id: 'plasma-technology', + name: '等离子技术', + description: '等离子技术', + type: 'technology', + getUpgradeCost: (level) => ({ + energy: Math.floor(100 * Math.pow(1.5, level)), + metal: Math.floor(200 * Math.pow(1.5, level)), + }), + }, +} + +export const StructureConfigs: StructureConfig = { + ...BaseStructureConfigs, + ...TechnologyStructureConfigs, +} // 建筑在前端的展示顺序,数字越小越靠前 -export const StructureOrder: { +export const BaseStructureOrder: { [structureId: string]: number } = { metalStorage: 1, diff --git a/packages/core/src/structure/index.ts b/packages/core/src/structure/index.ts index bbf697c..a7c9229 100644 --- a/packages/core/src/structure/index.ts +++ b/packages/core/src/structure/index.ts @@ -2,6 +2,7 @@ import { StructureConfigs } from '../config' import { StructureOperationObject } from '../utils/types' import { ProducerOperation } from './producer' import { StorageOperation } from './storage' +import { TechnologyOperation } from './technology' import { StructureType } from './types' export * from './types' @@ -11,6 +12,7 @@ export const StructureOperationMap: { } = { storage: StorageOperation, producer: ProducerOperation, + technology: TechnologyOperation, } /** diff --git a/packages/core/src/structure/producer.ts b/packages/core/src/structure/producer.ts index ac99ebf..c31efae 100644 --- a/packages/core/src/structure/producer.ts +++ b/packages/core/src/structure/producer.ts @@ -1,6 +1,5 @@ import { ResourceType } from '../config/resource' -import { isStorageFull } from '../utils' -import { StructureOperationObject } from '../utils/types' +import { isStorageFull, StructureOperationObject } from '../utils' import { StructureBaseOperation } from './base' import { ProducerConfig, ProducerData } from './types' diff --git a/packages/core/src/structure/storage.ts b/packages/core/src/structure/storage.ts index 7d76b41..fcaaec0 100644 --- a/packages/core/src/structure/storage.ts +++ b/packages/core/src/structure/storage.ts @@ -1,4 +1,4 @@ -import { StructureOperationObject } from '../utils/types' +import { StructureOperationObject } from '../utils' import { StructureBaseOperation } from './base' import { StorageConfig } from './types' diff --git a/packages/core/src/structure/technology.ts b/packages/core/src/structure/technology.ts new file mode 100644 index 0000000..72c4a34 --- /dev/null +++ b/packages/core/src/structure/technology.ts @@ -0,0 +1,29 @@ +import { StructureOperationObject } from '../utils' +import { StructureBaseOperation } from './base' + +/** + * 科技类型建筑操作 + */ +export const TechnologyOperation: StructureOperationObject = { + /** + * 初始化 + */ + _init(_, data, structureConfigs, planetData) { + if (!StructureBaseOperation._init(_, data, structureConfigs, planetData)) { + return false + } + return true + }, + + /** + * 升级 + */ + upgrade(_, data, structureConfigs, planetData) { + if ( + !StructureBaseOperation.upgrade(_, data, structureConfigs, planetData) + ) { + return false + } + return true + }, +} diff --git a/packages/core/src/structure/types.ts b/packages/core/src/structure/types.ts index 25a54bd..20d90b3 100644 --- a/packages/core/src/structure/types.ts +++ b/packages/core/src/structure/types.ts @@ -82,10 +82,20 @@ export interface ProducerConfig extends StructureBaseConfig { getConsumeSpeed?: (level: number) => Partial> } +/** + * 科技类型建筑配置 + */ +export interface TechnologyConfig extends StructureBaseConfig { + type: 'technology' +} + /** * 所有类型的建筑配置 */ -export type AllStructureConfig = StorageConfig | ProducerConfig +export type AllStructureConfig = + | StorageConfig + | ProducerConfig + | TechnologyConfig /** * 建筑类型 @@ -118,7 +128,7 @@ export interface StructureData { /** * 上次更新的时间 */ - lastUpdateTime: number + lastUpdateTime?: number } /** @@ -140,7 +150,12 @@ export interface ProducerData extends StructureData { consumeSpeed: Partial> } +/** + * 科技类型建筑数据 + */ +export interface TechnologyData extends StructureData {} + /** * 所有类型的建筑数据 */ -export type AllStructureData = StorageData | ProducerData +export type AllStructureData = StorageData | ProducerData | TechnologyData diff --git a/packages/game/components.d.ts b/packages/game/components.d.ts index cc47ccb..4b75018 100644 --- a/packages/game/components.d.ts +++ b/packages/game/components.d.ts @@ -24,6 +24,8 @@ declare module 'vue' { ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] + ElTabPane: typeof import('element-plus/es')['ElTabPane'] + ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] ElText: typeof import('element-plus/es')['ElText'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] diff --git a/packages/game/src/views/planet/PlanetPage.vue b/packages/game/src/views/planet/PlanetPage.vue index 3f61448..985e40b 100644 --- a/packages/game/src/views/planet/PlanetPage.vue +++ b/packages/game/src/views/planet/PlanetPage.vue @@ -1,225 +1,36 @@ - diff --git a/packages/game/src/views/planet/ShowPanel.vue b/packages/game/src/views/planet/ShowPanel.vue new file mode 100644 index 0000000..2216e15 --- /dev/null +++ b/packages/game/src/views/planet/ShowPanel.vue @@ -0,0 +1,423 @@ + + + + + + From b600a703fd7048450baeb71d82ceefb61cb11c68 Mon Sep 17 00:00:00 2001 From: lovezhangchuangxin <2911331070@qq.com> Date: Tue, 3 Dec 2024 17:37:36 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat(core,=20game,=20backend):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=98=B2=E5=BE=A1=E8=AE=BE=E6=96=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/src/service/structure/index.ts | 13 +- .../src/socket/event/structure/index.ts | 10 +- packages/core/src/config/combat.ts | 38 +++++ packages/core/src/config/structure.ts | 139 +++++++++++++++++- packages/core/src/processor/processor.ts | 9 +- packages/core/src/structure/defense.ts | 58 ++++++++ packages/core/src/structure/index.ts | 2 + packages/core/src/structure/types.ts | 39 ++++- packages/core/src/utils/types.ts | 11 ++ packages/game/components.d.ts | 1 + packages/game/src/views/planet/PlanetPage.vue | 16 +- packages/game/src/views/planet/ShowPanel.vue | 60 +++++++- 12 files changed, 358 insertions(+), 38 deletions(-) create mode 100644 packages/core/src/config/combat.ts create mode 100644 packages/core/src/structure/defense.ts diff --git a/packages/backend/src/service/structure/index.ts b/packages/backend/src/service/structure/index.ts index e10619b..dcb8f9a 100644 --- a/packages/backend/src/service/structure/index.ts +++ b/packages/backend/src/service/structure/index.ts @@ -1,19 +1,14 @@ -import { processor } from '../../../../core/src' +import { processor, StructureOperationParams } from '@star-angry/core' +import { GameDB } from '@star-angry/db' import { ErrorCode } from '../../error/ErrorCode' import { GameError } from '../../error/GameError' -import { GameDB } from '@star-angry/db' export default class StructureService { /** * 添加操作 */ - static async addOperation(params: { - userId: string - planetId: string - structureId: string - operation: string - }) { - const { userId, planetId, structureId, operation } = params + static async addOperation(params: StructureOperationParams) { + const { userId } = params const data = await GameDB.getDB().getData() const userDataMap = data.userDataMap const userData = userDataMap[userId] diff --git a/packages/backend/src/socket/event/structure/index.ts b/packages/backend/src/socket/event/structure/index.ts index bfc7d40..2a7d12a 100644 --- a/packages/backend/src/socket/event/structure/index.ts +++ b/packages/backend/src/socket/event/structure/index.ts @@ -1,4 +1,5 @@ import { Server, Socket } from 'socket.io' +import { StructureOperationParams } from '@star-angry/core' import { Result } from '../../../utils/result' import { ErrorCode } from '../../../error/ErrorCode' import StructureService from '../../../service/structure' @@ -9,14 +10,7 @@ export const structureEventHandler = (socket: Socket, io: Server) => { // 添加操作 socket.on( 'addOperation', - async ( - params: { - planetId: string - structureId: string - operation: string - }, - callback, - ) => { + async (params: Omit, callback) => { const userId = socket.userId if (!userId) { return callback(Result.error(ErrorCode.PARAM_ERROR)) diff --git a/packages/core/src/config/combat.ts b/packages/core/src/config/combat.ts new file mode 100644 index 0000000..e1deeee --- /dev/null +++ b/packages/core/src/config/combat.ts @@ -0,0 +1,38 @@ +/** + * 攻击种类 + */ +export enum AttackType { + /** + * 炮弹攻击 + */ + Ballistic, + /** + * 导弹攻击 + */ + Missile, + /** + * 激光攻击 + */ + Laser, + /** + * 离子攻击 + */ + Ion, + /** + * 等离子攻击 + */ + Plasma, +} + +/** + * 攻击名称 + */ +export const AttackTypeName: { + [key in AttackType]: string +} = { + [AttackType.Ballistic]: '炮弹攻击', + [AttackType.Missile]: '导弹攻击', + [AttackType.Laser]: '激光攻击', + [AttackType.Ion]: '离子攻击', + [AttackType.Plasma]: '等离子攻击', +} diff --git a/packages/core/src/config/structure.ts b/packages/core/src/config/structure.ts index f86226f..eb0a2d4 100644 --- a/packages/core/src/config/structure.ts +++ b/packages/core/src/config/structure.ts @@ -1,4 +1,5 @@ import { StructureConfig } from '../structure/types' +import { AttackType } from './combat' import { ResourceType } from './resource' /** @@ -253,12 +254,148 @@ export const TechnologyStructureConfigs: StructureConfig = { }, } +/** + * 防御建筑 + */ +export const DefenseStructureConfigs: StructureConfig = { + 'standard-tower': { + id: 'standard-tower', + name: '普通炮塔', + description: '普通炮塔', + type: 'defense', + getUpgradeCost: () => ({ + energy: 15000, + metal: 5000, + }), + health: 1000, + shield: 500, + attack: { + [AttackType.Ballistic]: 100, + }, + }, + 'heavy-tower': { + id: 'heavy-tower', + name: '重型炮塔', + description: '重型炮塔', + type: 'defense', + getUpgradeCost: () => ({ + energy: 100000, + metal: 50000, + }), + health: 3000, + shield: 2000, + attack: { + [AttackType.Ballistic]: 1000, + }, + }, + 'missile-launcher': { + id: 'missile-launcher', + name: '导弹发射器', + description: '导弹发射器', + type: 'defense', + getUpgradeCost: () => ({ + energy: 300000, + metal: 200000, + }), + health: 10000, + shield: 10000, + attack: { + [AttackType.Missile]: 5000, + }, + }, + 'ion-cannon': { + id: 'ion-cannon', + name: '离子炮', + description: '离子炮', + type: 'defense', + getUpgradeCost: () => ({ + energy: 50000, + metal: 100000, + }), + health: 2000, + shield: 2000, + attack: { + [AttackType.Ion]: 2000, + }, + }, + 'plasma-cannon': { + id: 'plasma-cannon', + name: '等离子炮', + description: '等离子炮', + type: 'defense', + getUpgradeCost: () => ({ + energy: 80000, + metal: 200000, + }), + health: 8000, + shield: 8000, + attack: { + [AttackType.Plasma]: 3000, + }, + }, + 'light-laser-tower': { + id: 'light-laser-tower', + name: '轻型激光塔', + description: '轻型激光塔', + type: 'defense', + getUpgradeCost: () => ({ + energy: 5000, + metal: 1000, + }), + health: 100, + shield: 50, + attack: { + [AttackType.Laser]: 10, + }, + }, + 'heavy-laser-tower': { + id: 'heavy-laser-tower', + name: '重型激光塔', + description: '重型激光塔', + type: 'defense', + getUpgradeCost: () => ({ + energy: 50000, + metal: 10000, + }), + health: 300, + shield: 200, + attack: { + [AttackType.Laser]: 400, + }, + }, + 'small-shield': { + id: 'small-shield', + name: '小型护盾', + description: '小型护盾', + type: 'defense', + getUpgradeCost: () => ({ + energy: 10000000, + metal: 5000000, + }), + health: 10000, + shield: 50000, + }, + 'large-shield': { + id: 'large-shield', + name: '大型护盾', + description: '大型护盾', + type: 'defense', + getUpgradeCost: () => ({ + energy: 100000000, + metal: 500000000, + }), + health: 100000, + shield: 500000, + }, +} + export const StructureConfigs: StructureConfig = { ...BaseStructureConfigs, ...TechnologyStructureConfigs, + ...DefenseStructureConfigs, } -// 建筑在前端的展示顺序,数字越小越靠前 +// 基地建筑在前端的展示顺序,数字越小越靠前 export const BaseStructureOrder: { [structureId: string]: number } = { diff --git a/packages/core/src/processor/processor.ts b/packages/core/src/processor/processor.ts index 24f32ff..c60ddf9 100644 --- a/packages/core/src/processor/processor.ts +++ b/packages/core/src/processor/processor.ts @@ -1,14 +1,9 @@ import { StructureConfigs } from '../config' import { getOperationHandler } from '../structure' -import { UserDataMap } from '../utils' +import { StructureOperationParams, UserDataMap } from '../utils' export const processor = ( - params: { - userId: string - planetId: string - structureId: string - operation: string - }, + params: StructureOperationParams, userDataMap: UserDataMap, ) => { const { userId, planetId, structureId, operation } = params diff --git a/packages/core/src/structure/defense.ts b/packages/core/src/structure/defense.ts new file mode 100644 index 0000000..85ad1bf --- /dev/null +++ b/packages/core/src/structure/defense.ts @@ -0,0 +1,58 @@ +import { isResourceEnough, StructureOperationObject } from '../utils' +import { StructureBaseOperation } from './base' +import { DefenseData } from './types' + +/** + * 防御设施建筑操作 + */ +export const DefenseOperation: StructureOperationObject = { + /** + * 初始化 + */ + _init(_, data, structureConfigs, planetData) { + if (!StructureBaseOperation._init(_, data, structureConfigs, planetData)) { + return false + } + return true + }, + + /** + * 建造 + */ + build(params, data, structureConfigs, planetData) { + const config = structureConfigs[data.id] + // 想要建造的数量 + const require = Math.floor(params.data?.require) + if (typeof require !== 'number' || require < 1 || !isFinite(require)) { + return false + } + + // 获取升级依赖的前置建筑 + const preStructure = config.preDepend + // 检查这些建筑的等级是否满足 + if (preStructure) { + for (const [id, level] of Object.entries(preStructure)) { + if (planetData.structures[id].level < level) { + return false + } + } + } + + // 获取建造所需资源 + const cost = config.getUpgradeCost(data.level) + Object.keys(cost).forEach((key) => { + cost[key as keyof typeof cost]! *= require + }) + + // 检查资源是否足够并扣除资源 + if (!isResourceEnough(planetData.resources, cost, true)) { + return false + } + + // 更新数量 + const defenseData = data as DefenseData + defenseData.amount = (defenseData.amount || 0) + require + + return true + }, +} diff --git a/packages/core/src/structure/index.ts b/packages/core/src/structure/index.ts index a7c9229..ab69524 100644 --- a/packages/core/src/structure/index.ts +++ b/packages/core/src/structure/index.ts @@ -1,5 +1,6 @@ import { StructureConfigs } from '../config' import { StructureOperationObject } from '../utils/types' +import { DefenseOperation } from './defense' import { ProducerOperation } from './producer' import { StorageOperation } from './storage' import { TechnologyOperation } from './technology' @@ -13,6 +14,7 @@ export const StructureOperationMap: { storage: StorageOperation, producer: ProducerOperation, technology: TechnologyOperation, + defense: DefenseOperation, } /** diff --git a/packages/core/src/structure/types.ts b/packages/core/src/structure/types.ts index 20d90b3..cc4b17c 100644 --- a/packages/core/src/structure/types.ts +++ b/packages/core/src/structure/types.ts @@ -1,3 +1,4 @@ +import { AttackType } from '../config/combat' import { ResourceType } from '../config/resource' /** @@ -89,6 +90,27 @@ export interface TechnologyConfig extends StructureBaseConfig { type: 'technology' } +/** + * 防御设施建造配置 + */ +export interface DefenseConfig extends StructureBaseConfig { + type: 'defense' + /** + * 生命值 + */ + health: number + /** + * 护盾 + */ + shield: number + /** + * 攻击力 + */ + attack?: { + [type in AttackType]?: number + } +} + /** * 所有类型的建筑配置 */ @@ -96,6 +118,7 @@ export type AllStructureConfig = | StorageConfig | ProducerConfig | TechnologyConfig + | DefenseConfig /** * 建筑类型 @@ -155,7 +178,21 @@ export interface ProducerData extends StructureData { */ export interface TechnologyData extends StructureData {} +/** + * 防御设施建筑数据 + */ +export interface DefenseData extends StructureData { + /** + * 数量 + */ + amount: number +} + /** * 所有类型的建筑数据 */ -export type AllStructureData = StorageData | ProducerData | TechnologyData +export type AllStructureData = + | StorageData + | ProducerData + | TechnologyData + | DefenseData diff --git a/packages/core/src/utils/types.ts b/packages/core/src/utils/types.ts index 7c9791a..ee1db87 100644 --- a/packages/core/src/utils/types.ts +++ b/packages/core/src/utils/types.ts @@ -114,3 +114,14 @@ export interface StructureOperationObject { export type ResourceNumberMap = { [resourceId in ResourceType]?: number } + +/** + * 建筑操作参数 + */ +export interface StructureOperationParams { + userId: string + planetId: string + structureId: string + operation: string + data?: any +} diff --git a/packages/game/components.d.ts b/packages/game/components.d.ts index 4b75018..96f43bd 100644 --- a/packages/game/components.d.ts +++ b/packages/game/components.d.ts @@ -14,6 +14,7 @@ declare module 'vue' { ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElInput: typeof import('element-plus/es')['ElInput'] + ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] ElLink: typeof import('element-plus/es')['ElLink'] ElOption: typeof import('element-plus/es')['ElOption'] ElProgress: typeof import('element-plus/es')['ElProgress'] diff --git a/packages/game/src/views/planet/PlanetPage.vue b/packages/game/src/views/planet/PlanetPage.vue index 985e40b..1a65aea 100644 --- a/packages/game/src/views/planet/PlanetPage.vue +++ b/packages/game/src/views/planet/PlanetPage.vue @@ -8,6 +8,7 @@ :add-operation="addOperation" /> + + + + + @@ -29,6 +38,7 @@ import { PlanetData, BaseStructureOrder, UserData, + StructureOperationParams, } from '@star-angry/core' import ShowPanel from './ShowPanel.vue' @@ -86,11 +96,7 @@ const getMyData = () => { // 添加操作 const addOperation = ( - params: { - planetId: string - structureId: string - operation: string - }, + params: Omit, successMsg: string, errorMsg: string, ) => { diff --git a/packages/game/src/views/planet/ShowPanel.vue b/packages/game/src/views/planet/ShowPanel.vue index 2216e15..030a7df 100644 --- a/packages/game/src/views/planet/ShowPanel.vue +++ b/packages/game/src/views/planet/ShowPanel.vue @@ -27,7 +27,11 @@ /> - lv.{{ structure.level }} + {{ + ['defense'].includes(StructureConfigs[structure.id].type) + ? `数量:${(structure as DefenseData).amount || 0}` + : `lv.${structure.level}` + }} @@ -186,7 +190,24 @@