fix(particle): 修复粒子系统在浏览器预览中的资产加载和渲染 (#290)

* fix(editor): 修复粒子实体创建和优化检视器

- 添加 effects 分类到右键菜单,修复粒子实体无法创建的问题
- 添加粒子效果的本地化标签
- 简化粒子组件检视器,优先显示资产文件选择
- 高级属性只在未选择资产时显示,且默认折叠
- 添加可折叠的属性分组提升用户体验

* fix(particle): 修复粒子系统在浏览器预览中的资产加载和渲染

- 添加粒子 Gizmo 支持,显示发射形状并响应 Transform 缩放/旋转
- 修复资产热重载:添加 reloadAsset() 方法和 assets:refresh 事件监听
- 修复 VectorFieldEditors 数值输入精度(step 改为 0.01)
- 修复浏览器预览中粒子资产加载失败的问题:
  - 将相对路径转换为绝对路径以正确复制资产文件
  - 使用原始 GUID 而非生成的 GUID 构建 asset catalog
  - 初始化全局 assetManager 单例的 catalog 和 loader
  - 在 GameRuntime 的 systemContext 中添加 engineIntegration
- 公开 AssetManager.initializeFromCatalog 方法供运行时使用
This commit is contained in:
YHH
2025-12-07 01:00:35 +08:00
committed by GitHub
parent 1fb702169e
commit 568b327425
22 changed files with 1628 additions and 782 deletions

View File

@@ -28,6 +28,7 @@ function getIconComponent(iconName: string | undefined, size: number = 14): Reac
const categoryIconMap: Record<string, string> = {
'rendering': 'Image',
'ui': 'LayoutGrid',
'effects': 'Sparkles',
'physics': 'Box',
'audio': 'Volume2',
'basic': 'Plus',
@@ -925,6 +926,7 @@ function ContextMenuWithSubmenu({
'ui': { zh: 'UI', en: 'UI' },
'physics': { zh: '物理', en: 'Physics' },
'audio': { zh: '音频', en: 'Audio' },
'effects': { zh: '特效', en: 'Effects' },
'other': { zh: '其他', en: 'Other' },
};
@@ -934,6 +936,7 @@ function ContextMenuWithSubmenu({
'Animated Sprite': { zh: '动画精灵', en: 'Animated Sprite' },
'创建 Tilemap': { zh: '瓦片地图', en: 'Tilemap' },
'Camera 2D': { zh: '2D 相机', en: 'Camera 2D' },
'创建粒子效果': { zh: '粒子效果', en: 'Particle Effect' },
};
const getCategoryLabel = (category: string) => {
@@ -966,7 +969,7 @@ function ContextMenuWithSubmenu({
setActiveSubmenu(category);
};
const categoryOrder = ['rendering', 'ui', 'physics', 'audio', 'basic', 'other'];
const categoryOrder = ['rendering', 'ui', 'effects', 'physics', 'audio', 'basic', 'other'];
const sortedCategories = Object.entries(templatesByCategory).sort(([a], [b]) => {
const orderA = categoryOrder.indexOf(a);
const orderB = categoryOrder.indexOf(b);