fix: ironed out kinks in ingame menu

This commit is contained in:
Jakob Feldmann 2023-07-18 19:10:24 +02:00
parent 2c1d847ff5
commit 1836d73805
12 changed files with 89 additions and 81 deletions

View File

@ -1,8 +1,8 @@
[gd_resource type="DynamicFont" load_steps=2 format=2] [gd_resource type="DynamicFont" load_steps=2 format=2]
[sub_resource type="DynamicFontData" id=1] [sub_resource type="DynamicFontData" id=12]
font_path = "res://assets/ui/fonts/Kenney Thick.ttf" font_path = "res://assets/ui/fonts/Kenney Thick.ttf"
[resource] [resource]
size = 8 size = 8
font_data = SubResource( 1 ) font_data = SubResource( 12 )

View File

@ -33,9 +33,6 @@ unique_name_in_owner = true
[node name="UserInterface" parent="." instance=ExtResource( 5 )] [node name="UserInterface" parent="." instance=ExtResource( 5 )]
unique_name_in_owner = true unique_name_in_owner = true
[node name="HUD" parent="UserInterface" index="0"]
visible = false
[node name="Timer" parent="UserInterface/HUD/HUDOverlay/GetBackTimer" index="0"] [node name="Timer" parent="UserInterface/HUD/HUDOverlay/GetBackTimer" index="0"]
wait_time = 20.0 wait_time = 20.0
@ -44,11 +41,8 @@ physics_interpolation_mode = 2
unique_name_in_owner = true unique_name_in_owner = true
process_mode = 1 process_mode = 1
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
frame = 1
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"] [node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
frame = 0 frame = 3
[node name="Blobby" parent="." instance=ExtResource( 7 )] [node name="Blobby" parent="." instance=ExtResource( 7 )]
unique_name_in_owner = true unique_name_in_owner = true

File diff suppressed because one or more lines are too long

View File

@ -14,12 +14,11 @@ func _ready() -> void:
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
# TODO Static quit button esc # TODO Static quit button esc
if !event.is_action("ui_cancel"): if !event.is_action("ui_cancel") || !self.visible:
return return
if block_ui_cancel: if block_ui_cancel:
block_ui_cancel = false block_ui_cancel = false
return return
get_tree().set_input_as_handled()
$"%Back"._on_button_up() $"%Back"._on_button_up()
func rebuild(input_profile): func rebuild(input_profile):

View File

