* Update all FGUI components * 更新所有 FGUI 组件
(deltaTime?: number)
| 138 | * 更新所有 FGUI 组件 |
| 139 | */ |
| 140 | public update(deltaTime?: number): void { |
| 141 | if (!this._enabled) return; |
| 142 | |
| 143 | // Calculate delta time in seconds if not provided |
| 144 | const currentTime = performance.now() / 1000; |
| 145 | const dt = deltaTime ?? (currentTime - this._lastTime); |
| 146 | this._lastTime = currentTime; |
| 147 | |
| 148 | // Update timers - Timer expects milliseconds |
| 149 | Timer.inst.update(dt * 1000); |
| 150 | |
| 151 | // Clear collector for new frame |
| 152 | this._collector.clear(); |
| 153 | |
| 154 | // Sort components by sorting order |
| 155 | const sortedComponents = Array.from(this._components) |
| 156 | .filter(c => c.isReady && c.visible) |
| 157 | .sort((a, b) => a.sortingOrder - b.sortingOrder); |
| 158 | |
| 159 | // Collect render data from each component |
| 160 | for (const component of sortedComponents) { |
| 161 | if (component.root) { |
| 162 | component.syncProperties(); |
| 163 | component.root.collectRenderData(this._collector); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | // Submit render data |
| 168 | if (this._onSubmit) { |
| 169 | this._onSubmit(this._collector); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Dispose the system |
nothing calls this directly
no test coverage detected