More camera tweaking
This commit is contained in:
+22
-1
@@ -7,15 +7,36 @@ signal quitRequested
|
||||
@export var btnResume:Button
|
||||
@export var btnSettings:Button
|
||||
@export var btnQuit:Button
|
||||
@export var mainButtons:VBoxContainer
|
||||
@export var confirmQuit:VBoxContainer
|
||||
@export var btnQuitConfirm:Button
|
||||
@export var btnQuitCancel:Button
|
||||
|
||||
func _ready() -> void:
|
||||
visible = false
|
||||
btnResume.pressed.connect(resumeRequested.emit)
|
||||
btnSettings.pressed.connect(settingsRequested.emit)
|
||||
btnQuit.pressed.connect(quitRequested.emit)
|
||||
btnQuit.pressed.connect(_showConfirm)
|
||||
btnQuitConfirm.pressed.connect(quitRequested.emit)
|
||||
btnQuitCancel.pressed.connect(cancelConfirm)
|
||||
|
||||
func _showConfirm() -> void:
|
||||
mainButtons.visible = false
|
||||
confirmQuit.visible = true
|
||||
btnQuitCancel.grab_focus()
|
||||
|
||||
func cancelConfirm() -> void:
|
||||
mainButtons.visible = true
|
||||
confirmQuit.visible = false
|
||||
btnQuit.grab_focus()
|
||||
|
||||
func isConfirming() -> bool:
|
||||
return confirmQuit.visible
|
||||
|
||||
func open() -> void:
|
||||
visible = true
|
||||
if isConfirming():
|
||||
cancelConfirm()
|
||||
btnResume.grab_focus()
|
||||
|
||||
func close() -> void:
|
||||
|
||||
+31
-7
@@ -2,7 +2,7 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://c7kvg0jw6w340" path="res://ui/pause/PauseMain.gd" id="1_b5xfl"]
|
||||
|
||||
[node name="PauseMain" type="VBoxContainer" node_paths=PackedStringArray("btnResume", "btnSettings", "btnQuit")]
|
||||
[node name="PauseMain" type="VBoxContainer" node_paths=PackedStringArray("btnResume", "btnSettings", "btnQuit", "mainButtons", "confirmQuit", "btnQuitConfirm", "btnQuitCancel")]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
@@ -12,23 +12,47 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_b5xfl")
|
||||
metadata/_custom_type_script = "uid://c7kvg0jw6w340"
|
||||
btnResume = NodePath("Resume")
|
||||
btnSettings = NodePath("Settings")
|
||||
btnQuit = NodePath("Quit")
|
||||
btnResume = NodePath("MainButtons/Resume")
|
||||
btnSettings = NodePath("MainButtons/Settings")
|
||||
btnQuit = NodePath("MainButtons/Quit")
|
||||
mainButtons = NodePath("MainButtons")
|
||||
confirmQuit = NodePath("ConfirmQuit")
|
||||
btnQuitConfirm = NodePath("ConfirmQuit/Yes")
|
||||
btnQuitCancel = NodePath("ConfirmQuit/No")
|
||||
|
||||
[node name="Title" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
text = "Paused"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Resume" type="Button" parent="."]
|
||||
[node name="MainButtons" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Resume" type="Button" parent="MainButtons"]
|
||||
layout_mode = 2
|
||||
text = "Resume"
|
||||
|
||||
[node name="Settings" type="Button" parent="."]
|
||||
[node name="Settings" type="Button" parent="MainButtons"]
|
||||
layout_mode = 2
|
||||
text = "Settings"
|
||||
|
||||
[node name="Quit" type="Button" parent="."]
|
||||
[node name="Quit" type="Button" parent="MainButtons"]
|
||||
layout_mode = 2
|
||||
text = "Quit Game"
|
||||
|
||||
[node name="ConfirmQuit" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
visible = false
|
||||
|
||||
[node name="Label" type="Label" parent="ConfirmQuit"]
|
||||
layout_mode = 2
|
||||
text = "Quit to desktop?"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Yes" type="Button" parent="ConfirmQuit"]
|
||||
layout_mode = 2
|
||||
text = "Yes"
|
||||
|
||||
[node name="No" type="Button" parent="ConfirmQuit"]
|
||||
layout_mode = 2
|
||||
text = "No"
|
||||
|
||||
@@ -31,7 +31,9 @@ func _unhandled_input(event:InputEvent) -> void:
|
||||
if !visible:
|
||||
return
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
if settingsPanel.isOpen():
|
||||
if MAIN.isConfirming():
|
||||
MAIN.cancelConfirm()
|
||||
elif settingsPanel.isOpen():
|
||||
settingsPanel.close()
|
||||
MAIN.open()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user