More work on dialogue, portraits, customizer and intro
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class_name AdventurerPortrait extends Control
|
||||
|
||||
|
||||
var option_sets : Dictionary
|
||||
var cv_lists : Array
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -8,9 +8,18 @@ func _ready() -> void:
|
||||
cv_lists.resize(ColorVariant.Types.size())
|
||||
for i in range(len(cv_lists)):
|
||||
cv_lists[i] = []
|
||||
for child in get_children():
|
||||
add_color_variants(get_children())
|
||||
for child : Control in get_children():
|
||||
if child.get_child_count() > 0:
|
||||
option_sets[child.name.to_lower()] = child
|
||||
|
||||
func add_color_variants(list : Array) -> void:
|
||||
for child : Control in list:
|
||||
if child is ColorVariant:
|
||||
cv_lists[child.type].append(child)
|
||||
if child.get_child_count() > 0:
|
||||
add_color_variants(child.get_children())
|
||||
|
||||
|
||||
func set_appearance(appearance) -> void:
|
||||
set_color(ColorVariant.Types.HAIR, appearance.hair_color)
|
||||
@@ -39,3 +48,13 @@ static func random_color(type : ColorVariant.Types) -> String:
|
||||
func set_color(type : ColorVariant.Types, color : String) -> void:
|
||||
for cv : ColorVariant in cv_lists[type]:
|
||||
cv.set_color(color)
|
||||
|
||||
func flash_color_variants(node : Control, flashing : bool) -> void:
|
||||
if node is ColorVariant:
|
||||
node.flash(flashing)
|
||||
|
||||
for child in node.get_children():
|
||||
flash_color_variants(child, flashing)
|
||||
|
||||
func flash_option(key : String, flashing : bool) -> void:
|
||||
flash_color_variants(option_sets[key], flashing)
|
||||
|
||||
Reference in New Issue
Block a user