More inventory menu improvements
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
~ floor_exit
|
||||
Proceed to the next floor?
|
||||
- Yes
|
||||
do SpawnNextFloor()
|
||||
do GoToNextFloor()
|
||||
- No
|
||||
=> END
|
||||
@@ -4,8 +4,21 @@ using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
|
||||
public interface IFloorClearMenu : IControl
|
||||
{
|
||||
event FloorClearMenu.GoToNextFloorEventHandler GoToNextFloor;
|
||||
|
||||
event FloorClearMenu.ReturnToHubWorldEventHandler ReturnToHubWorld;
|
||||
|
||||
event FloorClearMenu.TransitionCompletedEventHandler TransitionCompleted;
|
||||
|
||||
void FadeIn();
|
||||
|
||||
void FadeOut();
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class FloorClearMenu : Control
|
||||
public partial class FloorClearMenu : Control, IFloorClearMenu
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
@@ -14,15 +27,46 @@ public partial class FloorClearMenu : Control
|
||||
|
||||
[Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
[Node] public Button ContinueButton { get; set; } = default!;
|
||||
|
||||
[Node] public Button ReturnToHubButton { get; set; } = default!;
|
||||
|
||||
public void FadeIn() => AnimationPlayer.Play("fade_in");
|
||||
|
||||
public void FadeOut() => AnimationPlayer.Play("fade_out");
|
||||
|
||||
[Signal]
|
||||
public delegate void TransitionCompletedEventHandler();
|
||||
[Signal]
|
||||
public delegate void GoToNextFloorEventHandler();
|
||||
[Signal]
|
||||
public delegate void ReturnToHubWorldEventHandler();
|
||||
|
||||
private void AnimationPlayer_AnimationStarted(StringName animName)
|
||||
public void OnResolved()
|
||||
{
|
||||
EmitSignal(SignalName.TransitionCompleted);
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
ContinueButton.Pressed += ContinueButton_Pressed;
|
||||
ReturnToHubButton.Pressed += ReturnToHubButton_Pressed;
|
||||
}
|
||||
|
||||
private void ReturnToHubButton_Pressed()
|
||||
{
|
||||
EmitSignal(SignalName.ReturnToHubWorld);
|
||||
}
|
||||
|
||||
private void ContinueButton_Pressed()
|
||||
{
|
||||
EmitSignal(SignalName.GoToNextFloor);
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "fade_in")
|
||||
ContinueButton.CallDeferred(MethodName.GrabFocus);
|
||||
if (animName == "fade_out")
|
||||
{
|
||||
CallDeferred(MethodName.ReleaseFocus);
|
||||
EmitSignal(SignalName.TransitionCompleted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,20 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://pu6gp8de3ck4"]
|
||||
[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="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"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("FloorClearMenu/LoadScreen:color")
|
||||
tracks/0/path = NodePath("FloorClearMenu:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("FloorClearMenu:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
@@ -63,14 +52,21 @@ tracks/0/keys = {
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_opfbx"]
|
||||
_data = {
|
||||
&"fade_out": SubResource("Animation_dhyvw"),
|
||||
&"fade_in": SubResource("Animation_p616x"),
|
||||
&"RESET": SubResource("Animation_nc1gg")
|
||||
"RESET": SubResource("Animation_nc1gg"),
|
||||
"fade_in": SubResource("Animation_p616x"),
|
||||
"fade_out": SubResource("Animation_dhyvw")
|
||||
}
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_phrcj"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_tmmmd"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cyd1c"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4bdva"]
|
||||
|
||||
[node name="FloorClearMenu" type="Control"]
|
||||
process_mode = 3
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -79,8 +75,14 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_q65kq")
|
||||
|
||||
[node name="LoadScreen" type="ColorRect" parent="."]
|
||||
process_mode = 3
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_opfbx")
|
||||
}
|
||||
|
||||
[node name="BG" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -89,9 +91,49 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.137255, 0.121569, 0.12549, 1)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ContinueButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_opfbx")
|
||||
}
|
||||
custom_minimum_size = Vector2(200, 50)
|
||||
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)
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_fonts/font = ExtResource("2_xk0dh")
|
||||
theme_override_font_sizes/font_size = 36
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_phrcj")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_tmmmd")
|
||||
button_mask = 0
|
||||
text = "Continue"
|
||||
flat = true
|
||||
|
||||
[node name="ReturnToHubButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 50)
|
||||
layout_mode = 2
|
||||
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_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"
|
||||
flat = true
|
||||
|
||||
@@ -16,6 +16,8 @@ public interface IInGameUI : IControl
|
||||
public void HideMiniMap();
|
||||
|
||||
public void ShowInventoryFullMessage(string rejectedItemName);
|
||||
|
||||
event InGameUI.MinimapButtonReleasedEventHandler MinimapButtonReleased;
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -29,6 +31,20 @@ public partial class InGameUI : Control, IInGameUI
|
||||
|
||||
[Node] public IPlayerInfoUI PlayerInfoUI { get; set; } = default!;
|
||||
|
||||
[Node] public IUseTeleportPrompt UseTeleportPrompt { get; set; } = default!;
|
||||
|
||||
[Signal]
|
||||
public delegate void MinimapButtonReleasedEventHandler();
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionReleased(GameInputs.MiniMap))
|
||||
{
|
||||
GD.Print("MiniMap button released");
|
||||
EmitSignal(SignalName.MinimapButtonReleased);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowInventoryFullMessage(string rejectedItemName)
|
||||
{
|
||||
PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName);
|
||||
@@ -41,6 +57,7 @@ public partial class InGameUI : Control, IInGameUI
|
||||
|
||||
public void HideMiniMap()
|
||||
{
|
||||
MiniMap.SetProcessUnhandledInput(false);
|
||||
MiniMap.Hide();
|
||||
}
|
||||
|
||||
@@ -52,6 +69,7 @@ public partial class InGameUI : Control, IInGameUI
|
||||
|
||||
public void ShowMiniMap()
|
||||
{
|
||||
MiniMap.Hide();
|
||||
MiniMap.SetProcessUnhandledInput(true);
|
||||
MiniMap.Show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,76 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b1muxus5qdbeu"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://b1muxus5qdbeu"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/ui/in_game_ui/InGameUI.cs" id="1_sc13i"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="2_6sfje"]
|
||||
[ext_resource type="PackedScene" uid="uid://dlj8qdg1c5048" path="res://src/inventory_menu/InventoryMenu.tscn" id="3_4vcdl"]
|
||||
[ext_resource type="PackedScene" uid="uid://dxl8il8f13c2x" path="res://src/ui/player_ui/PlayerInfoUI.tscn" id="4_46s5l"]
|
||||
[ext_resource type="FontFile" uid="uid://cm8j5vcdop5x0" path="res://src/ui/fonts/Mrs-Eaves-OT-Roman_31443.ttf" id="5_pmvvi"]
|
||||
[ext_resource type="Script" path="res://src/ui/in_game_ui/UseTeleportPrompt.cs" id="5_uhl2q"]
|
||||
[ext_resource type="Script" path="res://src/utils/FpsCounter.cs" id="7_c6o8j"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ahhj2"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1tca4"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_crnka"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_yoep7"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cmr8o"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_efhb5"]
|
||||
resource_name = "fade_in"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ibgld"]
|
||||
resource_name = "fade_out"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_xrfau"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7x216"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_xrfau"),
|
||||
"fade_in": SubResource("Animation_efhb5"),
|
||||
"fade_out": SubResource("Animation_ibgld")
|
||||
}
|
||||
|
||||
[node name="InGameUI" type="Control"]
|
||||
process_mode = 3
|
||||
@@ -32,3 +99,80 @@ unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="UseTeleportPrompt" type="Control" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("5_uhl2q")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="UseTeleportPrompt"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="UseTeleportPrompt/CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MovePrompt" type="Label" parent="UseTeleportPrompt/CenterContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_fonts/font = ExtResource("5_pmvvi")
|
||||
theme_override_font_sizes/font_size = 50
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_ahhj2")
|
||||
text = "Move to the next floor?"
|
||||
|
||||
[node name="YesButton" type="Button" parent="UseTeleportPrompt/CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath(".")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../NoButton")
|
||||
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_fonts/font = ExtResource("5_pmvvi")
|
||||
theme_override_font_sizes/font_size = 50
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_1tca4")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_crnka")
|
||||
button_mask = 0
|
||||
text = "Yes"
|
||||
|
||||
[node name="NoButton" type="Button" parent="UseTeleportPrompt/CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath("../YesButton")
|
||||
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_fonts/font = ExtResource("5_pmvvi")
|
||||
theme_override_font_sizes/font_size = 50
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_yoep7")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_cmr8o")
|
||||
button_mask = 0
|
||||
text = "No"
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="UseTeleportPrompt"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_7x216")
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_right = 0.021
|
||||
anchor_bottom = 0.021
|
||||
offset_right = -0.320004
|
||||
offset_bottom = 0.319998
|
||||
script = ExtResource("7_c6o8j")
|
||||
|
||||
29
src/ui/in_game_ui/UseTeleportPrompt.cs
Normal file
29
src/ui/in_game_ui/UseTeleportPrompt.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
public interface IUseTeleportPrompt : IControl;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class UseTeleportPrompt : Control
|
||||
{
|
||||
[Node] public Button YesButton { get; set; } = default!;
|
||||
|
||||
[Node] public Button NoButton { get; set; } = default!;
|
||||
|
||||
[Node] public AnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "fade_in")
|
||||
YesButton.CallDeferred(MethodName.GrabFocus);
|
||||
if (animName == "fade_out")
|
||||
CallDeferred(MethodName.ReleaseFocus);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
|
||||
public interface IPauseMenu : IControl
|
||||
{
|
||||
void FadeIn();
|
||||
void FadeOut();
|
||||
|
||||
event PauseMenu.UnpauseButtonPressedEventHandler UnpauseButtonPressed;
|
||||
event PauseMenu.TransitionCompletedEventHandler TransitionCompleted;
|
||||
}
|
||||
|
||||
@@ -18,10 +19,12 @@ public partial class PauseMenu : Control, IPauseMenu
|
||||
|
||||
[Signal]
|
||||
public delegate void TransitionCompletedEventHandler();
|
||||
[Signal]
|
||||
public delegate void UnpauseButtonPressedEventHandler();
|
||||
|
||||
[Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
public void OnResolved()
|
||||
{
|
||||
AnimationPlayer.AnimationFinished += OnAnimationFinished;
|
||||
}
|
||||
@@ -30,6 +33,13 @@ public partial class PauseMenu : Control, IPauseMenu
|
||||
|
||||
public void FadeOut() => AnimationPlayer.Play("fade_out");
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed(GameInputs.Pause))
|
||||
EmitSignal(SignalName.UnpauseButtonPressed);
|
||||
}
|
||||
|
||||
public void OnAnimationFinished(StringName name)
|
||||
=> EmitSignal(SignalName.TransitionCompleted);
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user