Change affinity

This commit is contained in:
2025-01-19 12:59:24 -08:00
parent f3a51de28a
commit 4910ff7770
20 changed files with 272 additions and 89 deletions

View File

@@ -8,7 +8,7 @@ public interface IFloorClearMenu : IControl
{
event FloorClearMenu.GoToNextFloorEventHandler GoToNextFloor;
event FloorClearMenu.ReturnToHubWorldEventHandler ReturnToHubWorld;
event FloorClearMenu.SaveAndExitEventHandler SaveAndExit;
event FloorClearMenu.TransitionCompletedEventHandler TransitionCompleted;
@@ -29,7 +29,7 @@ public partial class FloorClearMenu : Control, IFloorClearMenu
[Node] public Button ContinueButton { get; set; } = default!;
[Node] public Button ReturnToHubButton { get; set; } = default!;
[Node] public Button SaveAndExitButton { get; set; } = default!;
public void FadeIn() => AnimationPlayer.Play("fade_in");
@@ -40,26 +40,26 @@ public partial class FloorClearMenu : Control, IFloorClearMenu
[Signal]
public delegate void GoToNextFloorEventHandler();
[Signal]
public delegate void ReturnToHubWorldEventHandler();
public delegate void SaveAndExitEventHandler();
public void OnResolved()
{
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
ContinueButton.Pressed += ContinueButton_Pressed;
ReturnToHubButton.Pressed += ReturnToHubButton_Pressed;
SaveAndExitButton.Pressed += SaveAndExitButton_Pressed;
}
private void ReturnToHubButton_Pressed()
private void SaveAndExitButton_Pressed()
{
ContinueButton.Disabled = true;
ReturnToHubButton.Disabled = true;
EmitSignal(SignalName.ReturnToHubWorld);
SaveAndExitButton.Disabled = true;
EmitSignal(SignalName.SaveAndExit);
}
private void ContinueButton_Pressed()
{
ContinueButton.Disabled = true;
ReturnToHubButton.Disabled = true;
SaveAndExitButton.Disabled = true;
EmitSignal(SignalName.GoToNextFloor);
}
@@ -68,7 +68,7 @@ public partial class FloorClearMenu : Control, IFloorClearMenu
if (animName == "fade_in")
{
ContinueButton.Disabled = false;
ReturnToHubButton.Disabled = false;
SaveAndExitButton.Disabled = false;
ContinueButton.CallDeferred(MethodName.GrabFocus);
}
if (animName == "fade_out")

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=11 format=3 uid="uid://pu6gp8de3ck4"]
[ext_resource type="Script" path="res://src/ui/floor_clear/FloorClearMenu.cs" id="1_q65kq"]
[ext_resource type="Script" uid="uid://yytomatekupe" path="res://src/ui/floor_clear/FloorClearMenu.cs" id="1_q65kq"]
[ext_resource type="FontFile" uid="uid://cm8j5vcdop5x0" path="res://src/ui/fonts/Mrs-Eaves-OT-Roman_31443.ttf" id="2_xk0dh"]
[sub_resource type="Animation" id="Animation_nc1gg"]
@@ -52,9 +52,9 @@ tracks/0/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_opfbx"]
_data = {
"RESET": SubResource("Animation_nc1gg"),
"fade_in": SubResource("Animation_p616x"),
"fade_out": SubResource("Animation_dhyvw")
&"RESET": SubResource("Animation_nc1gg"),
&"fade_in": SubResource("Animation_p616x"),
&"fade_out": SubResource("Animation_dhyvw")
}
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_phrcj"]
@@ -79,7 +79,7 @@ script = ExtResource("1_q65kq")
unique_name_in_owner = true
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_opfbx")
&"": SubResource("AnimationLibrary_opfbx")
}
[node name="BG" type="ColorRect" parent="."]
@@ -109,9 +109,9 @@ layout_mode = 2
focus_neighbor_left = NodePath(".")
focus_neighbor_top = NodePath(".")
focus_neighbor_right = NodePath(".")
focus_neighbor_bottom = NodePath("../ReturnToHubButton")
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
focus_neighbor_bottom = NodePath("../SaveAndExitButton")
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
theme_override_fonts/font = ExtResource("2_xk0dh")
theme_override_font_sizes/font_size = 36
theme_override_styles/focus = SubResource("StyleBoxEmpty_phrcj")
@@ -120,7 +120,7 @@ button_mask = 0
text = "Continue"
flat = true
[node name="ReturnToHubButton" type="Button" parent="CenterContainer/VBoxContainer"]
[node name="SaveAndExitButton" type="Button" parent="CenterContainer/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 50)
layout_mode = 2
@@ -128,12 +128,12 @@ focus_neighbor_left = NodePath(".")
focus_neighbor_top = NodePath("../ContinueButton")
focus_neighbor_right = NodePath(".")
focus_neighbor_bottom = NodePath(".")
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
theme_override_fonts/font = ExtResource("2_xk0dh")
theme_override_font_sizes/font_size = 36
theme_override_styles/focus = SubResource("StyleBoxEmpty_cyd1c")
theme_override_styles/normal = SubResource("StyleBoxEmpty_4bdva")
button_mask = 0
text = "Return To Overworld"
text = "Save and Exit"
flat = true

View File

@@ -15,10 +15,6 @@ public interface IInGameUI : IControl
public void HideMiniMap();
public void ShowInventoryFullMessage(string rejectedItemName);
public void ShowPickedUpItemMessage(string pickedUpItem);
event InGameUI.MinimapButtonReleasedEventHandler MinimapButtonReleased;
}
@@ -47,16 +43,6 @@ public partial class InGameUI : Control, IInGameUI
}
}
public void ShowInventoryFullMessage(string rejectedItemName)
{
PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName);
}
public void ShowPickedUpItemMessage(string pickedUp)
{
PlayerInfoUI.DisplayPickedUpMessage(pickedUp);
}
public void HideInventoryScreen()
{
InventoryMenu.Hide();

View File

@@ -7,9 +7,7 @@ namespace GameJamDungeon;
public interface IPlayerInfoUI : IControl
{
public void DisplayInventoryFullMessage(string rejectedItemName);
public void DisplayPickedUpMessage(string pickedUpItem);
public void DisplayMessage(string message);
}
[Meta(typeof(IAutoNode))]
@@ -80,9 +78,9 @@ public partial class PlayerInfoUI : Control, IPlayerInfoUI
};
}
public async void DisplayPickedUpMessage(string pickedUpItem)
public async void DisplayMessage(string message)
{
var newLabel = new Label() { Text = $"{pickedUpItem} picked up.", LabelSettings = _labelSettings };
var newLabel = new Label() { Text = message, LabelSettings = _labelSettings };
PlayerInfo.AddChild(newLabel);
GetTree().CreateTimer(3f).Timeout += () =>