feat(BT12-Dev): 스킬 선택 UI 아이콘 fallback 추가 (PD 지시 2026-05-13)

SkillCardSlot.Bind 영역 card.Icon == null fallback:
- _icon — 동적 원 sprite (32×32 알파) + 속성별 색상 (Fire 주황·Frost 하늘·Dark 보라·Lightning 노랑·Physical 흰)
- _glowEffect — 동일 sprite + alpha 0.3 (동심원 빛 효과 정합)
- GetFallbackIconSprite·GetColorByAttribute static helper (정적 캐싱)
- card.Icon 설정 시 정상 sprite 사용 (PD 후속 정식 아이콘 자산 추가 시 자동 정합)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
깃 관리자 2026-05-13 19:51:27 +09:00
parent 18b21256cd
commit 32ab76fcde
1 changed files with 59 additions and 3 deletions

View File

@ -52,11 +52,30 @@ namespace EerieVillage.MyUI
// 2. 카드 이름 (DisplayName — SkillDataAsset base PascalCase)
if (_nameText != null) _nameText.text = card.DisplayName;
// 3. 아이콘 (sprite null 시 image enable=false)
// PD 지시 2026-05-13 — 3. 아이콘 (card.Icon null 시 속성별 색상 동적 원 sprite fallback)
if (_icon != null)
{
if (card.Icon != null)
{
_icon.sprite = card.Icon;
_icon.enabled = card.Icon != null;
_icon.color = Color.white;
}
else
{
_icon.sprite = GetFallbackIconSprite();
_icon.color = GetColorByAttribute(card.AttributeTags);
}
_icon.enabled = true;
}
// PD 지시 2026-05-13 — 동심원 빛 효과 — fallback sprite·낮은 alpha (속성 색상 정합)
if (_glowEffect != null)
{
_glowEffect.sprite = GetFallbackIconSprite();
var glowCol = GetColorByAttribute(card.AttributeTags);
glowCol.a = 0.3f;
_glowEffect.color = glowCol;
_glowEffect.enabled = true;
}
// 5. 효과 설명
@ -86,5 +105,42 @@ namespace EerieVillage.MyUI
{
if (_highlightFrame != null) _highlightFrame.SetActive(active);
}
// PD 지시 2026-05-13 — 아이콘 fallback (정적 캐싱·16×16 원 알파 sprite)
static Sprite _fallbackIconSprite;
static Sprite GetFallbackIconSprite()
{
if (_fallbackIconSprite != null) return _fallbackIconSprite;
const int size = 32;
var tex = new Texture2D(size, size, TextureFormat.RGBA32, false);
tex.wrapMode = TextureWrapMode.Clamp;
tex.filterMode = FilterMode.Bilinear;
float r = size * 0.5f;
for (int y = 0; y < size; y++)
{
for (int x = 0; x < size; x++)
{
float dx = x - r + 0.5f;
float dy = y - r + 0.5f;
float dist = Mathf.Sqrt(dx * dx + dy * dy);
float alpha = Mathf.Clamp01(1f - (dist - (r - 2.5f)));
tex.SetPixel(x, y, new Color(1f, 1f, 1f, alpha));
}
}
tex.Apply();
_fallbackIconSprite = Sprite.Create(tex, new Rect(0, 0, size, size), new Vector2(0.5f, 0.5f), size);
return _fallbackIconSprite;
}
// PD 지시 2026-05-13 — 속성별 색상 (Fire 주황·Frost 하늘·Dark 보라·Lightning 노랑·Physical 흰)
static Color GetColorByAttribute(AttributeTag attr)
{
if ((attr & AttributeTag.Fire) != 0) return new Color(1f, 0.5f, 0.2f);
if ((attr & AttributeTag.Frost) != 0) return new Color(0.5f, 0.85f, 1f);
if ((attr & AttributeTag.Dark) != 0) return new Color(0.6f, 0.3f, 0.85f);
if ((attr & AttributeTag.Lightning) != 0) return new Color(1f, 1f, 0.4f);
if ((attr & AttributeTag.Physical) != 0) return new Color(0.95f, 0.95f, 0.95f);
return Color.white;
}
}
}