More work on dialogue, portraits, customizer and intro
This commit is contained in:
50
scripts/portrait_customizer.gd
Normal file
50
scripts/portrait_customizer.gd
Normal file
@@ -0,0 +1,50 @@
|
||||
extends Control
|
||||
|
||||
@onready var portrait : AdventurerPortrait = $HeroPortrait
|
||||
var option = 0
|
||||
var opt_key : String = ""
|
||||
var choices : Array = []
|
||||
|
||||
func _ready() -> void:
|
||||
choices.resize(portrait.option_sets.size())
|
||||
choices.fill(0)
|
||||
opt_key = portrait.option_sets.keys()[option]
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], true)
|
||||
|
||||
func _on_left_button_pressed() -> void:
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = false
|
||||
choices[option] -= 1
|
||||
if choices[option] < 0:
|
||||
choices[option] = portrait.option_sets[opt_key].get_child_count() - 1
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = true
|
||||
|
||||
|
||||
func _on_right_button_pressed() -> void:
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = false
|
||||
choices[option] += 1
|
||||
if choices[option] >= portrait.option_sets[opt_key].get_child_count():
|
||||
choices[option] -= portrait.option_sets[opt_key].get_child_count()
|
||||
portrait.option_sets[opt_key].get_child(choices[option]).visible = true
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_up_button_pressed() -> void:
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], false)
|
||||
option -= 1
|
||||
if option < 0:
|
||||
option = portrait.option_sets.keys().size() - 1
|
||||
opt_key = portrait.option_sets.keys()[option]
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], true)
|
||||
|
||||
|
||||
func _on_down_button_pressed() -> void:
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], false)
|
||||
option += 1
|
||||
if option >= portrait.option_sets.keys().size():
|
||||
option -= portrait.option_sets.keys().size()
|
||||
opt_key = portrait.option_sets.keys()[option]
|
||||
portrait.flash_option(portrait.option_sets.keys()[option], true)
|
||||
|
||||
|
||||
func _on_color_pressed(slot : ColorVariant.Types, col : String) -> void:
|
||||
portrait.set_color(slot, col)
|
||||
Reference in New Issue
Block a user