()
| 94 | const isFrameDebuggerMode = new URLSearchParams(window.location.search).get('mode') === 'frame-debugger'; |
| 95 | |
| 96 | function App() { |
| 97 | const initRef = useRef(false); |
| 98 | const layoutContainerRef = useRef<FlexLayoutDockContainerHandle>(null); |
| 99 | const [pluginLoader] = useState(() => new PluginLoader()); |
| 100 | const { showToast, hideToast } = useToast(); |
| 101 | |
| 102 | // 如果是独立调试窗口模式,只渲染调试面板 | If standalone debugger mode, only render debug panel |
| 103 | if (isFrameDebuggerMode) { |
| 104 | return ( |
| 105 | <div style={{ width: '100vw', height: '100vh', overflow: 'hidden' }}> |
| 106 | <RenderDebugPanel visible={true} onClose={() => window.close()} standalone /> |
| 107 | </div> |
| 108 | ); |
| 109 | } |
| 110 | |
| 111 | // ===== 本地初始化状态(只用于初始化阶段)| Local init state (only for initialization) ===== |
| 112 | const [initialized, setInitialized] = useState(false); |
| 113 | |
| 114 | // ===== 从 EditorStore 获取状态 | Get state from EditorStore ===== |
| 115 | const { |
| 116 | projectLoaded, setProjectLoaded, |
| 117 | currentProjectPath, setCurrentProjectPath, |
| 118 | availableScenes, setAvailableScenes, |
| 119 | isLoading, setIsLoading, |
| 120 | loadingMessage, |
| 121 | panels, setPanels, |
| 122 | activeDynamicPanels, addDynamicPanel, removeDynamicPanel, clearDynamicPanels, |
| 123 | dynamicPanelTitles, setDynamicPanelTitle, |
| 124 | activePanelId, setActivePanelId, |
| 125 | pluginUpdateTrigger, triggerPluginUpdate, |
| 126 | isRemoteConnected, setIsRemoteConnected, |
| 127 | isContentBrowserDocked, setIsContentBrowserDocked, |
| 128 | isEditorFullscreen, setIsEditorFullscreen, |
| 129 | status, setStatus, |
| 130 | showProjectWizard, setShowProjectWizard, |
| 131 | settingsInitialCategory, setSettingsInitialCategory, |
| 132 | compilerDialog, openCompilerDialog, closeCompilerDialog, |
| 133 | } = useEditorStore(); |
| 134 | |
| 135 | // ===== 服务实例用 useRef(不触发重渲染)| Service instances use useRef (no re-renders) ===== |
| 136 | const pluginManagerRef = useRef<PluginManager | null>(null); |
| 137 | const entityStoreRef = useRef<EntityStoreService | null>(null); |
| 138 | const messageHubRef = useRef<MessageHub | null>(null); |
| 139 | const inspectorRegistryRef = useRef<InspectorRegistry | null>(null); |
| 140 | const logServiceRef = useRef<LogService | null>(null); |
| 141 | const uiRegistryRef = useRef<UIRegistry | null>(null); |
| 142 | const settingsRegistryRef = useRef<SettingsRegistry | null>(null); |
| 143 | const sceneManagerRef = useRef<SceneManagerService | null>(null); |
| 144 | const notificationRef = useRef<INotification | null>(null); |
| 145 | const dialogRef = useRef<IDialogExtended | null>(null); |
| 146 | const buildServiceRef = useRef<BuildService | null>(null); |
| 147 | const projectServiceRef = useRef<ProjectService | null>(null); |
| 148 | |
| 149 | // 兼容层:提供 getter 访问服务 | Compatibility layer: provide getter access to services |
| 150 | const pluginManager = pluginManagerRef.current; |
| 151 | const entityStore = entityStoreRef.current; |
| 152 | const messageHub = messageHubRef.current; |
| 153 | const inspectorRegistry = inspectorRegistryRef.current; |
nothing calls this directly
no test coverage detected