tool extends TextureButton export (Array, String) var titles export (Array, AudioStream) var sounds export (Array, Dictionary) var categories setget set_categories var current_selection = 0 onready var body = $SoundLabel/Label onready var category = $SoundLabel/Category func _ready(): if Engine.editor_hint and categories.empty(): categories = [SoundCategory.new()] func _gui_input(event): if Input.is_action_just_pressed("ui_left"): current_selection -= 1 elif Input.is_action_just_pressed("ui_right"): current_selection += 1 elif Input.is_action_just_pressed("ui_accept"): Audio.play_sound(sounds[current_selection],Audio.ac_collectible) elif Input.is_action_just_pressed("ui_cancel"): Audio.ac_music.stop() current_selection = posmod(current_selection,sounds.size()) body.text = titles[current_selection] # for c in categories: # if current_selection >= c.index: # category.text = c.name # category.add_color_override("font_color", c.color) class SoundCategory extends Resource: export var starting_index: int = 0 export var title: String = "" export var color: Color = Color.white func set_categories(value: Array) -> void: categories = value for i in categories.size(): if !categories[i]: categories[i] = { index = 0, name = "", color = Color.white, }