@ -22,11 +22,10 @@ func _on_GlobalState_player_died() -> void:
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:
# TODO don't match for specific text... why did i even consider that... did I pull that from the tutorial??? # TODO don't match for specific text... why did i even consider that... did I pull that from the tutorial???
if event.is_action_pressed("pause") && pause_title.text != "You lost" && !$ControlsMenu.visible: if event.is_action_released("pause") && pause_title.text != "You lost" && !$ControlsMenu.visible:
#not oder ! schaltet einen boolean um #not oder ! schaltet einen boolean um
#Ist self hier notwendig? #Ist self hier notwendig?
self.paused = not paused self.paused = not paused
get_tree().set_input_as_handled()
func set_paused(value: bool) -> void: func set_paused(value: bool) -> void:

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=30 format=2] [gd_scene load_steps=32 format=2]
[ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=1] [ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=1]
[ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=2] [ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=2]
@ -32,13 +32,20 @@ shader = ExtResource( 7 )
shader_param/transparency = 0.1 shader_param/transparency = 0.1
[sub_resource type="DynamicFont" id=10] [sub_resource type="DynamicFont" id=10]
size = 10 size = 9
font_data = ExtResource( 18 ) font_data = ExtResource( 18 )
[sub_resource type="DynamicFont" id=11] [sub_resource type="DynamicFont" id=11]
size = 10 size = 9
font_data = ExtResource( 18 ) font_data = ExtResource( 18 )
[sub_resource type="DynamicFontData" id=12]
font_path = "res://assets/ui/fonts/Kenney Thick.ttf"
[sub_resource type="DynamicFont" id=13]
size = 9
font_data = SubResource( 12 )
[sub_resource type="ShaderMaterial" id=8] [sub_resource type="ShaderMaterial" id=8]
shader = ExtResource( 7 ) shader = ExtResource( 7 )
shader_param/transparency = 0.778 shader_param/transparency = 0.778
@ -146,12 +153,12 @@ grow_vertical = 2
[node name="Headers" type="HBoxContainer" parent="ControlsMenu/Panel/KeymapViewer"] [node name="Headers" type="HBoxContainer" parent="ControlsMenu/Panel/KeymapViewer"]
margin_right = 599.0 margin_right = 599.0
margin_bottom = 12.0 margin_bottom = 11.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="Action" type="Label" parent="ControlsMenu/Panel/KeymapViewer/Headers"] [node name="Action" type="Label" parent="ControlsMenu/Panel/KeymapViewer/Headers"]
margin_right = 264.0 margin_right = 267.0
margin_bottom = 12.0 margin_bottom = 11.0
grow_horizontal = 2 grow_horizontal = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 0 size_flags_vertical = 0
@ -160,9 +167,9 @@ text = "Action"
valign = 1 valign = 1
[node name="Control" type="Label" parent="ControlsMenu/Panel/KeymapViewer/Headers"] [node name="Control" type="Label" parent="ControlsMenu/Panel/KeymapViewer/Headers"]
margin_left = 268.0 margin_left = 271.0
margin_right = 330.0 margin_right = 327.0
margin_bottom = 12.0 margin_bottom = 11.0
grow_horizontal = 2 grow_horizontal = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
size_flags_vertical = 0 size_flags_vertical = 0
@ -172,19 +179,19 @@ align = 1
valign = 1 valign = 1
[node name="Change" type="Label" parent="ControlsMenu/Panel/KeymapViewer/Headers"] [node name="Change" type="Label" parent="ControlsMenu/Panel/KeymapViewer/Headers"]
margin_left = 334.0 margin_left = 331.0
margin_right = 599.0 margin_right = 599.0
margin_bottom = 9.0 margin_bottom = 11.0
grow_horizontal = 2 grow_horizontal = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 0 size_flags_vertical = 0
custom_fonts/font = ExtResource( 19 ) custom_fonts/font = SubResource( 13 )
text = "Edit" text = "Edit"
align = 2 align = 2
valign = 1 valign = 1
[node name="ScrollContainer" type="ScrollContainer" parent="ControlsMenu/Panel/KeymapViewer"] [node name="ScrollContainer" type="ScrollContainer" parent="ControlsMenu/Panel/KeymapViewer"]
margin_top = 16.0 margin_top = 15.0
margin_right = 599.0 margin_right = 599.0
margin_bottom = 229.0 margin_bottom = 229.0
focus_neighbour_top = NodePath("../../ProfilesMenu") focus_neighbour_top = NodePath("../../ProfilesMenu")
@ -197,7 +204,7 @@ follow_focus = true
[node name="ActionKeyList" type="VBoxContainer" parent="ControlsMenu/Panel/KeymapViewer/ScrollContainer"] [node name="ActionKeyList" type="VBoxContainer" parent="ControlsMenu/Panel/KeymapViewer/ScrollContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_right = 599.0 margin_right = 599.0
margin_bottom = 213.0 margin_bottom = 214.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
script = ExtResource( 9 ) script = ExtResource( 9 )
@ -205,12 +212,17 @@ script = ExtResource( 9 )
[node name="Back" type="Button" parent="ControlsMenu/Panel"] [node name="Back" type="Button" parent="ControlsMenu/Panel"]
unique_name_in_owner = true unique_name_in_owner = true
anchor_left = 0.05 anchor_left = 0.05
anchor_top = 0.95 anchor_top = 0.934
anchor_right = 0.05 anchor_right = 0.05
anchor_bottom = 0.95 anchor_bottom = 0.95
margin_left = -21.0
margin_top = -12.0
margin_right = 55.0
margin_bottom = 8.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
rect_min_size = Vector2( 40, 20 ) rect_min_size = Vector2( 40, 20 )
rect_pivot_offset = Vector2( 1039.7, 245.35 )
focus_neighbour_left = NodePath("../Save") focus_neighbour_left = NodePath("../Save")
focus_neighbour_top = NodePath("../KeymapViewer/ScrollContainer") focus_neighbour_top = NodePath("../KeymapViewer/ScrollContainer")
focus_neighbour_right = NodePath("../Reset") focus_neighbour_right = NodePath("../Reset")
@ -234,6 +246,7 @@ margin_bottom = 8.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
rect_min_size = Vector2( 40, 20 ) rect_min_size = Vector2( 40, 20 )
rect_pivot_offset = Vector2( 826, -79.65 )
focus_neighbour_left = NodePath("../Back") focus_neighbour_left = NodePath("../Back")
focus_neighbour_top = NodePath("../KeymapViewer/ScrollContainer") focus_neighbour_top = NodePath("../KeymapViewer/ScrollContainer")
focus_neighbour_right = NodePath("../Save") focus_neighbour_right = NodePath("../Save")
@ -250,6 +263,10 @@ anchor_left = 0.95
anchor_top = 0.95 anchor_top = 0.95
anchor_right = 0.95 anchor_right = 0.95
anchor_bottom = 0.95 anchor_bottom = 0.95
margin_left = -59.0
margin_top = -17.0
margin_right = 16.0
margin_bottom = 8.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
rect_min_size = Vector2( 40, 20 ) rect_min_size = Vector2( 40, 20 )
@ -328,15 +345,15 @@ anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
margin_left = -334.0 margin_left = -334.5
margin_top = -26.0 margin_top = -27.5
margin_right = 335.0 margin_right = 334.5
margin_bottom = 26.0 margin_bottom = 27.5
grow_horizontal = 2 grow_horizontal = 2
mouse_filter = 0 mouse_filter = 0
size_flags_horizontal = 0 size_flags_horizontal = 0
size_flags_vertical = 0 size_flags_vertical = 0
custom_fonts/font = SubResource( 7 ) custom_fonts/font = ExtResource( 19 )
text = "Unsaved changes were made. text = "Unsaved changes were made.
Go back anyway?" Go back anyway?"
align = 1 align = 1
@ -344,12 +361,13 @@ valign = 1
[node name="VBoxContainer" type="VBoxContainer" parent="ControlsMenu/ReallyQuitMenu"] [node name="VBoxContainer" type="VBoxContainer" parent="ControlsMenu/ReallyQuitMenu"]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.85 anchor_top = 1.0
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.85 anchor_bottom = 1.0
margin_left = -50.5 margin_left = -79.0
margin_top = -67.0 margin_top = -124.0
margin_right = 50.5 margin_right = 79.0
margin_bottom = -55.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 0 mouse_filter = 0
@ -359,8 +377,9 @@ size_flags_vertical = 0
alignment = 1 alignment = 1
[node name="SaveNQuit" type="Button" parent="ControlsMenu/ReallyQuitMenu/VBoxContainer"] [node name="SaveNQuit" type="Button" parent="ControlsMenu/ReallyQuitMenu/VBoxContainer"]
margin_right = 156.0 unique_name_in_owner = true
margin_bottom = 27.0 margin_right = 158.0
margin_bottom = 20.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
rect_min_size = Vector2( 40, 20 ) rect_min_size = Vector2( 40, 20 )
@ -369,14 +388,16 @@ focus_neighbour_bottom = NodePath("../ContinueEdit")
input_pass_on_modal_close_click = false input_pass_on_modal_close_click = false
size_flags_horizontal = 7 size_flags_horizontal = 7
size_flags_vertical = 4 size_flags_vertical = 4
custom_fonts/font = ExtResource( 19 )
text = "Save And Quit" text = "Save And Quit"
icon_align = 1 icon_align = 1
script = ExtResource( 11 ) script = ExtResource( 11 )
[node name="ContinueEdit" type="Button" parent="ControlsMenu/ReallyQuitMenu/VBoxContainer"] [node name="ContinueEdit" type="Button" parent="ControlsMenu/ReallyQuitMenu/VBoxContainer"]
margin_top = 31.0 unique_name_in_owner = true
margin_right = 156.0 margin_top = 24.0
margin_bottom = 58.0 margin_right = 158.0
margin_bottom = 45.0
focus_neighbour_left = NodePath(".") focus_neighbour_left = NodePath(".")
focus_neighbour_top = NodePath("../SaveNQuit") focus_neighbour_top = NodePath("../SaveNQuit")
focus_neighbour_right = NodePath(".") focus_neighbour_right = NodePath(".")
@ -386,12 +407,14 @@ focus_previous = NodePath(".")
input_pass_on_modal_close_click = false input_pass_on_modal_close_click = false
size_flags_horizontal = 7 size_flags_horizontal = 7
size_flags_vertical = 7 size_flags_vertical = 7
custom_fonts/font = ExtResource( 19 )
text = "Continue Editing" text = "Continue Editing"
[node name="QuitDontSave" type="Button" parent="ControlsMenu/ReallyQuitMenu/VBoxContainer"] [node name="QuitDontSave" type="Button" parent="ControlsMenu/ReallyQuitMenu/VBoxContainer"]
margin_top = 62.0 unique_name_in_owner = true
margin_right = 156.0 margin_top = 49.0
margin_bottom = 89.0 margin_right = 158.0
margin_bottom = 69.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
rect_min_size = Vector2( 40, 20 ) rect_min_size = Vector2( 40, 20 )
@ -400,6 +423,7 @@ focus_neighbour_bottom = NodePath("../SaveNQuit")
input_pass_on_modal_close_click = false input_pass_on_modal_close_click = false
size_flags_horizontal = 7 size_flags_horizontal = 7
size_flags_vertical = 4 size_flags_vertical = 4
custom_fonts/font = ExtResource( 19 )
text = "Quit Don't Save" text = "Quit Don't Save"
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="ControlsMenu"] [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="ControlsMenu"]

