비트 찍기 완료 및 클로드를 통한 api작업
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SongCard : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TMP_Text titleText;
|
||||
[SerializeField] private TMP_Text artistText;
|
||||
[SerializeField] private TMP_Text durationText;
|
||||
[SerializeField] private GameObject downloadedBadge;
|
||||
[SerializeField] private Button button;
|
||||
|
||||
public void Setup(SongInfo song, bool isDownloaded, Action onClick)
|
||||
{
|
||||
titleText.text = song.title;
|
||||
artistText.text = song.artist;
|
||||
durationText.text = FormatDuration(song.duration);
|
||||
downloadedBadge.SetActive(isDownloaded);
|
||||
button.onClick.AddListener(() => onClick?.Invoke());
|
||||
}
|
||||
|
||||
private static string FormatDuration(int seconds)
|
||||
=> $"{seconds / 60}:{seconds % 60:D2}";
|
||||
}
|
||||
Reference in New Issue
Block a user