75 lines
1.4 KiB
GDScript3
75 lines
1.4 KiB
GDScript3
extends HBoxContainer
|
|
|
|
|
|
# Declare member variables here. Examples:
|
|
# var a = 2
|
|
# var b = "text"
|
|
|
|
var duet = true
|
|
var lyrics = true
|
|
var score = true
|
|
var jsonObject = {}
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
func setSongName(songname):
|
|
$SongName.text = songname
|
|
|
|
func setSongArtists(songtitle):
|
|
$SongArtists.text = songtitle
|
|
|
|
func setDuet(hasDuetMarked):
|
|
if hasDuetMarked:
|
|
duet = true
|
|
else:
|
|
duet = false
|
|
setIcon()
|
|
|
|
func setLyrics(hasLyrics):
|
|
if hasLyrics:
|
|
lyrics = true
|
|
else:
|
|
lyrics = false
|
|
setIcon()
|
|
|
|
func setScore(hasScore):
|
|
if hasScore:
|
|
score = true
|
|
else:
|
|
score = false
|
|
setIcon()
|
|
|
|
func setIcon():
|
|
var filename = ""
|
|
if duet:
|
|
filename += "duet"
|
|
else:
|
|
filename += "solo"
|
|
if score:
|
|
filename += "notes"
|
|
if lyrics:
|
|
filename += "lyrics"
|
|
filename += "50"
|
|
$SongIcon.texture_normal = load("UI/src/"+filename+".png")
|
|
|
|
func setObject(fullObject):
|
|
jsonObject = fullObject
|
|
setDuet(fullObject.duetmarks)
|
|
setLyrics(fullObject.lyrics)
|
|
setScore(fullObject.score)
|
|
setSongName(fullObject.title)
|
|
var artists = PoolStringArray(fullObject.artists).join(", ")
|
|
setSongArtists(artists)
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
#func _process(delta):
|
|
# pass
|
|
|
|
|
|
func _on_SongIcon_pressed():
|
|
Globals.setSongObject(jsonObject)
|
|
get_tree().change_scene("res://download_video.tscn")
|