using JetBrains.Annotations; using UnityEngine; using UnityEngine.UI; public class archievePrefab : MonoBehaviour { [Header("�ɾ���Ϣ")] public Image archieve_btmImage; public Text archieve_name; public Text archieve_description; [Header("�ȼ��ּ�")] public Color whiteLevel; public Color greenLevel; public Color blueLevel; public Color purpleLevel; public Color goldenLevel; public Color redLevel; public Image colorfulLevel; public void Setup(AchievementLevel level) { if (archieve_name != null) archieve_name.text = level.levelName; if (archieve_description != null) archieve_description.text = level.description; // 设置颜色/稀有度表现 SetRarityVisuals(level.rarity); } private void SetRarityVisuals(AchievementRarity rarity) { // 默认隐藏特殊彩色层 if (colorfulLevel != null) colorfulLevel.gameObject.SetActive(false); Color targetColor = whiteLevel; switch (rarity) { case AchievementRarity.Common: targetColor = whiteLevel; break; case AchievementRarity.Advanced: targetColor = greenLevel; break; case AchievementRarity.Rare: targetColor = blueLevel; break; case AchievementRarity.Epic: targetColor = purpleLevel; break; case AchievementRarity.Legendary: targetColor = goldenLevel; break; case AchievementRarity.Mythic: targetColor = redLevel; break; case AchievementRarity.Exquisite: if (colorfulLevel != null) colorfulLevel.gameObject.SetActive(true); targetColor = Color.white; // 或者其他基色 break; } if (archieve_btmImage != null) { Color finalColor = targetColor; finalColor.a = 1f; // 确保 alpha 是 1 archieve_btmImage.color = finalColor; } } }