View File

@ -12,7 +12,10 @@ func _on_button_up() -> void:
func was_saved_now_quit() -> void: func was_saved_now_quit() -> void:
$"%ReallyQuitMenu".close() $"%ReallyQuitMenu".close()
$"%ControlsMenu".changes_made = false
$"%ControlsMenu".changes_saved = true
$"%ControlsMenu".close() $"%ControlsMenu".close()
$"%Continue".grab_focus()
func _get_configuration_warning() -> String: func _get_configuration_warning() -> String:
return "next_scene_path must be set for the button to work" if next_screen_path == "" else "" return "next_scene_path must be set for the button to work" if next_screen_path == "" else ""

View File

@ -3,6 +3,7 @@ extends Button
func _on_button_up() -> void: func _on_button_up() -> void:
if(!$"../..".changes_made || $"../..".changes_saved): if(!$"../..".changes_made || $"../..".changes_saved):
$"%ControlsMenu".close() $"%ControlsMenu".close()
get_tree().set_input_as_handled()
else: else:
set_process_input(false) set_process_input(false)
$"%ReallyQuitMenu".open() $"%ReallyQuitMenu".open()

View File

@ -15,12 +15,11 @@ func _ready():
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
# TODO Static quit button esc # TODO Static quit button esc
if !event.is_action("ui_cancel"): if !event.is_action("ui_cancel") || !visible:
return return
if block_ui_cancel: if block_ui_cancel:
block_ui_cancel = false block_ui_cancel = false
return return
get_tree().set_input_as_handled()
$"%Back"._on_button_up() $"%Back"._on_button_up()
func rebuild(input_profile): func rebuild(input_profile):

