* @zh 停止运行(切换回静态模式) * @en Stop running (switch back to static mode) * * @zh 在编辑器中,从 EditorPreview 切换回 EditorStatic * @en In editor, switches from EditorPreview back to EditorStatic
()
| 652 | * @en In editor, switches from EditorPreview back to EditorStatic |
| 653 | */ |
| 654 | stop(): void { |
| 655 | if (!this._state.running) { |
| 656 | return; |
| 657 | } |
| 658 | |
| 659 | // 在编辑器中切换回静态模式(setMode 会处理系统禁用) |
| 660 | if (this._platform.isEditorMode()) { |
| 661 | this.setMode(RuntimeMode.EditorStatic); |
| 662 | } |
| 663 | |
| 664 | // 重置物理系统状态 |
| 665 | const physicsSystem = this._systemContext?.services.get(Physics2DSystemToken); |
| 666 | if (physicsSystem) { |
| 667 | physicsSystem.reset?.(); |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | /** |
| 672 | * 单步执行 |
no test coverage detected