mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
fix: 同步 gameSpeed 倍率展示并修复移动端资源栏遮挡
- 顶部资源栏/概览页:产量、能耗、明细按 gameSpeed 统一缩放,避免显示与实际产出不一致 - 支持 gameSpeed=0:避免 “|| 1” 抹掉 0,并在循环间隔计算中规避除 0 - 修复移动端资源横向滚动时被菜单按钮遮挡(min-w-0/overflow-hidden + 对齐规则)
This commit is contained in:
@@ -8,6 +8,7 @@ import type { Planet, Resources, Officer, BuildingConfig, TechnologyConfig } fro
|
||||
import { OfficerType } from '@/types/game'
|
||||
import * as officerLogic from '@/logic/officerLogic'
|
||||
import * as resourceLogic from '@/logic/resourceLogic'
|
||||
import { scaleResources } from '@/utils/speed'
|
||||
|
||||
/**
|
||||
* 获取特定等级的升级条件
|
||||
@@ -93,11 +94,12 @@ export const checkRequirements = (
|
||||
* @param officers 玩家的军官对象
|
||||
* @returns 每小时各类资源的产量
|
||||
*/
|
||||
export const getResourceProduction = (planet: Planet, officers: Record<OfficerType, Officer>): Resources => {
|
||||
export const getResourceProduction = (planet: Planet, officers: Record<OfficerType, Officer>, resourceSpeed: number = 1): Resources => {
|
||||
// 计算当前激活的军官加成
|
||||
const bonuses = officerLogic.calculateActiveBonuses(officers, Date.now())
|
||||
// 根据建筑等级和军官加成计算资源产量
|
||||
return resourceLogic.calculateResourceProduction(planet, bonuses)
|
||||
const base = resourceLogic.calculateResourceProduction(planet, bonuses)
|
||||
return scaleResources(base, resourceSpeed)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user