拼ui 一些业务逻辑x实现

This commit is contained in:
2026-03-19 06:15:09 +08:00
parent f5c6f143c0
commit 49e45ac464
1118 changed files with 246518 additions and 5368 deletions
+68
View File
@@ -0,0 +1,68 @@
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;
}
}
}