阶段六开发进度

This commit is contained in:
tianmo committed 2026-08-29 01:31:08 +08:00
1 parent f27167621c
commit b98d67fdab
5 files changed
+309 -66

No files matched your search

+10 -4
View File
@@ -127,7 +127,7 @@ export const useParticleStore = defineStore('particle', {
const id = colliderSeq++
const collider: CollisionBody = {
id,
name: `碰撞体 ${id}`,
name: `Collider${id}`,
tags: ['Default'],
selectedTag: 'Default',
shape: 'circle',
@@ -155,7 +155,7 @@ export const useParticleStore = defineStore('particle', {
const id = pathSeq++
const path: ScenePath = {
id,
name: `路径 ${id}`,
name: `Path${id}`,
enabled: true,
x: 0,
y: 0,
@@ -202,14 +202,20 @@ export const useParticleStore = defineStore('particle', {
this.timeline.frame = Math.max(0, Math.min(f, this.timeline.totalFrames - 1))
},
/** 依据所有粒子系统的"最晚消失时间"重算总帧数。
* 单系统总时长 = delay(延迟) + duration(发射时长) + lifeMax(粒子最大生命),
* 固定生命周期使用 lifeMin;随机生命周期使用上下限中的较大值。
* 单系统总时长 = delay(延迟) + duration(发射时长) + 最大粒子生命,
* 多系统取最大;转帧 = ceil(sec * fps)。 */
recalcTotalFrames() {
const fps = this.timeline.fps || 60
let maxSec = 0
for (const sys of this.systems) {
const c = sys.config
const end = (c.delay || 0) + (c.duration || 0) + (c.lifeMax || 0)
const lifeMin = Math.max(0, Number(c.lifeMin) || 0)
const lifeMax = Math.max(0, Number(c.lifeMax) || 0)
const particleLife = c.lifeMode === 'fixed'
? lifeMin
: Math.max(lifeMin, lifeMax)
const end = Math.max(0, Number(c.delay) || 0) + Math.max(0, Number(c.duration) || 0) + particleLife
if (end > maxSec) maxSec = end
}
const frames = Math.max(1, Math.ceil(maxSec * fps))