Fix focus issue
This commit is contained in:
@@ -11,7 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="GameJamDungeon"
|
||||
run/main_scene="uid://cagfc5ridmteu"
|
||||
run/main_scene="uid://d1gjaijijd5ot"
|
||||
run/print_header=false
|
||||
config/features=PackedStringArray("4.4", "C#", "GL Compatibility")
|
||||
run/delta_smoothing=false
|
||||
|
||||
@@ -25,7 +25,7 @@ public partial class App : CanvasLayer, IApp
|
||||
public IAppLogic AppLogic { get; set; } = default!;
|
||||
public AppLogic.IBinding AppBinding { get; set; } = default!;
|
||||
|
||||
[Node] public IMenu Menu { get; set; } = default!;
|
||||
[Node] public Menu Menu { get; set; } = default!;
|
||||
|
||||
[Node] public ISubViewport GameWindow { get; set; } = default!;
|
||||
|
||||
@@ -81,6 +81,7 @@ public partial class App : CanvasLayer, IApp
|
||||
Game.Show();
|
||||
|
||||
FadeInFromBlack();
|
||||
Menu.NewGameButton.GrabFocus();
|
||||
})
|
||||
.Handle((in AppLogic.Output.FadeToBlack _) => FadeToBlack())
|
||||
.Handle((in AppLogic.Output.HideGame _) => FadeToBlack())
|
||||
|
||||
@@ -51,10 +51,4 @@ public partial class Menu : Control, IMenu
|
||||
public void OnLoadGamePressed() => EmitSignal(SignalName.LoadGame);
|
||||
|
||||
public void OnQuitPressed() => EmitSignal(SignalName.Quit);
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed(GameInputs.Attack))
|
||||
OnNewGamePressed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 0
|
||||
theme_override_constants/margin_left = 100
|
||||
theme_override_constants/margin_top = 100
|
||||
theme_override_constants/margin_right = 100
|
||||
@@ -27,19 +28,27 @@ theme_override_constants/margin_bottom = 100
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 0
|
||||
|
||||
[node name="NewGameButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
focus_neighbor_bottom = NodePath("../LoadGameButton")
|
||||
theme_override_colors/font_focus_color = Color(0.976471, 0.827451, 0, 1)
|
||||
text = "New Game"
|
||||
|
||||
[node name="LoadGameButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
focus_neighbor_top = NodePath("../NewGameButton")
|
||||
focus_neighbor_bottom = NodePath("../QuitButton")
|
||||
theme_override_colors/font_focus_color = Color(0.976471, 0.827451, 0, 1)
|
||||
text = "Load Game"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
focus_neighbor_top = NodePath("../LoadGameButton")
|
||||
theme_override_colors/font_focus_color = Color(0.976471, 0.827451, 0, 1)
|
||||
text = "Quit
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user