In progress gameplay loop changes
This commit is contained in:
@@ -2,6 +2,7 @@ using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -16,8 +17,40 @@ public partial class DeathMenu : Control, IDeathMenu
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency] Game Game => this.DependOn<Game>();
|
||||
|
||||
[Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
[Node] public IButton Continue { get; set; } = default!;
|
||||
|
||||
[Node] public IButton Exit { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
Continue.Pressed += Continue_Pressed;
|
||||
Exit.Pressed += Exit_Pressed;
|
||||
VisibilityChanged += DeathMenu_VisibilityChanged;
|
||||
}
|
||||
|
||||
private void DeathMenu_VisibilityChanged()
|
||||
{
|
||||
if (Visible)
|
||||
Continue.CallDeferred(MethodName.GrabFocus, []);
|
||||
else
|
||||
ReleaseFocus();
|
||||
}
|
||||
|
||||
private void Exit_Pressed()
|
||||
{
|
||||
GetTree().Quit();
|
||||
}
|
||||
|
||||
private void Continue_Pressed()
|
||||
{
|
||||
FadeOut();
|
||||
Game.GameLogic.Input(new GameLogic.Input.GoToOverworld());
|
||||
}
|
||||
|
||||
public void FadeIn() => AnimationPlayer.Play("fade_in");
|
||||
|
||||
public void FadeOut() => AnimationPlayer.Play("fade_out");
|
||||
|
||||
@@ -90,10 +90,33 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="GameOverPlaceholder" type="Label" parent="CenterContainer"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GameOverPlaceholder" type="Label" parent="CenterContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.545098, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 12
|
||||
theme_override_fonts/font = ExtResource("2_ip5p6")
|
||||
theme_override_font_sizes/font_size = 72
|
||||
text = "Game Over"
|
||||
|
||||
[node name="Continue" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
layout_mode = 2
|
||||
focus_neighbor_top = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../Exit")
|
||||
focus_next = NodePath("../Exit")
|
||||
focus_previous = NodePath(".")
|
||||
text = "Continue"
|
||||
|
||||
[node name="Exit" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
layout_mode = 2
|
||||
focus_neighbor_top = NodePath("../Continue")
|
||||
focus_neighbor_bottom = NodePath(".")
|
||||
focus_next = NodePath(".")
|
||||
focus_previous = NodePath("../Continue")
|
||||
text = "Exit"
|
||||
|
||||
Reference in New Issue
Block a user