Now the spell book can hide not learned class spells.

This commit is contained in:
Relintai 2020-03-20 15:06:29 +01:00
parent a8868d81dc
commit 55c5791991
2 changed files with 12 additions and 7 deletions

View File

@ -25,6 +25,7 @@ export(NodePath) var prev_button_path : NodePath
export(NodePath) var next_button_path : NodePath export(NodePath) var next_button_path : NodePath
export(NodePath) var spell_points_label_path : NodePath export(NodePath) var spell_points_label_path : NodePath
export(bool) var show_not_learned : bool = true
export(bool) var show_not_learnable : bool = false export(bool) var show_not_learnable : bool = false
var _spell_entry_container : Node var _spell_entry_container : Node
@ -93,18 +94,22 @@ func refresh_entries() -> void:
var spindex : int = i + (_page * len(_spell_entries)) var spindex : int = i + (_page * len(_spell_entries))
if spindex >= _spells.size(): if spindex >= _spells.size():
_spell_entries[i].set_spell(_player, null) _spell_entries[n].set_spell(_player, null)
i += 1 i += 1
n += 1 n += 1
continue continue
var spell : Spell = _spells[spindex] var spell : Spell = _spells[spindex]
if not show_not_learnable: if not _player.hasc_spell(spell):
if not _player.hasc_spell(spell) and spell.training_required_spell \ if not show_not_learned:
and not _player.hasc_spell(spell.training_required_spell): i += 1
i += 1 continue
continue
if not show_not_learnable:
if spell.training_required_spell and not _player.hasc_spell(spell.training_required_spell):
i += 1
continue
_spell_entries[n].set_spell(_player, spell) _spell_entries[n].set_spell(_player, spell)

View File

@ -16,7 +16,7 @@ spell_entry_container_path = NodePath("PagedContent/GridContainer")
prev_button_path = NodePath("PagedContent/Controls/HBoxContainer/Button2") prev_button_path = NodePath("PagedContent/Controls/HBoxContainer/Button2")
next_button_path = NodePath("PagedContent/Controls/HBoxContainer/Button") next_button_path = NodePath("PagedContent/Controls/HBoxContainer/Button")
spell_points_label_path = NodePath("PagedContent/Controls/HBoxContainer/SpellPoints") spell_points_label_path = NodePath("PagedContent/Controls/HBoxContainer/SpellPoints")
show_not_learnable = true show_not_learned = false
[node name="PagedContent" type="VBoxContainer" parent="."] [node name="PagedContent" type="VBoxContainer" parent="."]
margin_left = 4.0 margin_left = 4.0