using Godot; namespace SharpIDE.Godot.Features.BottomPanel; public partial class BottomPanelManager : Panel { private Control _runPanel = null!; private Control _debugPanel = null!; private Control _buildPanel = null!; private Control _problemsPanel = null!; private Dictionary _panelTypeMap = []; public override void _Ready() { _runPanel = GetNode("%RunPanel"); _debugPanel = GetNode("%DebugPanel"); _buildPanel = GetNode("%BuildPanel"); _problemsPanel = GetNode("%ProblemsPanel"); _panelTypeMap = new Dictionary { { BottomPanelType.Run, _runPanel }, { BottomPanelType.Debug, _debugPanel }, { BottomPanelType.Build, _buildPanel }, { BottomPanelType.Problems, _problemsPanel } }; GodotGlobalEvents.BottomPanelTabSelected += OnBottomPanelTabSelected; } private async Task OnBottomPanelTabSelected(BottomPanelType? type) { await this.InvokeAsync(() => { if (type == null) { GodotGlobalEvents.InvokeBottomPanelVisibilityChangeRequested(false); } else { GodotGlobalEvents.InvokeBottomPanelVisibilityChangeRequested(true); } foreach (var kvp in _panelTypeMap) { kvp.Value.Visible = kvp.Key == type; } }); } }