105 lines
3.7 KiB
C#
105 lines
3.7 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
using EerieVillage.Progression;
|
|
|
|
namespace EerieVillage.MyUI
|
|
{
|
|
/// <summary>
|
|
/// BT12-MVP-A 영역 단일 카드 슬롯 — PD 첨부 예시 ("기술 선택" 화면) 정합.
|
|
/// SkillSelectionUI 영역 3개 자식.
|
|
///
|
|
/// PD 예시 카드 구성:
|
|
/// 1. 상단 색상 배너 (등급 — 청록 Common · 노랑 Rare · 빨강 Max)
|
|
/// 2. 카드 이름 (한글)
|
|
/// 3. 원형 아이콘 + 동심원 빛 효과
|
|
/// 4. "레벨 N" 또는 "최대" (빨강 강조)
|
|
/// 5. 효과 설명 3~4 라인
|
|
/// </summary>
|
|
public class SkillCardSlot : MonoBehaviour
|
|
{
|
|
[Header("PD 예시 정합 — 카드 구성")]
|
|
[SerializeField] Image _topBanner; // 1. 상단 색상 배너
|
|
[SerializeField] TMP_Text _nameText; // 2. 카드 이름 (한글)
|
|
[SerializeField] Image _icon; // 3. 원형 아이콘
|
|
[SerializeField] Image _glowEffect; // 3. 동심원 빛 효과
|
|
[SerializeField] TMP_Text _levelText; // 4. 레벨 N / 최대
|
|
[SerializeField] TMP_Text _descriptionText; // 5. 효과 설명
|
|
|
|
[Header("인터랙션")]
|
|
[SerializeField] Button _clickArea; // 카드 전체 클릭 영역
|
|
[SerializeField] GameObject _highlightFrame; // 선택 시 활성
|
|
|
|
[Header("등급별 색상 (PD 예시 정합)")]
|
|
[SerializeField] Color _commonColor = new Color(0.3f, 0.7f, 0.7f, 1f); // 청록
|
|
[SerializeField] Color _rareColor = new Color(0.95f, 0.7f, 0.25f, 1f); // 노랑
|
|
[SerializeField] Color _maxColor = new Color(0.9f, 0.3f, 0.3f, 1f); // 빨강
|
|
|
|
public SkillCardPlaceholder Card { get; private set; }
|
|
|
|
public void Bind(SkillCardPlaceholder card, System.Action onClick)
|
|
{
|
|
Card = card;
|
|
|
|
if (card == null)
|
|
{
|
|
gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
gameObject.SetActive(true);
|
|
|
|
// 2. 카드 이름
|
|
if (_nameText != null) _nameText.text = card.displayName;
|
|
|
|
// 3. 아이콘 (sprite null 시 영역 image enable=false 또는 placeholder 영역 잔존)
|
|
if (_icon != null)
|
|
{
|
|
_icon.sprite = card.icon;
|
|
_icon.enabled = card.icon != null;
|
|
}
|
|
|
|
// 5. 효과 설명
|
|
if (_descriptionText != null) _descriptionText.text = card.description;
|
|
|
|
// 1. 상단 색상 배너 + 4. 레벨 텍스트 — 등급별 영역
|
|
Color bannerColor = card.rarity switch
|
|
{
|
|
CardRarity.Common => _commonColor,
|
|
CardRarity.Rare => _rareColor,
|
|
CardRarity.Max => _maxColor,
|
|
_ => _commonColor
|
|
};
|
|
if (_topBanner != null) _topBanner.color = bannerColor;
|
|
|
|
// 4. 레벨 N / 최대
|
|
if (_levelText != null)
|
|
{
|
|
if (card.IsMaxLevel)
|
|
{
|
|
_levelText.text = "최대";
|
|
_levelText.color = _maxColor;
|
|
}
|
|
else
|
|
{
|
|
_levelText.text = $"레벨 {card.currentLevel}";
|
|
_levelText.color = Color.white;
|
|
}
|
|
}
|
|
|
|
// 클릭 영역
|
|
if (_clickArea != null)
|
|
{
|
|
_clickArea.onClick.RemoveAllListeners();
|
|
_clickArea.onClick.AddListener(() => onClick?.Invoke());
|
|
}
|
|
|
|
SetHighlight(false);
|
|
}
|
|
|
|
public void SetHighlight(bool active)
|
|
{
|
|
if (_highlightFrame != null) _highlightFrame.SetActive(active);
|
|
}
|
|
}
|
|
}
|