资源与外观调整
This commit is contained in:
1 parent
2ad0b76d11
commit
f0f4104b0c
6 files changed
+684
-60
No files matched your search
+15
-3
@@ -63,7 +63,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { Application, Container, Graphics, Text, Texture } from 'pixi.js'
|
||||
import { ParticleEmitter } from '../core/particleEmitter'
|
||||
import { ParticleEmitter, ensureEmitterConfig } from '../core/particleEmitter'
|
||||
import { useParticleStore } from '../store/particleStore'
|
||||
|
||||
const store = useParticleStore()
|
||||
@@ -314,6 +314,12 @@ function syncEmitters() {
|
||||
for (const sys of store.systems) {
|
||||
// 新增系统若还没贴图(dotTex 已加载后),补上默认点纹理,否则无法渲染
|
||||
if (dotTex && !sys.config.texture) sys.config.texture = dotTex
|
||||
const cfg = ensureEmitterConfig(sys.config as any)
|
||||
if (dotTex) {
|
||||
for (const resource of cfg.imageResources) {
|
||||
if (!resource.texture && resource.textureName === 'star') resource.texture = dotTex
|
||||
}
|
||||
}
|
||||
if (emitterMap.has(sys.id)) continue
|
||||
const em = new ParticleEmitter(sys.config as any)
|
||||
// 发射原点 = 当前系统的位置X/位置Y(centerX/centerY),改配置实时生效
|
||||
@@ -576,7 +582,13 @@ onMounted(async () => {
|
||||
createLayers()
|
||||
await loadTexture()
|
||||
const tex = dotTex as Texture<any>
|
||||
for (const sys of store.systems) sys.config.texture = tex
|
||||
for (const sys of store.systems) {
|
||||
sys.config.texture = tex
|
||||
const cfg = ensureEmitterConfig(sys.config as any)
|
||||
for (const resource of cfg.imageResources) {
|
||||
if (!resource.texture && resource.textureName === 'star') resource.texture = tex
|
||||
}
|
||||
}
|
||||
info.value = { systems: store.systems.length, particles: 0 }
|
||||
// 默认从头播放并循环
|
||||
store.timeline.recorded = false
|
||||
@@ -594,7 +606,7 @@ onMounted(async () => {
|
||||
watch(
|
||||
() =>
|
||||
store.systems
|
||||
.map((s) => JSON.stringify(s.config, (k, v) => (k === 'texture' ? undefined : v)))
|
||||
.map((s) => JSON.stringify(s.config, (k, v) => (k === 'texture' || k === 'previewUrl' ? undefined : v)))
|
||||
.join('|'),
|
||||
() => {
|
||||
const frames = store.recalcTotalFrames()
|
||||
|
||||
Reference in new issue
Block a user