forked from team-sg/hero-mark-2
add all sounds to sound test
This commit is contained in:
parent
9c84ac09bf
commit
e5859ae452
2 changed files with 132 additions and 6 deletions
|
@ -1,9 +1,16 @@
|
|||
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"):
|
||||
|
@ -16,3 +23,23 @@ func _gui_input(event):
|
|||
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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue