69 lines
1.6 KiB
C#
69 lines
1.6 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class idolCardPrefab : MonoBehaviour
|
|
{
|
|
public Image idolProfile;
|
|
public Text idolDesName;
|
|
public Text idolName;
|
|
public Slider idol_xpSlider;
|
|
public Text idol_xpText;
|
|
public Image idol_levelIcon;
|
|
public Image idol_btmImage;
|
|
|
|
public void Setup(
|
|
Sprite profile,
|
|
string designation,
|
|
string heroName,
|
|
float sliderValue,
|
|
string xpText,
|
|
Sprite levelIcon,
|
|
Sprite bottomSprite,
|
|
Color sliderFillColor)
|
|
{
|
|
if (idolProfile != null)
|
|
{
|
|
idolProfile.sprite = profile;
|
|
}
|
|
|
|
if (idolDesName != null)
|
|
{
|
|
idolDesName.text = designation ?? string.Empty;
|
|
}
|
|
|
|
if (idolName != null)
|
|
{
|
|
idolName.text = heroName ?? string.Empty;
|
|
}
|
|
|
|
if (idol_xpSlider != null)
|
|
{
|
|
idol_xpSlider.normalizedValue = Mathf.Clamp01(sliderValue);
|
|
|
|
if (idol_xpSlider.fillRect != null)
|
|
{
|
|
Image fillImage = idol_xpSlider.fillRect.GetComponent<Image>();
|
|
if (fillImage != null)
|
|
{
|
|
fillImage.color = sliderFillColor;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (idol_xpText != null)
|
|
{
|
|
idol_xpText.text = xpText ?? "UNKNOWN";
|
|
}
|
|
|
|
if (idol_levelIcon != null)
|
|
{
|
|
idol_levelIcon.sprite = levelIcon;
|
|
}
|
|
|
|
if (idol_btmImage != null)
|
|
{
|
|
idol_btmImage.sprite = bottomSprite;
|
|
}
|
|
}
|
|
}
|