diff --git a/Fushigi/ui/widgets/CourseScene.cs b/Fushigi/ui/widgets/CourseScene.cs index 26dd84bf..3fe215ee 100644 --- a/Fushigi/ui/widgets/CourseScene.cs +++ b/Fushigi/ui/widgets/CourseScene.cs @@ -25,6 +25,7 @@ namespace Fushigi.ui.widgets class CourseScene { Dictionary viewports = []; + Dictionary? lastCreatedViewports; LevelViewport activeViewport; readonly Course course; @@ -87,8 +88,11 @@ public void DrawUI(GL gl) ImGui.DockSpace(0x100, ImGui.GetContentRegionAvail()); - foreach (var (area, viewport) in viewports) + for (int i = 0; i < course.GetAreaCount(); i++) { + var area = course.GetArea(i); + var viewport = viewports[area]; + ImGui.SetNextWindowDockID(0x100, ImGuiCond.Once); if (ImGui.Begin(area.GetName())) @@ -125,6 +129,22 @@ public void DrawUI(GL gl) } } + if (lastCreatedViewports != viewports) + { + for (int i = 0; i < course.GetAreaCount(); i++) + { + var area = course.GetArea(i); + if(area.mActorHolder.GetActors().Any(x=>x.mActorName=="PlayerLocator")) + { + ImGui.SetWindowFocus(area.GetName()); + break; + } + + } + + lastCreatedViewports = viewports; + } + if (activeViewport.mEditContext.SelectionVersion != selectionVersionBefore) { DeselectAll();