RoboCute

Editor V02

2025-12-12 重构MainWindow

目标

当前MainWindow类承担了过多的职责,包括UI组件管理、场景同步、工作流切换、事件处理等,导致代码臃肿难以维护。本次重构的目标是:

重构计划

0. 集中Context提取

将Editor上方提取一个EditorContext类,用来管理当前Editor的全部状态,让UI表现与工作流分离

1. UI逻辑拆分 - EditorLayoutManager

2. 消息管线独立 - CentralEvent/Command Bus

3. 工作流管理 - WorkflowController

4. 业务逻辑拆分:实现专门的业务管理类

5. 依赖注入 - Dependency Injection

类职责划分详情

MainWindow (精简后的主窗口类)

EditorLayoutManager (新增)

WorkflowController (增强)

SceneUpdater (新增)

EntitySelectionHandler (新增)

AnimationController (新增)

依赖关系

MainWindow
├── EditorLayoutManager
├── WorkflowController
├── SceneUpdater
├── EntitySelectionHandler
├── AnimationController
└── CentralEventBus (消息总线)