Update the talent window to use the new class interfaces.

This commit is contained in:
Relintai 2020-07-25 23:26:22 +02:00
parent 5f53e390b9
commit 37bebc1cae
5 changed files with 35 additions and 40 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,18 @@
[gd_resource type="CharacterSpec" format=2]
[gd_resource type="CharacterSpec" load_steps=4 format=2]
[ext_resource path="res://modules/entity_classes/naturalist/auras/12_aspect_of_wolves_rank_1.tres" type="Aura" id=1]
[ext_resource path="res://modules/entity_classes/naturalist/auras/15_close_wounds_rank_1.tres" type="Aura" id=2]
[ext_resource path="res://modules/entity_classes/naturalist/auras/17_natures_swiftness_rank_1.tres" type="Aura" id=3]
[resource]
resource_name = "Aspects"
text_name = "Aspects"
num_rows = 2
row_0/size = 1
row_0/column_0/size = 1
row_0/column_0/entry_0 = ExtResource( 1 )
row_1/size = 2
row_1/column_0/size = 1
row_1/column_0/entry_0 = ExtResource( 2 )
row_1/column_1/size = 1
row_1/column_1/entry_0 = ExtResource( 3 )

View File

@ -56,18 +56,23 @@ func _ready() -> void:
_rank_label = get_node(rank_label_path) as Label
_upgrade_button = get_node(upgrade_button_path) as Button
func set_player(player : Entity, spec : CharacterSpec, spec_index : int, row : int) -> void:
func set_player(player : Entity, spec : CharacterSpec, spec_index : int, row : int, pculomn : int) -> void:
if _player != null:
_player.disconnect("ctalent_learned", self, "ctalent_learned")
_player.disconnect("ctalent_reset", self, "ctalent_reset")
_player.disconnect("cclass_talent_learned", self, "ctalent_learned")
_player.disconnect("ccharacter_talent_learned", self, "ctalent_learned")
_player.disconnect("cclass_talent_reset", self, "ctalent_reset")
_player.disconnect("ccharacter_talent_reset", self, "ctalent_reset")
_row = row
_spec = spec
_player = player
_spec_index = spec_index
culomn = pculomn
_player.connect("ctalent_learned", self, "ctalent_learned")
_player.connect("ctalent_reset", self, "ctalent_reset")
_player.connect("cclass_talent_learned", self, "ctalent_learned")
_player.connect("ccharacter_talent_learned", self, "ctalent_learned")
_player.connect("cclass_talent_reset", self, "ctalent_reset")
_player.connect("ccharacter_talent_reset", self, "ctalent_reset")
refresh()
@ -86,7 +91,7 @@ func refresh() -> void:
if a == null:
break
if _player.talent_hasc(a.id):
if _player.class_talent_hasc(a.id):
known_rank_count += 1
rank_count += 1
@ -114,7 +119,7 @@ func open_popup() -> void:
_popup.popup(Rect2(p, _popup.rect_size))
func upgrade():
_player.talent_crequest_learn(_spec_index, _row, culomn)
_player.class_talent_crequest_learn(_spec_index, _row, culomn)
func ctalent_learned(entity: Entity, talent_id: int) -> void:
refresh()

View File

@ -20,6 +20,10 @@ extends HBoxContainer
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
export(PackedScene) var entry_scene : PackedScene
func set_player(player : Entity, spec : CharacterSpec, spec_index: int, row : int) -> void:
for ch in get_children():
ch.set_player(player, spec, spec_index, row)
for i in range(spec.get_num_columns(row)):
var ch : Node = entry_scene.instance()
add_child(ch)
ch.set_player(player, spec, spec_index, row, i)

View File

@ -14,31 +14,4 @@ script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TalentEntry" parent="." instance=ExtResource( 1 )]
margin_right = 198.0
margin_bottom = 600.0
[node name="TalentEntry2" parent="." instance=ExtResource( 1 )]
margin_left = 206.0
margin_right = 404.0
margin_bottom = 600.0
culomn = 1
[node name="TalentEntry3" parent="." instance=ExtResource( 1 )]
margin_left = 412.0
margin_right = 610.0
margin_bottom = 600.0
culomn = 2
[node name="TalentEntry4" parent="." instance=ExtResource( 1 )]
margin_left = 618.0
margin_right = 816.0
margin_bottom = 600.0
culomn = 3
[node name="TalentEntry5" parent="." instance=ExtResource( 1 )]
margin_left = 824.0
margin_right = 1024.0
margin_bottom = 600.0
culomn = 4
entry_scene = ExtResource( 1 )