frame-of-mind/src/logic-scenes/main menu/content_settings.gd

49 lines
1.3 KiB
GDScript3
Raw Normal View History

extends VBoxContainer
signal changed
2024-10-07 09:16:18 +00:00
signal leave_stage
var has_stage:bool = false:
set(stage):
has_stage = stage
2024-10-07 09:16:18 +00:00
if is_node_ready() and has_stage:
%ExpandButton.grab_focus()
@export var is_in_beginning: bool = false
var current_music_decay:float = 0
@onready var expand_button: Button = %ExpandButton
@onready var content_note_box: CheckBox = %ContentNoteButton
@onready var allow_skip_button: CheckBox = %AllowSkipButton
func _ready() -> void:
if is_in_beginning:
%SaveButton.text = "save and continue"
else:
%SaveButton.text = "save and exit"
update_ui_from_state()
content_note_box.pressed.connect(func(value): State.show_content_notes = value)
allow_skip_button.pressed.connect(func(value): State.allow_skipping = value)
%SaveButton.pressed.connect(_on_exit_button_pressed)
%ExpandButton.pressed.connect(
func():
%Reveal.play("reveal")
%ExpandButton.disabled = true
)
func update_ui_from_state():
content_note_box.button_pressed = State.show_content_notes
allow_skip_button.button_pressed = State.allow_skipping
func _on_exit_button_pressed() -> void:
2024-10-07 09:16:18 +00:00
leave_stage.emit()
State.save_settings()
State.leave_stage(self)
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel") and has_stage:
State.leave_stage(self)