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:
YHH
2025-12-13 19:44:08 +08:00
committed by GitHub
parent a716d8006c
commit beaa1d09de
258 changed files with 17725 additions and 3030 deletions

View File

@@ -701,11 +701,13 @@
.build-progress-dialog {
display: flex;
flex-direction: column;
width: 360px;
width: 400px;
max-width: 90vw;
background: #2a2a2a;
border: 1px solid #3a3a3a;
border-radius: 4px;
border-radius: 6px;
overflow: hidden;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.build-progress-header {
@@ -747,14 +749,31 @@
display: flex;
flex-direction: column;
align-items: center;
padding: 24px 20px;
gap: 12px;
padding: 28px 24px;
gap: 16px;
}
.build-progress-status-icon {
display: flex;
align-items: center;
justify-content: center;
width: 72px;
height: 72px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.03);
transition: background-color 0.3s ease;
}
/* Success state background */
/* 成功状态背景 */
.build-progress-status-icon:has(.build-progress-success) {
background: rgba(74, 222, 128, 0.1);
}
/* Error state background */
/* 错误状态背景 */
.build-progress-status-icon:has(.build-progress-error) {
background: rgba(239, 68, 68, 0.1);
}
.build-progress-spinner {
@@ -769,18 +788,33 @@
.build-progress-success {
color: #4ade80;
filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.3));
}
.build-progress-error {
color: #ef4444;
filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.3));
}
.build-progress-message {
font-size: 11px;
color: #ccc;
font-size: 13px;
font-weight: 500;
color: #e0e0e0;
text-align: center;
}
/* Success message styling */
/* 成功消息样式 */
.build-progress-dialog:has(.build-progress-success) .build-progress-message {
color: #4ade80;
}
/* Error message styling */
/* 错误消息样式 */
.build-progress-dialog:has(.build-progress-error) .build-progress-message {
color: #ef4444;
}
.build-progress-bar-container {
position: relative;
width: 100%;
@@ -812,25 +846,35 @@
width: 100%;
display: flex;
flex-direction: column;
gap: 6px;
margin-top: 4px;
gap: 8px;
margin-top: 8px;
padding: 12px;
background: rgba(0, 0, 0, 0.2);
border-radius: 4px;
}
.build-result-row {
display: flex;
align-items: center;
align-items: flex-start;
gap: 8px;
font-size: 11px;
}
.build-result-label {
color: #888;
flex-shrink: 0;
min-width: 70px;
}
.build-result-value {
color: #ccc;
color: #e0e0e0;
word-break: break-all;
font-family: 'Consolas', 'Monaco', monospace;
font-size: 11px;
background: rgba(0, 0, 0, 0.3);
padding: 4px 8px;
border-radius: 3px;
flex: 1;
}
.build-result-error {
@@ -977,16 +1021,29 @@
.build-progress-actions {
display: flex;
justify-content: center;
padding: 12px;
gap: 8px;
padding: 12px 16px;
border-top: 1px solid #1a1a1a;
background: #262626;
}
.build-progress-actions .build-settings-btn {
min-width: 80px;
min-width: 100px;
justify-content: center;
}
/* Success state actions - show open folder prominently */
/* 成功状态操作 - 突出显示打开文件夹按钮 */
.build-progress-actions .build-settings-btn.secondary {
background: #374151;
border-color: #4b5563;
}
.build-progress-actions .build-settings-btn.secondary:hover {
background: #4b5563;
border-color: #6b7280;
}
/* ==================== Toggle Group | 开关组 ==================== */
.build-settings-toggle-group {

View File

@@ -303,6 +303,10 @@
border-bottom: 1px solid #3c3c3c;
}
.cb-filter-wrapper {
position: relative;
}
.cb-filter-btn {
display: flex;
align-items: center;
@@ -320,6 +324,99 @@
color: #ccc;
}
.cb-filter-btn.has-filter {
background: #0e639c;
color: #fff;
}
.cb-filter-badge {
font-size: 10px;
background: #fff;
color: #0e639c;
padding: 0 4px;
border-radius: 8px;
margin-left: 2px;
}
.cb-filter-dropdown {
position: absolute;
top: 100%;
left: 0;
margin-top: 4px;
min-width: 200px;
background: #252526;
border: 1px solid #3c3c3c;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 100;
}
.cb-filter-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 10px;
border-bottom: 1px solid #3c3c3c;
font-size: 11px;
color: #999;
}
.cb-filter-clear {
background: none;
border: none;
color: #0e639c;
cursor: pointer;
font-size: 11px;
padding: 0;
}
.cb-filter-clear:hover {
text-decoration: underline;
}
.cb-filter-list {
max-height: 200px;
overflow-y: auto;
padding: 4px 0;
}
.cb-filter-empty {
padding: 12px;
text-align: center;
color: #666;
font-size: 12px;
}
.cb-filter-item {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
cursor: pointer;
font-size: 12px;
color: #ccc;
}
.cb-filter-item:hover {
background: #2a2d2e;
}
.cb-filter-item input[type="checkbox"] {
margin: 0;
width: 14px;
height: 14px;
}
.cb-filter-ext {
flex: 1;
font-family: 'Consolas', 'Monaco', monospace;
}
.cb-filter-count {
color: #666;
font-size: 11px;
}
.cb-search-input-wrapper {
flex: 1;
position: relative;
@@ -336,7 +433,7 @@
.cb-search-input {
width: 100%;
padding: 6px 10px 6px 32px;
padding: 6px 28px 6px 32px;
background: #3c3c3c;
border: 1px solid #4c4c4c;
border-radius: 3px;
@@ -353,6 +450,26 @@
color: #666;
}
.cb-search-clear {
position: absolute;
right: 6px;
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;
}
.cb-search-clear:hover {
background: rgba(255, 255, 255, 0.1);
color: #fff;
}
.cb-view-options {
display: flex;
gap: 2px;
@@ -401,16 +518,89 @@
gap: 2px;
}
.cb-loading,
.cb-empty {
/* Loading Spinner | 加载动画 */
.cb-loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
gap: 12px;
color: #666;
font-size: 13px;
}
.cb-loading-spinner {
width: 32px;
height: 32px;
border: 3px solid #3c3c3c;
border-top-color: #3b82f6;
border-radius: 50%;
animation: cbSpinner 0.8s linear infinite;
}
@keyframes cbSpinner {
to {
transform: rotate(360deg);
}
}
/* Empty State | 空状态 */
.cb-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
gap: 12px;
color: #666;
font-size: 13px;
padding: 24px;
text-align: center;
}
.cb-empty-icon {
color: #4a4a4a;
opacity: 0.6;
}
.cb-empty-title {
font-size: 14px;
font-weight: 500;
color: #888;
}
.cb-empty-hint {
font-size: 12px;
color: #666;
max-width: 200px;
line-height: 1.4;
}
.cb-empty-action {
margin-top: 8px;
padding: 6px 16px;
background: #3b82f6;
border: none;
border-radius: 4px;
color: #fff;
font-size: 12px;
cursor: pointer;
transition: background 0.15s ease;
}
.cb-empty-action:hover {
background: #2563eb;
}
/* Search Highlight | 搜索高亮 */
.search-highlight {
background: rgba(59, 130, 246, 0.3);
color: #fff;
border-radius: 2px;
padding: 0 2px;
}
/* Asset Item - Grid View */
.cb-asset-grid.grid .cb-asset-item {
display: flex;
@@ -550,6 +740,7 @@
.cb-status-bar {
display: flex;
align-items: center;
gap: 12px;
padding: 4px 12px;
background: #252526;
border-top: 1px solid #3c3c3c;
@@ -557,6 +748,11 @@
color: #888;
}
.cb-status-selected {
color: #3b82f6;
font-weight: 500;
}
/* ==================== Dialogs ==================== */
.cb-dialog-overlay {
position: fixed;

View File

@@ -10,6 +10,7 @@
overflow-y: auto;
z-index: 10001;
font-size: 13px;
transition: opacity 0.1s ease;
}
.context-menu.submenu {
@@ -29,7 +30,8 @@
position: relative;
}
.context-menu-item:hover:not(.disabled) {
.context-menu-item:hover:not(.disabled),
.context-menu-item.active:not(.disabled) {
background-color: #094771;
color: #ffffff;
}

View File

@@ -104,6 +104,31 @@
color: #555;
}
.inspector-search-clear {
display: flex;
align-items: center;
justify-content: center;
padding: 2px;
background: transparent;
border: none;
color: #666;
cursor: pointer;
border-radius: 2px;
transition: all 0.15s ease;
}
.inspector-search-clear:hover {
background: rgba(255, 255, 255, 0.1);
color: #fff;
}
.inspector-search-count {
font-size: 10px;
color: #666;
white-space: nowrap;
padding: 0 4px;
}
/* Category Tabs */
.inspector-category-tabs {
display: flex;
@@ -430,7 +455,7 @@
.property-field {
display: flex;
justify-content: space-between;
align-items: center;
align-items: flex-start;
padding: 4px 8px;
font-size: 11px;
gap: 8px;
@@ -440,6 +465,11 @@
min-height: 24px;
}
/* 简单字段(文本、数字等)垂直居中 | Simple fields (text, number, etc.) center vertically */
.property-field.simple-field {
align-items: center;
}
.property-field:last-child {
margin-bottom: 0;
}
@@ -454,6 +484,12 @@
flex-shrink: 0;
min-width: 70px;
font-size: 11px;
padding-top: 3px;
}
/* 简单字段的 label 不需要额外的 padding | Simple field labels don't need extra padding */
.property-field.simple-field .property-label {
padding-top: 0;
}
.property-value-text {
@@ -778,6 +814,15 @@
background: var(--color-primary);
}
.component-dropdown-item.selected {
background: var(--color-bg-active, #3b82f6);
color: #fff;
}
.component-dropdown-item.selected svg {
color: rgba(255, 255, 255, 0.8);
}
.component-dropdown-item-name {
font-size: 12px;
font-weight: 500;
@@ -880,15 +925,30 @@
/* Property rows inside component */
.component-item-content .property-row {
display: flex;
align-items: center;
align-items: flex-start;
min-height: 22px;
padding: 2px 0;
}
/* 简单字段垂直居中 | Simple fields center vertically */
.component-item-content .property-row.simple-field {
align-items: center;
}
.component-item-content .property-row:hover {
background: rgba(255, 255, 255, 0.02);
}
/* 资源字段行需要更多高度 | Asset field rows need more height */
.component-item-content .property-field-asset {
min-height: 52px !important;
align-items: flex-start !important;
}
.component-item-content .property-field-asset > .property-label {
padding-top: 14px;
}
/* Code Preview */
.code-preview-section {
flex: 1;
@@ -1202,3 +1262,182 @@
border-color: #3b82f6;
color: #fff;
}
/* ========== Prefab Inspector Styles ========== */
.prefab-inspector .inspector-header {
border-left: 3px solid #4ade80;
}
.prefab-hierarchy {
background: #1a1a1a;
border-radius: 4px;
padding: 4px 0;
max-height: 200px;
overflow-y: auto;
}
.prefab-entity-node {
font-size: 11px;
}
.prefab-entity-row {
display: flex;
align-items: center;
gap: 4px;
padding: 2px 4px;
cursor: pointer;
border-radius: 2px;
}
.prefab-entity-row:hover {
background: #2a2a2a;
}
.prefab-entity-expand {
display: flex;
align-items: center;
justify-content: center;
width: 12px;
color: #666;
}
.prefab-entity-icon {
color: #4ade80;
flex-shrink: 0;
}
.prefab-entity-name {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #ccc;
}
.prefab-entity-components {
color: #666;
font-size: 10px;
}
.prefab-component-types {
display: flex;
flex-wrap: wrap;
gap: 4px;
padding: 4px 0;
}
.prefab-component-type-tag {
display: inline-block;
padding: 2px 6px;
background: #2a2a2a;
border: 1px solid #3a3a3a;
border-radius: 3px;
font-size: 10px;
color: #a78bfa;
}
.prefab-instantiate-btn:hover {
background: #22c55e !important;
}
/* ========== Prefab Property Override Styles ========== */
/* 预制体属性覆盖样式 */
/* Property row with override indicator | 带覆盖指示的属性行 */
.property-row.overridden {
position: relative;
}
.property-row.overridden::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 3px;
background: #3b82f6;
border-radius: 2px 0 0 2px;
}
.property-row.overridden .property-label {
color: #60a5fa;
font-weight: 600;
}
/* Override indicator dot for compact views | 紧凑视图的覆盖指示点 */
.property-override-indicator {
display: inline-flex;
align-items: center;
justify-content: center;
width: 6px;
height: 6px;
background: #3b82f6;
border-radius: 50%;
margin-left: 4px;
flex-shrink: 0;
}
/* Transform input override state | Transform 输入框覆盖状态 */
.transform-axis-input.overridden {
border-color: #3b82f6;
box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}
.transform-axis-input.overridden .transform-axis-bar {
background: #3b82f6;
}
/* Context menu for reverting property | 还原属性的上下文菜单 */
.property-context-menu {
position: fixed;
background: #2d2d2d;
border: 1px solid #3e3e3e;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
z-index: 9999;
min-width: 140px;
padding: 4px 0;
}
.property-context-menu-item {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
padding: 6px 12px;
background: transparent;
border: none;
color: #ccc;
font-size: 11px;
text-align: left;
cursor: pointer;
}
.property-context-menu-item:hover {
background: #3a3a3a;
}
.property-context-menu-item.revert {
color: #60a5fa;
}
.property-context-menu-item.revert:hover {
background: rgba(59, 130, 246, 0.2);
}
/* Component header prefab instance indicator | 组件头部预制体实例指示 */
.component-item-header.prefab-instance {
border-left: 2px solid #3b82f6;
}
.component-item-header.prefab-instance .component-item-name::after {
content: '';
display: inline-block;
width: 6px;
height: 6px;
background: #3b82f6;
border-radius: 50%;
margin-left: 6px;
vertical-align: middle;
}

View File

@@ -0,0 +1,145 @@
/**
* 预制体实例信息样式
* Prefab instance info styles
*/
.prefab-instance-info {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
border: 1px solid rgba(59, 130, 246, 0.2);
border-radius: 6px;
padding: 10px 12px;
margin-bottom: 12px;
}
.prefab-instance-header {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 8px;
font-size: 12px;
}
.prefab-icon {
font-size: 14px;
opacity: 0.8;
}
.prefab-instance-info .prefab-label {
color: var(--text-secondary, #6b7280);
font-weight: 500;
}
.prefab-instance-info .prefab-name {
color: var(--text-primary, #1f2937);
font-weight: 600;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.prefab-modified-badge {
background: #3b82f6;
color: white;
font-size: 10px;
font-weight: 600;
padding: 2px 6px;
border-radius: 10px;
min-width: 16px;
text-align: center;
}
.prefab-instance-actions {
display: flex;
gap: 4px;
flex-wrap: wrap;
}
.prefab-action-btn {
padding: 4px 10px;
font-size: 11px;
font-weight: 500;
border: 1px solid var(--border-color, #e5e7eb);
border-radius: 4px;
background: var(--bg-secondary, #f9fafb);
color: var(--text-primary, #374151);
cursor: pointer;
transition: all 0.15s ease;
}
.prefab-action-btn:hover:not(:disabled) {
background: var(--bg-hover, #f3f4f6);
border-color: var(--border-hover, #d1d5db);
}
.prefab-action-btn:active:not(:disabled) {
background: var(--bg-active, #e5e7eb);
}
.prefab-action-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Apply button - highlighted when there are modifications */
.prefab-action-apply:not(:disabled) {
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
border-color: #2563eb;
color: white;
}
.prefab-action-apply:not(:disabled):hover {
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
border-color: #1d4ed8;
}
/* Revert button - subtle warning style when modifications exist */
.prefab-action-revert:not(:disabled) {
background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
border-color: #d97706;
color: white;
}
.prefab-action-revert:not(:disabled):hover {
background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
border-color: #b45309;
}
/* Unpack button - danger style */
.prefab-action-unpack {
min-width: 28px;
padding: 4px 6px;
}
.prefab-action-unpack:hover:not(:disabled) {
background: rgba(239, 68, 68, 0.1);
border-color: #ef4444;
color: #ef4444;
}
/* Dark theme support */
@media (prefers-color-scheme: dark) {
.prefab-instance-info {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.06) 100%);
border-color: rgba(59, 130, 246, 0.3);
}
.prefab-instance-info .prefab-label {
color: var(--text-secondary-dark, #9ca3af);
}
.prefab-instance-info .prefab-name {
color: var(--text-primary-dark, #f3f4f6);
}
.prefab-action-btn {
background: var(--bg-secondary-dark, #374151);
border-color: var(--border-color-dark, #4b5563);
color: var(--text-primary-dark, #e5e7eb);
}
.prefab-action-btn:hover:not(:disabled) {
background: var(--bg-hover-dark, #4b5563);
border-color: var(--border-hover-dark, #6b7280);
}
}

View File

@@ -11,6 +11,12 @@
}
/* ==================== Property Row ==================== */
.property-row {
display: block;
position: relative;
overflow: visible;
}
.property-field {
display: flex;
flex-direction: row;
@@ -401,6 +407,43 @@ input[type="number"].property-input {
}
/* ==================== Asset Field ==================== */
/* Property field containing asset field - use flex-start alignment | 包含资源字段的属性行使用顶部对齐 */
.property-field-asset {
align-items: flex-start !important;
min-height: 52px !important;
}
.property-field-asset > .property-label {
padding-top: 14px;
}
/* Ensure property-row expands for asset fields | 确保属性行能为资源字段扩展 */
.property-row:has(.property-field-asset),
.property-row:has(.asset-field) {
min-height: 52px;
}
/* Ensure property-row expands for array fields | 确保属性行能为数组字段扩展 */
.property-row:has(.property-field-array) {
min-height: auto;
height: auto;
overflow: visible;
display: block;
}
/* Fallback for array fields without :has() support */
.property-inspector .property-field-array {
min-height: auto !important;
height: auto !important;
overflow: visible !important;
position: relative;
}
/* Fallback for browsers without :has() support | 不支持 :has() 的浏览器的备用方案 */
.property-inspector .property-field-asset {
min-height: 52px !important;
}
.property-asset-container {
flex: 1;
display: flex;
@@ -1157,6 +1200,149 @@ input[type="number"].property-input {
color: #fff;
}
/* ==================== Array Field ==================== */
.property-field-array {
display: flex;
flex-direction: column;
align-items: stretch;
padding: 4px 8px;
min-height: auto;
height: auto;
overflow: visible;
}
.array-field-header {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 0;
min-height: 26px;
}
.array-field-header .property-label {
flex: 0 0 auto;
min-width: auto;
max-width: none;
}
.array-field-count {
font-size: 10px;
color: #666;
font-family: monospace;
}
.array-field-add {
margin-left: auto;
width: 18px;
height: 18px;
display: flex;
align-items: center;
justify-content: center;
background: #2a2a2a;
border: 1px solid #3a3a3a;
border-radius: 3px;
color: #999;
cursor: pointer;
font-size: 14px;
line-height: 1;
transition: all 0.15s ease;
}
.array-field-add:hover {
background: #3b82f6;
border-color: #3b82f6;
color: #fff;
}
.array-field-items {
display: flex;
flex-direction: column;
gap: 2px;
margin-top: 4px;
margin-left: 8px;
border-left: 1px solid #3a3a3a;
padding-left: 8px;
}
.array-field-empty {
font-size: 10px;
color: #666;
padding: 8px;
text-align: center;
font-style: italic;
}
.array-field-item {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 6px;
background: #252525;
border-radius: 3px;
transition: background 0.15s ease;
}
.array-field-item:hover {
background: #2a2a2a;
}
.array-field-item.dragging {
opacity: 0.5;
background: #3b82f6;
}
.array-field-drag-handle {
cursor: grab;
color: #555;
font-size: 10px;
letter-spacing: -2px;
user-select: none;
}
.array-field-drag-handle:active {
cursor: grabbing;
}
.array-field-index {
font-size: 9px;
color: #555;
font-family: monospace;
min-width: 20px;
}
.array-field-value {
flex: 1;
min-width: 0;
}
.array-field-value .property-input {
width: 100%;
}
.array-field-value .asset-field {
width: 100%;
}
.array-field-remove {
width: 16px;
height: 16px;
display: flex;
align-items: center;
justify-content: center;
background: transparent;
border: none;
border-radius: 2px;
color: #666;
cursor: pointer;
font-size: 12px;
transition: all 0.15s ease;
}
.array-field-remove:hover {
background: #ef4444;
color: #fff;
}
/* ==================== Reduced Motion ==================== */
@media (prefers-reduced-motion: reduce) {
.property-input,
@@ -1164,7 +1350,10 @@ input[type="number"].property-input {
.property-toggle-thumb,
.property-expand-btn,
.property-color-preview,
.property-section-expand {
.property-section-expand,
.array-field-item,
.array-field-add,
.array-field-remove {
transition: none;
}
}

View File

@@ -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;
}
}

View File

@@ -527,6 +527,64 @@
border-color: #b91c1c;
}
.startup-dialog-btn.primary {
background: #0e639c;
border-color: #0e639c;
color: #ffffff;
display: flex;
align-items: center;
gap: 6px;
}
.startup-dialog-btn.primary:hover:not(:disabled) {
background: #1177bb;
border-color: #1177bb;
}
.startup-dialog-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
/* esbuild 安装对话框样式 | esbuild Installation Dialog Styles */
.startup-dialog-info {
padding: 10px 12px;
background: #1e1e1e;
border-radius: 4px;
font-size: 13px;
color: #cccccc;
border-left: 3px solid #0e639c;
}
.startup-dialog-progress {
display: flex;
align-items: center;
gap: 10px;
padding: 12px;
background: #1e1e1e;
border-radius: 4px;
margin-top: 12px;
color: #0e639c;
font-size: 13px;
}
.startup-dialog-error {
display: flex;
align-items: center;
gap: 10px;
padding: 12px;
background: #1e1e1e;
border-radius: 4px;
margin-top: 12px;
color: #dc2626;
font-size: 13px;
border-left: 3px solid #dc2626;
}
.dialog-icon-info {
color: #0e639c;
}
/* 环境状态指示器样式 | Environment Status Indicator Styles */
.startup-env-status {
position: relative;

View File

@@ -380,6 +380,50 @@
font-variant-numeric: tabular-nums;
}
/* Live Transform Display | 实时变换显示 */
.viewport-live-transform {
position: absolute;
bottom: 12px;
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 8px;
background: rgba(59, 130, 246, 0.9);
backdrop-filter: blur(8px);
border-radius: 4px;
padding: 6px 12px;
font-family: var(--font-family-mono);
font-size: 12px;
pointer-events: none;
z-index: var(--z-index-above);
animation: slideUp 0.15s ease-out;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateX(-50%) translateY(8px);
}
to {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
}
.live-transform-label {
color: rgba(255, 255, 255, 0.7);
font-weight: 500;
}
.live-transform-value {
color: #fff;
font-weight: 600;
min-width: 50px;
text-align: right;
}
.viewport:fullscreen {
background: #000;
}
@@ -397,3 +441,83 @@
transition: none;
}
}
/* ==================== Prefab Edit Mode Toolbar | 预制体编辑模式工具栏 ==================== */
.viewport.prefab-edit-mode {
border: 2px solid #3b82f6;
border-radius: 4px;
}
.viewport-prefab-toolbar {
position: absolute;
top: 8px;
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 16px;
padding: 8px 16px;
background: linear-gradient(135deg, rgba(30, 58, 95, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
border: 1px solid #3b82f6;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
z-index: 100;
backdrop-filter: blur(4px);
}
.viewport-prefab-toolbar-left {
display: flex;
align-items: center;
gap: 8px;
color: #e0f2fe;
font-size: 13px;
font-weight: 500;
}
.viewport-prefab-toolbar-left svg {
color: #38bdf8;
}
.viewport-prefab-toolbar-left .prefab-name {
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.viewport-prefab-toolbar-right {
display: flex;
align-items: center;
gap: 8px;
}
.viewport-prefab-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
border: none;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.15s ease;
}
.viewport-prefab-btn.save {
background: #22c55e;
color: #ffffff;
}
.viewport-prefab-btn.save:hover {
background: #16a34a;
}
.viewport-prefab-btn.exit {
background: #475569;
color: #e2e8f0;
}
.viewport-prefab-btn.exit:hover {
background: #64748b;
}

View File

@@ -75,16 +75,6 @@ select {
background: transparent;
}
/* 滚动条悬停时显示更宽 */
*:hover::-webkit-scrollbar {
width: 10px;
height: 10px;
}
*:hover::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.15);
}
.scrollable {
overflow: auto;
}