stick-the-quick/ui/MainMenu/About/MainMenu_About.gd

50 lines
1.4 KiB
GDScript3
Raw Normal View History

class_name MainMenu_About extends Control
@onready var _license_button := (
$'PanelContainer/VBoxContainer/LicenseButton'
) as Button
@onready var _acknowledgements_button := (
$'PanelContainer/VBoxContainer/AcknowledgementsButton'
) as Button
@onready var _back_button := (
$'PanelContainer/VBoxContainer/BackButton'
) as Button
func _ready() -> void:
_license_button.pressed.connect(_license)
_acknowledgements_button.pressed.connect(_acknowledgements)
_back_button.pressed.connect(_back)
func _license() -> void:
UI.Call(load("res://ui/Notice.tscn"))
var notice := UI.context() as Control
notice.get_node(
^"CenterContainer/PanelContainer"
).add_theme_stylebox_override(&'panel', load(
"res://ui/Conversation/ConversationStyleBox.tres"
))
notice.add_selectable(FileAccess.get_file_as_string("res://LICENSE.txt"))
func _acknowledgements() -> void:
var old_process_mode := process_mode
var old_music := FX.get_bgm() as AudioStream
process_mode = PROCESS_MODE_DISABLED
var fade_task := func() -> void:
await FX.fade(Color.BLACK)
var music_task := func() -> void:
await FX.stop_bgm()
await Promise.new([fade_task, music_task]).join()
var menu_task := func() -> void:
await UI.Call(load(
"res://ui/MainMenu/About/About_Acknowledgements.tscn"
))
var p := Promise.new(menu_task)
await FX.fade()
await p.join()
process_mode = old_process_mode
if old_music:
FX.play_bgm(old_music)
func _back() -> void:
UI.Return(self)