fixed saving & added first basic save creation menu
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
extends Control
|
||||
|
||||
|
||||
@onready var tab_container: TabContainer = $TabContainer
|
||||
|
||||
func _on_start_button_pressed() -> void:
|
||||
pass # Replace with function body.
|
||||
tab_container.current_tab = 1
|
||||
|
||||
func _on_profile_creator_exit() -> void:
|
||||
tab_container.current_tab = 0
|
||||
|
||||
@@ -1 +1,45 @@
|
||||
extends Control
|
||||
|
||||
signal exit
|
||||
|
||||
var profile: Profile = Profile.new("profile")
|
||||
@onready var next: Button = $VBoxContainer/HBoxContainer/Next
|
||||
@onready var line_edit: LineEdit = $VBoxContainer/LineEdit
|
||||
|
||||
@onready var max_index: int = profile.named_things.keys().size() - 1
|
||||
var index: int = 0
|
||||
|
||||
func _ready() -> void:
|
||||
next.disabled = index == max_index
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
if index == 0:
|
||||
exit.emit()
|
||||
else:
|
||||
index -= 1
|
||||
update_name()
|
||||
|
||||
func _on_next_pressed() -> void:
|
||||
index += 1
|
||||
update_name()
|
||||
|
||||
func update_name() -> void:
|
||||
if index == max_index:
|
||||
next.text = "Finish"
|
||||
elif index > max_index:
|
||||
profile.save()
|
||||
index = max_index
|
||||
return
|
||||
else:
|
||||
next.text = "Next"
|
||||
|
||||
var labels: Dictionary = {
|
||||
"player_name": "Name him",
|
||||
"villain_friend": "Name him too",
|
||||
"stupid_friend": "And also name him",
|
||||
"favourite_candy": "Favourite candy?"
|
||||
}
|
||||
|
||||
var label: String = labels[profile.named_things.keys()[index]]
|
||||
line_edit.placeholder_text = label
|
||||
|
||||
|
||||
Reference in New Issue
Block a user