View File

@ -336,16 +336,7 @@ focus_mode = 2
input_pass_on_modal_close_click = false input_pass_on_modal_close_click = false
script = ExtResource( 6 ) script = ExtResource( 6 )
[node name="Panel" type="Panel" parent="ReallyQuitMenu"] [node name="Prompt" type="Label" parent="ReallyQuitMenu"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -78.0
margin_right = 78.0
theme = ExtResource( 20 )
[node name="Prompt" type="Label" parent="ReallyQuitMenu/Panel"]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
@ -364,13 +355,13 @@ text = "Unsaved changes were made.
align = 1 align = 1
valign = 1 valign = 1
[node name="VBoxContainer" type="VBoxContainer" parent="ReallyQuitMenu/Panel"] [node name="VBoxContainer" type="VBoxContainer" parent="ReallyQuitMenu"]
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
margin_left = -78.0 margin_left = -78.0
margin_top = 81.0 margin_top = 228.0
margin_right = 78.0 margin_right = 78.0
margin_bottom = 82.0 margin_bottom = 295.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 0 mouse_filter = 0
@ -379,7 +370,7 @@ size_flags_horizontal = 0
size_flags_vertical = 0 size_flags_vertical = 0
alignment = 1 alignment = 1
[node name="SaveNQuit" type="Button" parent="ReallyQuitMenu/Panel/VBoxContainer"] [node name="SaveNQuit" type="Button" parent="ReallyQuitMenu/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_right = 156.0 margin_right = 156.0
margin_bottom = 20.0 margin_bottom = 20.0
@ -397,7 +388,7 @@ icon_align = 1
script = ExtResource( 4 ) script = ExtResource( 4 )
next_screen_path = "res://src/UserInterface/Screens/MainMenu/MainScreen.tscn" next_screen_path = "res://src/UserInterface/Screens/MainMenu/MainScreen.tscn"
[node name="ContinueEdit" type="Button" parent="ReallyQuitMenu/Panel/VBoxContainer"] [node name="ContinueEdit" type="Button" parent="ReallyQuitMenu/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_top = 24.0 margin_top = 24.0
margin_right = 156.0 margin_right = 156.0
@ -414,7 +405,7 @@ input_pass_on_modal_close_click = false
size_flags_vertical = 5 size_flags_vertical = 5
text = "Continue Editing" text = "Continue Editing"
[node name="QuitDontSave" type="Button" parent="ReallyQuitMenu/Panel/VBoxContainer"] [node name="QuitDontSave" type="Button" parent="ReallyQuitMenu/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_top = 47.0 margin_top = 47.0
margin_right = 156.0 margin_right = 156.0
@ -442,6 +433,6 @@ bus = "Music"
[connection signal="button_up" from="Panel/Save" to="Panel/Save" method="_on_button_up"] [connection signal="button_up" from="Panel/Save" to="Panel/Save" method="_on_button_up"]
[connection signal="focus_entered" from="Panel/KeymapViewer/ScrollContainer" to="Panel/KeymapViewer/ScrollContainer" method="_on_focus_entered"] [connection signal="focus_entered" from="Panel/KeymapViewer/ScrollContainer" to="Panel/KeymapViewer/ScrollContainer" method="_on_focus_entered"]
[connection signal="timeout" from="KeySelectMenu/Timer" to="KeySelectMenu" method="close_on_timeout"] [connection signal="timeout" from="KeySelectMenu/Timer" to="KeySelectMenu" method="close_on_timeout"]
[connection signal="button_up" from="ReallyQuitMenu/Panel/VBoxContainer/SaveNQuit" to="ReallyQuitMenu/Panel/VBoxContainer/SaveNQuit" method="_on_button_up"] [connection signal="button_up" from="ReallyQuitMenu/VBoxContainer/SaveNQuit" to="ReallyQuitMenu/VBoxContainer/SaveNQuit" method="_on_button_up"]
[connection signal="button_up" from="ReallyQuitMenu/Panel/VBoxContainer/ContinueEdit" to="ReallyQuitMenu" method="close"] [connection signal="button_up" from="ReallyQuitMenu/VBoxContainer/ContinueEdit" to="ReallyQuitMenu" method="close"]
[connection signal="button_up" from="ReallyQuitMenu/Panel/VBoxContainer/QuitDontSave" to="ReallyQuitMenu/Panel/VBoxContainer/QuitDontSave" method="_on_button_up"] [connection signal="button_up" from="ReallyQuitMenu/VBoxContainer/QuitDontSave" to="ReallyQuitMenu/VBoxContainer/QuitDontSave" method="_on_button_up"]

View File

@ -3,7 +3,7 @@ extends Panel
var prev_focus var prev_focus
func open(): func open():
show() visible = true
prev_focus = get_focus_owner() prev_focus = get_focus_owner()
mitigate_ui_navigation_spill_over(true) mitigate_ui_navigation_spill_over(true)
$"%SaveNQuit".grab_focus() $"%SaveNQuit".grab_focus()
@ -18,7 +18,7 @@ func mitigate_ui_navigation_spill_over(var value: bool):
line.get_node("ChangeButton").focus_mode = mode line.get_node("ChangeButton").focus_mode = mode
func close(): func close():
hide() visible = false
mitigate_ui_navigation_spill_over(false) mitigate_ui_navigation_spill_over(false)
self.release_focus() self.release_focus()
prev_focus.grab_focus() prev_focus.grab_focus()

View File

@ -1,7 +1,7 @@
extends Button extends Button
onready var mapper := $"%InputMapper" onready var mapper := $"%InputMapper"
onready var controllsMenu := get_tree().get_current_scene() onready var controllsMenu := $"../.."
func _on_button_up() -> void: func _on_button_up() -> void:
mapper.commit_to_changes() mapper.commit_to_changes()