Added serving of the customers, npc exits, main menu, settings, saving and loading.

This commit is contained in:
Patrick 2024-12-20 19:51:46 +01:00
parent 3d1e6caa29
commit 2b6d1faadb
19 changed files with 360 additions and 39 deletions

View file

@ -4,6 +4,8 @@
extends Control
func _ready() -> void:
($VBoxContainer/UsernameHBox/LineEdit as LineEdit).text = Game.username
($VBoxContainer/RoomnameHBox/LineEdit as LineEdit).text = Game.roomname
if ($VBoxContainer/SendButton as Button).pressed.connect(_on_send_button_pressed):
pass

15
scripts/ui/main_menu.gd Normal file
View file

@ -0,0 +1,15 @@
extends Control
func _ready() -> void:
if ($VBoxContainer/Join as Button).pressed.connect(_on_join_clicked):
pass
if ($VBoxContainer/Settings as Button).pressed.connect(_on_settings_clicked):
pass
func _on_join_clicked() -> void:
if get_tree().change_scene_to_file("res://scenes/ui/create_room.tscn") != OK:
Log.error("Couldn't change to the create room scene! Closing application.", "Couldn't change to the create room scene!")
func _on_settings_clicked() -> void:
if get_tree().change_scene_to_file("res://scenes/ui/settings.tscn") != OK:
Log.error("Couldn't change to the settings scene! Closing application.", "Couldn't change to the settings scene!")

16
scripts/ui/settings.gd Normal file
View file

@ -0,0 +1,16 @@
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!")