Files
imnotsick/ui.gd
T
2025-06-12 22:23:52 +02:00

60 lines
1.8 KiB
GDScript

extends CanvasLayer
@onready var next = $UI/SkipContainer/NextButton
@onready var confirmation_dialog = $UI/PanelContainer
@onready var confirmation_text = $UI/PanelContainer/MarginContainer/VBoxContainer/ConfirmationText
@onready var confirmation_yes = $UI/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer/YesButton
@onready var confirmation_no = $UI/PanelContainer/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer/NoButton
signal next_request
signal next_slide
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
#Connecting signals
next.pressed.connect(_on_next_pressed)
self.connect("next_request", _on_next_request)
#Setting up the Confirmation Dialog
confirmation_yes.text = ("YES")
confirmation_no.text = ("NO")
UI.confirmation_yes.pressed.connect(func(): UI.confirmation_dialog.hide())
UI.confirmation_yes.pressed.connect(func(): TransitionScreen.mask.visible = false)
UI.confirmation_no.pressed.connect(func(): UI.confirmation_dialog.hide())
UI.confirmation_no.pressed.connect(func(): TransitionScreen.mask.visible = false)
#Hiding everything at start
#self.hide()
confirmation_dialog.hide()
self.get_node("UI/UpperContainer").hide()
self.get_node("UI/SkipContainer").hide()
#Requests next when the Next Button is pressed
func _on_next_pressed():
next_request.emit()
#Requests next when the space key is pressed
func _input(event):
if event is InputEventKey and event.is_action_released("ui_accept"):
next_request.emit()
#Makes sure fading transitions are done before approving a next request
func _on_next_request():
if Globals.is_transitioning == false:
next_slide.emit()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass