拼ui 一些业务逻辑x实现
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class uAchievementPrefab : MonoBehaviour
|
||||
{
|
||||
[Header("infos")]
|
||||
public Image aBottomImage;
|
||||
public Image aIcon;
|
||||
public Text aName;
|
||||
public Text aGetDate;
|
||||
public Text aDescription;
|
||||
|
||||
public void Setup(GlobalAchievementSnapshot snapshot, Sprite bottomSprite)
|
||||
{
|
||||
GlobalAchievementSO definition = snapshot.definition;
|
||||
if (definition == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (aName != null)
|
||||
{
|
||||
aName.text = definition.displayName;
|
||||
}
|
||||
|
||||
if (aGetDate != null)
|
||||
{
|
||||
aGetDate.text = snapshot.unlockedDateTimeText;
|
||||
}
|
||||
|
||||
if (aDescription != null)
|
||||
{
|
||||
aDescription.text = definition.description;
|
||||
}
|
||||
|
||||
if (aIcon != null)
|
||||
{
|
||||
aIcon.sprite = definition.icon;
|
||||
aIcon.enabled = definition.icon != null;
|
||||
}
|
||||
|
||||
if (aBottomImage != null)
|
||||
{
|
||||
aBottomImage.sprite = bottomSprite;
|
||||
aBottomImage.enabled = bottomSprite != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user