feat: 预制体系统与架构改进 (#303)
* feat(prefab): 实现预制体系统和编辑器 UX 改进 ## 预制体系统 - 新增 PrefabSerializer: 预制体序列化/反序列化 - 新增 PrefabInstanceComponent: 追踪预制体实例来源和修改 - 新增 PrefabService: 预制体核心服务 - 新增 PrefabLoader: 预制体资产加载器 - 新增预制体命令: Create/Instantiate/Apply/Revert/BreakLink ## 预制体编辑模式 - 支持双击 .prefab 文件进入编辑模式 - 预制体编辑模式工具栏 (保存/退出) - 预制体实例指示器和操作菜单 ## 编辑器 UX 改进 - SceneHierarchy 快捷键: F2 重命名, Ctrl+D 复制, ↑↓ 导航 - 支持双击实体名称内联编辑 - 删除实体时显示子节点数量警告 - 右键菜单添加重命名/复制选项及快捷键提示 - 布局持久化和重置功能 ## Bug 修复 - 修复 editor-runtime 组件类重复导致的 TransformComponent 不识别问题 - 修复 .prefab-name 样式覆盖导致预制体工具栏文字不可见 - 修复 Inspector 资源字段高度不正确问题 * feat(editor): 改进编辑器 UX 交互体验 - ContentBrowser: 加载动画 spinner、搜索高亮、改进空状态设计 - SceneHierarchy: 选中项自动滚动到视图、搜索清除按钮 - PropertyInspector: 输入框本地状态管理、Enter/Escape 键处理 - EntityInspector: 组件折叠状态持久化、属性搜索清除按钮 - Viewport: 变换操作实时数值显示 - 国际化: 添加相关文本 (en/zh) * fix(build): 修复 Web 构建资产加载和编辑器 UX 改进 构建系统修复: - 修复 asset-catalog.json 字段名不匹配 (entries vs assets) - 修复 BrowserFileSystemService 支持两种目录格式 - 修复 bundle 策略检测逻辑 (空对象判断) - 修复 module.json 中 assetExtensions 声明和类型推断 行为树修复: - 修复 BehaviorTreeExecutionSystem 使用 loadAsset 替代 loadAssetByPath - 修复 BehaviorTreeAssetType 常量与 module.json 类型名一致 (behavior-tree) 编辑器 UX 改进: - 构建完成对话框添加"打开文件夹"按钮 - 构建完成对话框样式优化 (圆形图标背景、按钮布局) - SceneHierarchy 响应式布局 (窄窗口自动隐藏 Type 列) - SceneHierarchy 隐藏滚动条 错误追踪: - 添加全局错误处理器写入日志文件 (%TEMP%/esengine-editor-crash.log) - 添加 append_to_log Tauri 命令 * feat(render): 修复 UI 渲染和点击特效系统 ## UI 渲染修复 - 修复 GUID 验证 bug,使用统一的 isValidGUID() 函数 - 修复 UI 渲染顺序随机问题,Rust 端使用 IndexMap 替代 HashMap - Web 运行时添加 assetPathResolver 支持 GUID 解析 - UIInteractableComponent.blockEvents 默认值改为 false ## 点击特效系统 - 新增 ClickFxComponent 和 ClickFxSystem - 支持在点击位置播放粒子效果 - 支持多种触发模式和粒子轮换 ## Camera 系统重构 - CameraSystem 从 ecs-engine-bindgen 移至 camera 包 - 新增 CameraManager 统一管理相机 ## 编辑器改进 - 改进属性面板 UI 交互 - 粒子编辑器面板优化 - Transform 命令系统 * feat(render): 实现 Sorting Layer 系统和 Overlay 渲染层 - 新增 SortingLayerManager 管理排序层级 (Background, Default, Foreground, UI, Overlay) - 实现 ISortable 接口,统一 Sprite、UI、Particle 的排序属性 - 修复粒子 Overlay 层被 UI 遮挡问题:添加独立的 Overlay Pass 在 UI 之后渲染 - 更新粒子资产格式:从 sortingOrder 改为 sortingLayer + orderInLayer - 更新粒子编辑器面板支持新的排序属性 - 优化 UI 渲染系统使用新的排序层级 * feat(ci): 集成 SignPath 代码签名服务 - 添加 SignPath 自动签名工作流(Windows) - 配置 release-editor.yml 支持代码签名 - 将构建改为草稿模式,等待签名完成后发布 - 添加证书文件到 .gitignore 防止泄露 * fix(asset): 修复 Web 构建资产路径解析和全局单例移除 ## 资产路径修复 - 修复 Tauri 本地服务器 `/asset?path=...` 路径解析,正确与 root 目录连接 - BrowserPathResolver 支持两种模式: - 'proxy': 使用 /asset?path=... 格式(编辑器 Run in Browser) - 'direct': 使用直接路径 /assets/path.png(独立 Web 构建) - BrowserRuntime 使用 'direct' 模式,无需 Tauri 代理 ## 架构改进 - 移除全局单例 - 移除 globalAssetManager 导出,改用 AssetManagerToken 依赖注入 - 移除 globalPathResolver 导出,改用 PathResolutionService - 移除 globalPathResolutionService 导出 - ParticleUpdateSystem/ClickFxSystem 通过 setAssetManager() 注入依赖 - EngineService 使用 new AssetManager() 替代全局实例 ## 新增服务 - PathResolutionService: 统一路径解析接口 - RuntimeModeService: 运行时模式查询服务 - SerializationContext: EntityRef 序列化上下文 ## 其他改进 - 完善 ServiceToken 注释说明本地定义的意图 - 导出 BrowserPathResolveMode 类型 * fix(build): 添加 world-streaming composite 设置修复类型检查 * fix(build): 移除 world-streaming 引用避免 composite 冲突 * fix(build): 将 const enum 改为 enum 兼容 isolatedModules * fix(build): 添加缺失的 IAssetManager 导入
This commit is contained in:
@@ -78,6 +78,24 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.search-clear-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 2px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: #888;
|
||||
cursor: pointer;
|
||||
border-radius: 2px;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.search-clear-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.outliner-toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -120,10 +138,11 @@
|
||||
.outliner-header-icons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding-right: 8px;
|
||||
gap: 6px;
|
||||
padding-right: 6px;
|
||||
border-right: 1px solid #444;
|
||||
margin-right: 8px;
|
||||
margin-right: 6px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
@@ -157,7 +176,9 @@
|
||||
}
|
||||
|
||||
.outliner-header-type {
|
||||
width: 140px;
|
||||
width: 80px;
|
||||
min-width: 60px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
@@ -187,23 +208,16 @@
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* 隐藏滚动条但保留滚动功能 */
|
||||
/* Hide scrollbar but keep scroll functionality */
|
||||
.outliner-content::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.outliner-content::-webkit-scrollbar-track {
|
||||
background: #2a2a2a;
|
||||
}
|
||||
|
||||
.outliner-content::-webkit-scrollbar-thumb {
|
||||
background: #4a4a4a;
|
||||
border-radius: 5px;
|
||||
border: 2px solid #2a2a2a;
|
||||
}
|
||||
|
||||
.outliner-content::-webkit-scrollbar-thumb:hover {
|
||||
background: #5a5a5a;
|
||||
.outliner-content {
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
}
|
||||
|
||||
.outliner-list {
|
||||
@@ -241,20 +255,53 @@
|
||||
|
||||
.outliner-item.dragging {
|
||||
opacity: 0.5;
|
||||
background: rgba(74, 158, 255, 0.1);
|
||||
}
|
||||
|
||||
/* Drop Indicators */
|
||||
/* Drop Indicators | 拖放指示器 */
|
||||
.outliner-item.drop-before {
|
||||
border-top: 2px solid #4a9eff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.outliner-item.drop-before::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, #4a9eff 0%, #4a9eff 50%, transparent 50%);
|
||||
background-size: 8px 2px;
|
||||
border-radius: 1px;
|
||||
animation: dropIndicatorPulse 0.8s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.outliner-item.drop-after {
|
||||
border-bottom: 2px solid #4a9eff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.outliner-item.drop-after::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -1px;
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, #4a9eff 0%, #4a9eff 50%, transparent 50%);
|
||||
background-size: 8px 2px;
|
||||
border-radius: 1px;
|
||||
animation: dropIndicatorPulse 0.8s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.outliner-item.drop-inside {
|
||||
background: rgba(74, 158, 255, 0.2);
|
||||
box-shadow: inset 0 0 0 1px #4a9eff;
|
||||
background: rgba(74, 158, 255, 0.15);
|
||||
box-shadow: inset 0 0 0 2px rgba(74, 158, 255, 0.5);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
@keyframes dropIndicatorPulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.5; }
|
||||
}
|
||||
|
||||
.outliner-item.disabled {
|
||||
@@ -264,9 +311,10 @@
|
||||
.outliner-item-icons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding-right: 8px;
|
||||
gap: 6px;
|
||||
padding-right: 6px;
|
||||
margin-right: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.item-icon {
|
||||
@@ -283,6 +331,20 @@
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.item-icon.visibility:hover {
|
||||
color: #4a9eff;
|
||||
}
|
||||
|
||||
.item-icon.visibility.hidden {
|
||||
color: #555;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.item-icon.visibility.hidden:hover {
|
||||
color: #4a9eff;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.outliner-item-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
@@ -328,8 +390,29 @@
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* 内联重命名输入框 | Inline rename input */
|
||||
.outliner-item-name-input {
|
||||
flex: 1;
|
||||
min-width: 60px;
|
||||
padding: 1px 4px;
|
||||
margin: -2px 0;
|
||||
background: #1a1a1a;
|
||||
border: 1px solid #3b82f6;
|
||||
border-radius: 2px;
|
||||
color: #fff;
|
||||
font-size: inherit;
|
||||
font-family: inherit;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.outliner-item-name-input:focus {
|
||||
box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
|
||||
}
|
||||
|
||||
.outliner-item-type {
|
||||
width: 140px;
|
||||
width: 80px;
|
||||
min-width: 60px;
|
||||
flex-shrink: 0;
|
||||
color: #888;
|
||||
font-size: 11px;
|
||||
overflow: hidden;
|
||||
@@ -340,6 +423,7 @@
|
||||
/* Entity Type Icons */
|
||||
.entity-type-icon {
|
||||
flex-shrink: 0;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.entity-type-icon.world {
|
||||
@@ -546,3 +630,160 @@
|
||||
.context-menu-danger:hover {
|
||||
background: rgba(248, 113, 113, 0.15) !important;
|
||||
}
|
||||
|
||||
/* 快捷键提示 | Shortcut hints */
|
||||
.context-menu-shortcut {
|
||||
margin-left: auto;
|
||||
font-size: 10px;
|
||||
color: #666;
|
||||
font-family: var(--font-family-mono, 'Consolas', monospace);
|
||||
}
|
||||
|
||||
/* Prefab Instance Context Menu Styles | 预制体实例右键菜单样式 */
|
||||
.context-menu-section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 10px;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
color: #60a5fa;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
border-bottom: 1px solid #3b82f6;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.context-menu-section-header svg {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.context-menu-highlight {
|
||||
color: #60a5fa !important;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.context-menu-highlight:hover {
|
||||
background: rgba(59, 130, 246, 0.2) !important;
|
||||
}
|
||||
|
||||
.context-menu-warning {
|
||||
color: #fbbf24 !important;
|
||||
}
|
||||
|
||||
.context-menu-warning:hover {
|
||||
background: rgba(251, 191, 36, 0.15) !important;
|
||||
}
|
||||
|
||||
.context-menu button:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.context-menu button:disabled:hover {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* ==================== Prefab Edit Mode | 预制体编辑模式 ==================== */
|
||||
.scene-hierarchy.prefab-edit-mode {
|
||||
border-left: 3px solid #3b82f6;
|
||||
}
|
||||
|
||||
.prefab-edit-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
|
||||
border-bottom: 1px solid #3b82f6;
|
||||
color: #93c5fd;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.prefab-edit-header svg {
|
||||
color: #60a5fa;
|
||||
}
|
||||
|
||||
.outliner-item.prefab-root {
|
||||
background: rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
.outliner-item.prefab-root:hover {
|
||||
background: rgba(59, 130, 246, 0.15);
|
||||
}
|
||||
|
||||
.entity-type-icon.prefab {
|
||||
color: #60a5fa;
|
||||
}
|
||||
|
||||
/* ==================== Prefab Instance Indicator | 预制体实例指示器 ==================== */
|
||||
.outliner-item.prefab-instance {
|
||||
background: rgba(59, 130, 246, 0.05);
|
||||
border-left: 2px solid #3b82f6;
|
||||
}
|
||||
|
||||
.outliner-item.prefab-instance:hover {
|
||||
background: rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
.outliner-item.prefab-instance.selected {
|
||||
background: rgba(59, 130, 246, 0.2);
|
||||
}
|
||||
|
||||
.entity-type-icon.prefab-instance {
|
||||
color: #60a5fa;
|
||||
}
|
||||
|
||||
.prefab-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin-left: 6px;
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
||||
color: white;
|
||||
border-radius: 3px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.outliner-item.prefab-instance .outliner-item-name {
|
||||
color: #93c5fd;
|
||||
}
|
||||
|
||||
.outliner-item.prefab-instance .outliner-item-type {
|
||||
color: #60a5fa;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* ==================== Responsive Layout | 响应式布局 ==================== */
|
||||
|
||||
/* 使用 container query 在窄面板时隐藏 Type 列 */
|
||||
/* Use container query to hide Type column in narrow panels */
|
||||
.scene-hierarchy {
|
||||
container-type: inline-size;
|
||||
container-name: scene-hierarchy;
|
||||
}
|
||||
|
||||
/* 当面板宽度小于 200px 时隐藏 Type 列和图标列 */
|
||||
/* Hide Type column and icons column when panel width < 200px */
|
||||
@container scene-hierarchy (max-width: 200px) {
|
||||
.outliner-header-type,
|
||||
.outliner-item-type,
|
||||
.outliner-header-icons,
|
||||
.outliner-item-icons {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 当面板宽度小于 280px 时只隐藏 Type 列 */
|
||||
/* Hide only Type column when panel width < 280px */
|
||||
@container scene-hierarchy (max-width: 280px) {
|
||||
.outliner-header-type,
|
||||
.outliner-item-type {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user