extends Control onready var playIcon = preload("res://resources/graphics/GUI/Gallery/Play.webp") onready var stopIcon = preload("res://resources/graphics/GUI/Gallery/Stop.webp") var musicPath; var unlocked; var state = false; signal PlayerStarted; func Init(object, index:int): state = false var name = object["name"]; unlocked = GallerySingleton.HaveMusic(name) if unlocked: $Label.text = str("%02d" % index, " ", name); musicPath = object["path"]; else : $Label.text = tr("ui_gallery_locked"); func _on_Button_pressed(): if not unlocked: return ; state = not state; DrawButtonIcon(); emit_signal("PlayerStarted"); func DrawButtonIcon(): if state: $Button.icon = stopIcon; else : $Button.icon = playIcon; func GetAudioStream()->AudioStream: if not ResourceLoader.exists(musicPath): return null var stream = load(musicPath); return stream;