hotel-madness/scripts/ui/settings.gd

17 lines
820 B
GDScript3
Raw Permalink Normal View History

extends Control
func _ready() -> void:
($VBoxContainer/DefaultServerIP/LineEdit as LineEdit).text = Game.ip
($VBoxContainer/DefaultUsername/LineEdit as LineEdit).text = Game.username
($VBoxContainer/DefaultRoomname/LineEdit as LineEdit).text = Game.roomname
if ($VBoxContainer/Return as Button).pressed.connect(_on_return_clicked):
pass
func _on_return_clicked() -> void:
Game.ip = ($VBoxContainer/DefaultServerIP/LineEdit as LineEdit).text
Game.username = ($VBoxContainer/DefaultUsername/LineEdit as LineEdit).text
Game.roomname = ($VBoxContainer/DefaultRoomname/LineEdit as LineEdit).text
Game.save_settings()
if get_tree().change_scene_to_file("res://scenes/ui/main_menu.tscn") != OK:
Log.error("Couldn't change to the main menu scene! Closing application.", "Couldn't change to the main menu scene!")