|
|
|
@ -5,14 +5,11 @@ public partial class Menu : CenterContainer |
|
|
|
|
|
|
|
|
|
public override void _Ready() |
|
|
|
|
{ |
|
|
|
|
foreach (var child in SideButtons.GetChildren()) |
|
|
|
|
if ((child is BaseButton button) && button.ToggleMode) |
|
|
|
|
foreach (var button in SideButtons.GetChildren().OfType<Button>()) |
|
|
|
|
button.Pressed += () => { |
|
|
|
|
for (var i = 0; i < Tabs.GetTabCount(); i++) |
|
|
|
|
if (Tabs.GetTabControl(i).Name == button.Name) |
|
|
|
|
Tabs.CurrentTab = i; |
|
|
|
|
// Make sure you can't "detoggle" the button. |
|
|
|
|
button.Disabled = true; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -36,9 +33,8 @@ public partial class Menu : CenterContainer |
|
|
|
|
public void OnTabChanged(int tabIndex) |
|
|
|
|
{ |
|
|
|
|
var tabName = Tabs.GetTabControl(tabIndex).Name; |
|
|
|
|
foreach (var child in SideButtons.GetChildren()) |
|
|
|
|
if ((child is BaseButton button) && button.ToggleMode) |
|
|
|
|
button.Disabled = button.ButtonPressed = button.Name == tabName; |
|
|
|
|
foreach (var button in SideButtons.GetChildren().OfType<Button>()) |
|
|
|
|
button.Disabled = button.Name == tabName; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void OnReturnPressed() |
|
|
|
|