From 78180afff0034802c17649a6fa7f37b7cfc849d4 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 19 Mar 2020 21:15:07 +0100 Subject: [PATCH] Improved the character selection and creation menu a bit by giving more info. Also fixed a bug. --- game/menu/CharacterEntry.gd | 9 +++++---- game/menu/CharacterEntry.tscn | 22 ++++++++++++++++------ game/scenes/CharacterCreationMenu.gd | 4 +++- game/scenes/CharacterSelectorMenu.gd | 5 +++-- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/game/menu/CharacterEntry.gd b/game/menu/CharacterEntry.gd index 0328da2c..a862ea79 100644 --- a/game/menu/CharacterEntry.gd +++ b/game/menu/CharacterEntry.gd @@ -37,12 +37,13 @@ func _ready(): 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 name_label.text = name - class_label.text = cls_name + class_label.text = cls_name + " (lvl " + str(class_level) + ')' level_label.text = str(level) entity = pentity -func set_class_name(name : String) -> void: - class_label.text = name +func set_class_name(name : String, level : int) -> void: + name_label.text = name + level_label.text = str(level) diff --git a/game/menu/CharacterEntry.tscn b/game/menu/CharacterEntry.tscn index 54ca93dd..46cec91d 100644 --- a/game/menu/CharacterEntry.tscn +++ b/game/menu/CharacterEntry.tscn @@ -16,7 +16,7 @@ __meta__ = { } name_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/name") 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="."] anchor_right = 1.0 @@ -60,22 +60,32 @@ custom_constants/margin_left = 5 custom_constants/margin_bottom = 5 [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] -margin_left = 76.0 +margin_left = 72.0 margin_right = 214.0 margin_bottom = 78.0 mouse_filter = 2 size_flags_horizontal = 3 [node name="name" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] -margin_right = 138.0 +margin_right = 142.0 margin_bottom = 15.0 [node name="class" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] margin_top = 23.0 -margin_right = 138.0 +margin_right = 142.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_right = 138.0 +margin_right = 142.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 diff --git a/game/scenes/CharacterCreationMenu.gd b/game/scenes/CharacterCreationMenu.gd index 298973dc..f475dc92 100644 --- a/game/scenes/CharacterCreationMenu.gd +++ b/game/scenes/CharacterCreationMenu.gd @@ -34,6 +34,8 @@ func _ready(): name_line_edit = get_node(name_imput_path) container = get_node(container_path) + var profile : PlayerProfile = ProfileManager.getc_player_profile() + var fb : Button = null for i in range(EntityDataManager.get_player_character_data_count()): @@ -48,7 +50,7 @@ func _ready(): ce.owner = container 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 if fb != null: diff --git a/game/scenes/CharacterSelectorMenu.gd b/game/scenes/CharacterSelectorMenu.gd index 020a67da..3795de6d 100644 --- a/game/scenes/CharacterSelectorMenu.gd +++ b/game/scenes/CharacterSelectorMenu.gd @@ -90,7 +90,8 @@ func refresh(): centry.group = character_button_group 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: first_entry = centry @@ -159,4 +160,4 @@ func character_selection_changed() -> void: for e in player_display_container_node.get_children(): e.get_body().hide() - b.entity.show() + b.entity.get_body().show()