Improved the character selection and creation menu a bit by giving more info. Also fixed a bug.

This commit is contained in:
Relintai 2020-03-19 21:15:07 +01:00
parent a40af5d0aa
commit 78180afff0
4 changed files with 27 additions and 13 deletions

View File

@ -37,12 +37,13 @@ func _ready():
level_label = get_node(level_label_path) as Label level_label = get_node(level_label_path) as Label
func setup(pfile_name : String, name : String, cls_name : String, level : int, pentity : Entity) -> void: func setup(pfile_name : String, name : String, cls_name : String, level : int, class_level : int, pentity : Entity) -> void:
file_name = pfile_name file_name = pfile_name
name_label.text = name name_label.text = name
class_label.text = cls_name class_label.text = cls_name + " (lvl " + str(class_level) + ')'
level_label.text = str(level) level_label.text = str(level)
entity = pentity entity = pentity
func set_class_name(name : String) -> void: func set_class_name(name : String, level : int) -> void:
class_label.text = name name_label.text = name
level_label.text = str(level)

View File

@ -16,7 +16,7 @@ __meta__ = {
} }
name_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/name") name_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/name")
class_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/class") class_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/class")
level_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/level") level_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/level")
[node name="MarginContainer" type="MarginContainer" parent="."] [node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0 anchor_right = 1.0
@ -60,22 +60,32 @@ custom_constants/margin_left = 5
custom_constants/margin_bottom = 5 custom_constants/margin_bottom = 5
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
margin_left = 76.0 margin_left = 72.0
margin_right = 214.0 margin_right = 214.0
margin_bottom = 78.0 margin_bottom = 78.0
mouse_filter = 2 mouse_filter = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="name" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] [node name="name" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"]
margin_right = 138.0 margin_right = 142.0
margin_bottom = 15.0 margin_bottom = 15.0
[node name="class" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] [node name="class" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"]
margin_top = 23.0 margin_top = 23.0
margin_right = 138.0 margin_right = 142.0
margin_bottom = 38.0 margin_bottom = 38.0
[node name="level" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/HBoxContainer/VBoxContainer"]
margin_top = 46.0 margin_top = 46.0
margin_right = 138.0 margin_right = 142.0
margin_bottom = 61.0 margin_bottom = 61.0
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
margin_right = 36.0
margin_bottom = 15.0
text = "Level "
[node name="level" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
margin_left = 40.0
margin_right = 40.0
margin_bottom = 15.0

View File

@ -34,6 +34,8 @@ func _ready():
name_line_edit = get_node(name_imput_path) name_line_edit = get_node(name_imput_path)
container = get_node(container_path) container = get_node(container_path)
var profile : PlayerProfile = ProfileManager.getc_player_profile()
var fb : Button = null var fb : Button = null
for i in range(EntityDataManager.get_player_character_data_count()): for i in range(EntityDataManager.get_player_character_data_count()):
@ -48,7 +50,7 @@ func _ready():
ce.owner = container ce.owner = container
ce.id = d.id ce.id = d.id
ce.set_class_name(d.entity_class_data.text_name) ce.set_class_name(d.entity_class_data.text_name, profile.get_class_profile(d.id).class_id)
ce.group = character_creation_button_group ce.group = character_creation_button_group
if fb != null: if fb != null:

View File

@ -90,7 +90,8 @@ func refresh():
centry.group = character_button_group centry.group = character_button_group
centry.connect("pressed", self, "character_selection_changed") centry.connect("pressed", self, "character_selection_changed")
centry.setup(file_name, display.sentity_name, "", display.scharacter_level, display)
centry.setup(file_name, display.sentity_name, EntityDataManager.get_player_character_data(display.characterclass_id).text_name, display.scharacter_level, display.sclass_level, display)
if first_entry == null: if first_entry == null:
first_entry = centry first_entry = centry
@ -159,4 +160,4 @@ func character_selection_changed() -> void:
for e in player_display_container_node.get_children(): for e in player_display_container_node.get_children():
e.get_body().hide() e.get_body().hide()
b.entity.show() b.entity.get_body().show()