using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace TKS.OutGame
{
///
/// 영웅·병사 카드(가로형 · UI 상업용 재설계 ② · 설계서 §3② · 팩 CardFrame01 5층 등급색) — 초상(뒤 빛) · 병종 원 · Lv 배지 · 세력 깃발 · 출전 꼬리 칩 ·
/// 아래 이름 띠(이름 · ★ · 등급 칩) · 미보유 = 빈 카드(문양 + 초상 어둡게). 목록 · 편성 보유 행 · 도감 공용.
///
public static class HeroCards
{
public static Image Card(Transform content, OutGameSession s, HeroDb.Hero h, bool deployed, bool owned, System.Action onTap)
{
var cell = UiKit.Cell(content, "Card_" + h.id, Color.clear, onTap);
cell.sprite = null; // 바닥 = 클릭 판(투명) · 그림은 층으로
var lv = s.Save.Level(h.id);
var hs = s.Save.Hero(h.id);
string g = hs == null || string.IsNullOrEmpty(hs.grade) ? "white" : hs.grade;
string G = "grade_" + g + "_";
var t = cell.transform;
if (owned)
{
UiKit.GradeTint(UiKit.Layer(t, "Bg", "card_bg", UiKit.Col(G + "card_bg", UiKit.Paper)), g); // 신화 카드 바탕 = 7색 순환(grade_theme_new 「cycle」)
UiKit.Layer(t, "Grad", "card_grad", UiKit.Col(G + "card_grad", UiKit.White), 0f, 6f, 0f, 0f);
var glow = UiKit.Skin(UiKit.Rect("Glow", t, new Vector2(0f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(72f, 6f), new Vector2(190f, 190f)), "card_glow", UiKit.Col(G + "card_glow", UiKit.White));
glow.enabled = UISkin.Has("card_glow");
}
else
{
UiKit.Layer(t, "Bg", "card_empty", UiKit.Col("card_empty", UiKit.Slot));
var pat = UiKit.Layer(t, "Pattern", "card_empty_pattern", UiKit.Col("card_empty_pattern", UiKit.Slot), 6f, 6f, 6f, 6f);
pat.type = Image.Type.Tiled;
}
UiKit.Portrait("Face", t, h, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(12f, 6f), new Vector2(120f, 116f), false, 2f, Color.clear);
if (!owned) UiKit.Paint(UiKit.Rect("Dim", t, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(12f, 6f), new Vector2(120f, 116f)), UiKit.Col("card_dim", UiKit.Dark), false);
var band = UiKit.Rect("Band", t, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), Vector2.zero, new Vector2(0f, 62f));
band.anchorMin = new Vector2(0f, 0f);
band.anchorMax = new Vector2(1f, 0f);
band.sizeDelta = new Vector2(0f, 62f);
UiKit.Skin(band, "card_bottom", UiKit.Col("card_bottom", UiKit.Dark)).enabled = UISkin.Has("card_bottom");
UiKit.Layer(t, "Border", "card_border", UiKit.Col(owned ? "card_border" : "card_empty_border", UiKit.Line));
int star = hs != null ? hs.star : h.rarity;
UiKit.StarRow(t, star, star, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(16f, 8f), 24f);
var name = UiKit.Title(UiKit.Label(t, h.nameKo, 40, owned ? UiKit.White : UiKit.InkSoft, TextAnchor.MiddleLeft, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(142f, 4f), new Vector2(260f, 56f)), true);
name.horizontalOverflow = HorizontalWrapMode.Overflow;
// 위 줄: 병종 원 · Lv 배지 · 세력 깃발 · (출전 꼬리 칩)
// 병과 = 단색 심볼만(배경 틀 없음 · PD 2026-11-09)
var ring = UiKit.Rect("Type", t, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(142f, -12f), new Vector2(52f, 52f));
var cls = UiKit.Icon(ring, UiKit.TypeSymbolId(h.type), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 50f);
if (cls == null) UiKit.Title(UiKit.FillLabel(ring, UnitTypeInfo.Mark(h.type), 26, UiKit.White), true);
if (owned)
{
var badge = UiKit.Icon(t, "lv_badge_s", new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(202f, -8f), 56f);
var lt = UiKit.Title(UiKit.Label(badge != null ? badge.transform : t, (lv != null ? lv.lv : 1).ToString(), 26, UiKit.White, TextAnchor.MiddleCenter,
badge != null ? new Vector2(0.5f, 0.5f) : new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), badge != null ? new Vector2(0f, 2f) : new Vector2(230f, -36f), new Vector2(56f, 40f)), true);
lt.horizontalOverflow = HorizontalWrapMode.Overflow;
}
UiKit.DropShadow(UiKit.FactionBadge(t, h.faction, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(264f, -12f), 46f), 2f); // 진영 원 배지(PD 2026-11-09)
if (deployed)
{
var tail = UiKit.Skin(UiKit.Rect("Deployed", t, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-10f, -10f), new Vector2(104f, 46f)), "tail", UiKit.Col("tail_red", UiKit.Red));
UiKit.Title(UiKit.FillLabel(tail.transform, "출전", 26, UiKit.White), true);
}
if (owned && hs != null && UISkin.Has("para_" + g))
{
var chip = UiKit.Skin(UiKit.Rect("Grade", t, new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(-14f, 11f), new Vector2(66f, 40f)), "para_" + g, UiKit.Col(G + "chip", UiKit.White));
UiKit.GradeTint(chip, g); // 채(rainbow) = 7색 순환(2026-11-20)
UiKit.Title(UiKit.FillLabel(chip.transform, UiKit.GradeKo(g), 24, UiKit.White), true);
}
if (owned && s.CanGrowAny(h.id) && UiKit.Icon(t, "new_dot", new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(14f, -10f), 34f) == null)
UiKit.Dot("New", t, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(14f, -10f), 26f, UiKit.Red);
return cell;
}
}
///
/// 영웅 목록 세로 카드(PD 2026-11-09 레퍼런스 = 팩 데모 Collection_List · 칸 320×431) — 등급색 바탕(마스크) · 그라데이션 · 일러 뒤 빛 · 일러 · 아래 어두운 띠 · 테두리 ·
/// 이름(왼쪽 위) · 병종 원 · 레벨 배지(왼쪽 아래 · 최고 = 노랑) · ★(오른쪽 아래) · 미보유 = 빈 카드(문양 + 얼굴 실루엣). 수치 = 팩 프리팹 RectTransform 그대로.
///
public static class CollectionCards
{
public static readonly Vector2 CellSize = new Vector2(320f, 431f);
public static readonly Vector2 Spacing = new Vector2(22f, 20f);
/// 크기 표 size_px(머리 크기 기준 표준 키)가 카드에서 차지할 px — 배율 = UnitPx ÷ size_px(모든 유닛 머리 크기 같음) · 머리 끝 위치(카드 위에서 px).
const float UnitPx = 360f; // 450 → 360 = 유닛 20 % 작게(PD 2026-11-09 「현재 비율보다 20 % 정도 작게」)
const float HeadTop = 50f;
/// 걷는 유닛(보병·창병·궁병·책사) = 머리 끝을 더 내려 발이 카드 아래로 숨게(PD 2026-11-09).
const float FootDrop = 36f;
/// 말 탄 유닛(크기 표 mounted) = 걷는 유닛보다 작게 · 말 얼굴이 카드 오른쪽 경계에 닿을 만큼(PD 2026-11-09 0.72 → 「조금 더 크게 · 내려도」).
const float MountedScale = 0.85f;
/// 말 탄 유닛 머리 끝 내림(카드 px · PD 2026-11-09).
const float MountedDrop = 24f;
/// 말 탄 유닛 전신(발 ~ 머리 끝) 높이 상한(카드 px) — 크기 표 실측이 튀는 그림(예 여포 size_px 449)도 다른 기병과 비슷하게.
const float MountedMaxBody = 460f;
/// 눈 줄(카드 위에서 px · 크기 표 eye_up_px 가 있는 유닛) — 머리 끝 맞춤이면 관·투구가 낮은 유닛(전위·태사자)의 얼굴이 위로 뜸 →
/// 눈 높이를 맞춘다(PD 2026-11-10 「너무 위쪽에 등장하는 영웅은 내려」) · 값 = PD 확인 기존 20종의 머리 끝 맞춤 때 눈 높이 중앙값(걷는 216.5 · 기병 210.3).
const float EyeLine = 216f;
const float EyeLineMounted = 210f;
/// false = 미보유(PD 2026-11-10 「유닛 목록에 장수들의 모습이 보이도록」) — 일러를 테마 card_locked_art 로 조금 어둡게 · 「미보유」 꼬리 칩 · 레벨 배지·성장 점 없음
public static Image Card(Transform content, OutGameSession s, HeroDb.Hero h, bool deployed, System.Action onTap, bool owned = true)
{
var cell = UiKit.Cell(content, "Card_" + h.id, Color.clear, onTap);
cell.sprite = null; // 바닥 = 클릭 판(투명) · 그림은 층으로
var t = cell.transform;
var lv = s.Save.Level(h.id);
var hs = s.Save.Hero(h.id);
string g = hs == null || string.IsNullOrEmpty(hs.grade) ? "white" : hs.grade;
int star = hs != null ? hs.star : h.rarity;
// 카드 바탕 색 = 보유 ★ 수(PD 2026-11-19 「1성 녹 · 2성 파랑 · 3성 보라 · 4성 주황 · 5성 붉은」 · 테마 card_star_*) · 미보유 = 예전 그대로(grade_white_card_*)
string C = owned && hs != null ? "card_star" + Mathf.Clamp(star, 1, 5) + "_" : "grade_" + g + "_card_";
// 바탕(마스크) 안 = 그라데이션 · 빛 · 일러 · 아래 띠(카드 둥근 모양으로 잘림)
var bg = UiKit.Layer(t, "Bg", "card_bg", UiKit.Col(C + "bg", UiKit.Paper), 2f, 2f, 2f, 2f);
UiKit.GradeTint(bg, g); // 신화(승급 등급) 카드 바탕 = 7색 순환(2026-11-20) · 그 밖의 등급 = 위 ★ 색 그대로(UiRainbow 멈춤)
bg.gameObject.AddComponent().showMaskGraphic = true;
var b = bg.transform;
UiKit.Layer(b, "Gradient", "card_grad", UiKit.Col(C + "grad", UiKit.White), 0f, 0f, 0f, 44.6f);
UiKit.Skin(UiKit.Rect("Glow", b, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(226f, 226f)), "card_glow", UiKit.Col(C + "glow", UiKit.White)).enabled = UISkin.Has("card_glow");
var sp = UiKit.ArtSprite(h.art);
if (sp != null)
{
// 머리 크기 통일(PD 2026-11-09 「캐릭터 크기가 동일하게 보이도록」) = 배율 UnitPx ÷ 크기 표 size_px(눈 간격 기준 · 말 탄 유닛은 탄 사람 기준) ·
// 머리 끝(발 + bodyHeightPx · 무기 제외)을 카드 위 HeadTop 에 맞춤 → 다리·말은 아래 띠 뒤로 잘림(레퍼런스 흉상 느낌) · 메타가 없으면 칸 맞춤
var a = UnitArt.Load(h.art);
var m = a != null ? a.Meta : null;
float body = a != null ? a.BodyPx : 0f;
float size = a != null && a.SizePx > 0.5f ? a.SizePx : body;
Image art;
if (body > 0.5f && m.pivot != null && m.pivot.Length > 1)
{
var src = a.SrcPx(sp); // 원본 px(Android 임포트 축소와 무관 · 2026-11-26 모바일 영웅 작게 나옴)
float hgt = src.y;
bool mounted = a.Mounted;
float k = UnitPx / size * (mounted ? MountedScale : 1f);
if (mounted) k = Mathf.Min(k, MountedMaxBody / body);
float pivotY, y;
if (a.EyeUpPx > 0.5f)
{
pivotY = Mathf.Clamp01((m.pivot[1] * hgt + a.EyeUpPx) / hgt); // 눈 줄 = 프레임 아래에서의 비율
y = mounted ? EyeLineMounted : EyeLine;
}
else
{
pivotY = Mathf.Clamp01((m.pivot[1] * hgt + body) / hgt); // 머리 끝 = 프레임 아래에서의 비율(눈 높이 없는 그림)
y = HeadTop + (mounted ? MountedDrop : FootDrop);
}
art = UiKit.Rect("Character", b, new Vector2(0.5f, 1f), new Vector2(0.5f, pivotY), new Vector2(0f, -y), src * k).gameObject.AddComponent();
}
else
{
art = UiKit.Rect("Character", b, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -56f), new Vector2(376f, 368f)).gameObject.AddComponent();
art.preserveAspect = true;
}
art.sprite = sp;
art.raycastTarget = false;
if (!owned) art.color = UiKit.Col("card_locked_art", UiKit.InkSoft);
}
else
{
var dot = UiKit.Dot("Shape", b, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -10f), 200f, UiKit.TypeColor(h.type));
UiKit.Title(UiKit.FillLabel(dot.transform, UnitTypeInfo.Mark(h.type), 100, UiKit.White), true);
}
var bottom = UiKit.Rect("Bottom", b, new Vector2(0.5f, 0f), new Vector2(0.5f, 0.5f), new Vector2(0f, 21.7f), new Vector2(0f, 91.5f));
bottom.anchorMin = new Vector2(0f, 0f);
bottom.anchorMax = new Vector2(1f, 0f);
bottom.sizeDelta = new Vector2(52.6f, 91.5f);
UiKit.Skin(bottom, "card_bottom", UiKit.Col("card_bottom", UiKit.Dark)).enabled = UISkin.Has("card_bottom");
UiKit.Layer(t, "Border", "card_border", UiKit.Col("card_border", UiKit.Line));
// ★(오른쪽 아래 · 42×45 · 28 간격 겹침)
for (int i = star - 1; i >= 0; i--)
UiKit.Icon(t, "star_on", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(-15.5f - i * 28f, 64.8f), 44f);
// 레벨 배지(왼쪽 아래 · 최고 레벨 = 노랑 · 미보유 = 없음)
int lvn = lv != null ? lv.lv : 1;
bool maxLv = s.Db.Levels != null && lvn >= s.Db.Levels.MaxLevel;
var badge = owned ? UiKit.Icon(t, maxLv ? "lv_badge_max" : "lv_badge_s", new Vector2(0f, 0f), new Vector2(0.5f, 0.5f), new Vector2(33.9f, 36.7f), 79f) : null;
if (badge != null)
{
var bt = UiKit.Title(UiKit.Label(badge.transform, lvn.ToString(), 30, UiKit.White, TextAnchor.MiddleCenter, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(1f, -3f), new Vector2(74f, 50f)), true);
bt.horizontalOverflow = HorizontalWrapMode.Overflow;
}
// PD 커스터마이징(2026-11-09): 왼쪽 위 = 진영 깃발 · 그 오른쪽 = 이름(45 · 긴 이름 자동 축소) · 깃발 아래(왼쪽 가장자리) = 출전 · 오른쪽 위 = 병종 원(#35374E 58×60)
// 진영 = 원 배지(위·촉·오·군 · PD 2026-11-09 · 구 세력 깃발 대체)
UiKit.DropShadow(UiKit.FactionBadge(t, h.faction, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(44f, -42f), 62f), 3f);
var name = UiKit.Title(UiKit.Label(t, h.nameKo, 45, UiKit.White, TextAnchor.MiddleLeft, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(80f, -40.5f), new Vector2(172f, 66f)), true);
name.resizeTextForBestFit = true;
name.resizeTextMinSize = 26;
name.resizeTextMaxSize = 45;
if (deployed || !owned)
{
var tail = UiKit.Skin(UiKit.Rect(owned ? "Deployed" : "Locked", t, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(10f, -96f), new Vector2(owned ? 84f : 104f, 38f)), "tail",
owned ? UiKit.Col("tail_red", UiKit.Red) : UiKit.Col("tail_locked", UiKit.Dark));
if (owned && hs != null && star >= 5) // ★5 붉은 카드 위 붉은 「출전」 = 흰 테두리(QA r1 M10)
{
var ol = tail.gameObject.AddComponent();
ol.effectColor = UiKit.Col("tail_outline", new Color(1f, 1f, 1f, 0.85f));
ol.effectDistance = new Vector2(2f, -2f);
}
UiKit.Title(UiKit.FillLabel(tail.transform, owned ? "출전" : "미보유", 24, UiKit.White), true);
}
// 병과 = 단색 심볼만(배경 틀 없음 · PD 2026-11-09 「심볼은 배경 프레임 없이 단색」)
var role = UiKit.Rect("Role", t, new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), new Vector2(-42f, -42f), new Vector2(60f, 60f));
var sym = UiKit.Icon(role, UiKit.TypeSymbolId(h.type), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 60f);
if (sym == null) UiKit.Title(UiKit.FillLabel(role, UnitTypeInfo.Mark(h.type), 28, UiKit.White), true);
if (owned && s.CanGrowAny(h.id)) UiKit.Icon(t, "new_dot", new Vector2(0f, 0f), new Vector2(0.5f, 0.5f), new Vector2(64f, 70f), 30f); // 성장 가능 = 레벨 배지 오른쪽 위
return cell;
}
/// 원래 크기(320×431) 카드를 holder 가운데에 배율 k 로 넣는다(편성 자리 · 편성 보유 목록 · 영웅 목록 미보유 = owned false).
public static Image CardIn(Transform holder, OutGameSession s, HeroDb.Hero h, bool deployed, System.Action onTap, float k, bool owned = true)
{
return Fit(Card(holder, s, h, deployed, onTap, owned), k);
}
/// 미보유·도감 안내 한 줄(이름(한자) · 병종 · ★ · 보유/미보유).
public static string InfoText(HeroDb.Hero h, bool own)
{
return h.nameKo + (string.IsNullOrEmpty(h.hanja) ? "" : "(" + h.hanja + ")") + " · " + UnitTypeInfo.Korean(h.type) + " · ★" + h.rarity +
(own ? " · 보유" : " · 미보유 — 거래 > 명장 등용");
}
public static Image EmptyIn(Transform holder, float k)
{
return Fit(Empty(holder), k);
}
static Image Fit(Image card, float k)
{
var rt = card.rectTransform;
rt.anchorMin = rt.anchorMax = new Vector2(0.5f, 0.5f);
rt.pivot = new Vector2(0.5f, 0.5f);
rt.sizeDelta = CellSize;
rt.anchoredPosition = Vector2.zero;
rt.localScale = new Vector3(k, k, 1f);
return card;
}
/// 빈 카드(미보유 자리) = 어두운 바탕 + 문양 + 테두리 + 오른쪽 아래 얼굴 실루엣(팩 CardFrame01_Empty).
public static Image Empty(Transform content)
{
var cell = UiKit.Cell(content, "Empty", Color.clear, null);
cell.sprite = null;
var t = cell.transform;
// 팩 CardFrame01_Empty 그대로: Bg(#303146 · 마스크) 안에 Bg_d_Pattern 타일(#2D2F42) → 테두리 → 얼굴
var bg = UiKit.Layer(t, "Bg", "card_bg", UiKit.Col("card_empty", UiKit.Slot), 2f, 2f, 2f, 2f);
bg.gameObject.AddComponent().showMaskGraphic = true;
var pat = UiKit.Layer(bg.transform, "Pattern", "card_empty_pattern", UiKit.Col("card_empty_pattern", UiKit.Slot));
pat.type = Image.Type.Tiled;
pat.pixelsPerUnitMultiplier = 1f;
UiKit.Layer(t, "Border", "card_border", UiKit.Col("card_empty_border", UiKit.Line));
var face = UiKit.Icon(t, "face", new Vector2(1f, 0f), new Vector2(0.5f, 0.5f), new Vector2(-87f, 90.8f), 127f);
if (face != null) face.color = UiKit.Col("card_empty_face", UiKit.Dark);
return cell;
}
}
///
/// 영웅 탭 = 영웅 목록(PD 2026-11-09 레퍼런스 = 팩 Collection_List) — 헤더(제목 · 사선 칸 「보유 / 전체」) · 이름 없는 병사도 한 목록(장수/병사 고르기 폐지 · PD 2026-11-25) ·
/// 세로 카드(보유 = 레벨 높은 순 → 탭 = 영웅 상세) + 미보유 = 그 영웅 카드(조금 어둡게 · 「미보유」 · 탭 = 획득 안내 · PD 2026-11-10).
///
public class HeroListScreen : OutGameScreen
{
RectTransform content;
ScrollRect scroll;
Text countText;
int ownedCards;
int lockedCards;
UiAutoGrid autoGrid;
public override void Build()
{
Tab = 0;
// 바탕 = 진남(레퍼런스 실측) + 재화 바 뒤 띠
UiKit.Paint(UiKit.Fill("ListBg", Rt), UiKit.Col("list_bg", UiKit.Bg), false);
UiKit.Paint(UiKit.TopBand("ListTop", Rt, 0f, OutGameRoot.TopBarH), UiKit.Col("band_top", UiKit.Bg), false);
var head = Header("영웅", "", true);
// 오른쪽 사선 칸(보유 / 전체) — 팩 PanelFrame03_Oblique #D8E8FF 239 폭
var ob = UiKit.Rect("Oblique", head, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), Vector2.zero, new Vector2(239f, OutGameRoot.HeaderH - 7f));
UiKit.Skin(ob, "oblique", UiKit.Col("oblique", UiKit.White));
countText = UiKit.Title(UiKit.Label(ob, "", 52, UiKit.Col("count_text", UiKit.Dark), TextAnchor.MiddleCenter, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(12f, 0f), new Vector2(220f, 80f)));
countText.horizontalOverflow = HorizontalWrapMode.Overflow;
// 본문 = 화면 폭 전체(해상도 대응 · PD 2026-11-09) · 열 수·카드 배율 = UiAutoGrid(기준 1080 = 4열 · 좁으면 3 · 넓으면 5 이상)
var body = UiKit.Fill("ListBody", Rt, 0f, 0f, OutGameRoot.TopBarH + OutGameRoot.HeaderH, OutGameRoot.TabBarH);
content = UiKit.ScrollGrid("List", body, 24f, 24f, 20f, 0f, CollectionCards.CellSize, CollectionCards.Spacing, 4, out scroll);
autoGrid = content.gameObject.AddComponent();
autoGrid.design = CollectionCards.CellSize;
}
/// 열 수(해상도 대응 · 테스트·캡처).
public int Columns
{
get { return autoGrid != null ? autoGrid.Columns : 0; }
}
/// 격자 칸(holder) — 원래 크기 카드를 UiAutoGrid 배율로 넣는다.
Transform Slot()
{
var go = new GameObject("Slot", typeof(RectTransform));
go.transform.SetParent(content, false);
return go.transform;
}
///
/// 미보유 카드 누름 = 획득 안내 + 조각 영입(PD 2026-11-24 ⑨ · hero_unlock 태생 ★ → 조각 · 조각 = 출정 하드 보스 · 연의 전기 첫 승리) —
/// 조각이 모이면 「영입」 버튼(이름 없는 병사도 같음 · PD 2026-11-25).
///
public void OnLockedCard(HeroDb.Hero h)
{
int need = GoodsRules.UnlockNeed(S.Db, h);
if (need <= 0)
{
Root.Toast(CollectionCards.InfoText(h, false));
return;
}
int have = GoodsRules.UnownedShards(S.Save, h.id);
string body = CollectionCards.InfoText(h, false) + "\n\n영입 조각 " + have + " / " + need + "\n조각 = 출정 하드 난이도 보스 · 연의 전기 첫 승리";
if (have >= need)
Root.Modal(h.nameKo + " 영입", body, new OutGameRoot.ModalButton("취소", UiKit.Dark, null), new OutGameRoot.ModalButton("영입", UiKit.Red, () =>
{
var why = S.RecruitHero(h.id);
Root.Toast(why ?? h.nameKo + " 영입!");
Refresh();
}));
else Root.Modal(h.nameKo, body, new OutGameRoot.ModalButton("확인", UiKit.Dark, null));
}
public override void Refresh()
{
UiKit.Clear(content);
var owned = new List(S.Owned());
// 보유 = 레벨 높은 순 → ★ 높은 순
owned.Sort((a, b) =>
{
int la = S.Save.Level(a.id) != null ? S.Save.Level(a.id).lv : 1, lb = S.Save.Level(b.id) != null ? S.Save.Level(b.id).lv : 1;
if (la != lb) return lb.CompareTo(la);
var ha = S.Save.Hero(a.id);
var hb = S.Save.Hero(b.id);
return (hb != null ? hb.star : b.rarity).CompareTo(ha != null ? ha.star : a.rarity);
});
ownedCards = 0;
foreach (var h in owned)
{
var id = h.id;
CollectionCards.CardIn(Slot(), S, h, S.InActivePreset(id), () => Root.ShowHero(id), autoGrid.Scale);
ownedCards++;
}
// 미보유 = 빈 카드 대신 그 영웅 카드(일러 조금 어둡게 · 「미보유」 · 탭 = 획득 안내) · ★ 높은 순 → 표 순서
// PD 2026-11-10 「왜 유닛 목록에 장수들의 모습이 보이지 않는거지? 이번에 추가된 리소스가 반영되도록」
// (상세 화면은 레벨·세이브가 있는 보유 영웅 전제라 미보유는 열지 않는다)
var locked = new List();
var all = S.Db.Heroes.heroes;
foreach (var h in all)
if (!S.Save.Owns(h.id) && S.Listed(h)) locked.Add(h); // 미보유 이름 없는 병사 = 숨김(얻을 수 없음 · PD 2026-11-25)
locked.Sort((a, b) => a.rarity != b.rarity ? b.rarity.CompareTo(a.rarity) : all.IndexOf(a).CompareTo(all.IndexOf(b)));
lockedCards = 0;
foreach (var h in locked)
{
var hero = h;
CollectionCards.CardIn(Slot(), S, h, false, () => OnLockedCard(hero), autoGrid.Scale, false);
lockedCards++;
}
countText.text = owned.Count + "/" + (owned.Count + locked.Count);
autoGrid.Apply();
}
/// 보유 카드 수(미보유 제외).
public int CardCount
{
get { return ownedCards; }
}
/// 미보유 영웅 카드 수(그림 카드 · PD 2026-11-10).
public int LockedCount
{
get { return lockedCards; }
}
}
///
/// 영웅 상세(UI 상업용 재설계 ① · PD 2026-11-09 확정 목업 hero_detail.html = 좌표·부품·색 SOT · 본문 y = 목업 y − 224) —
/// 등급 색 바탕(글로우 + 문양 · 화면 전체) · 전투력 칩 · 일러(좌우 밀기 = 영웅 전환) + 양옆 장비 6칸 · 레벨 행(레벨업 · 승급) · 이름 띠(세력 · 병종 · 등급 · ★) ·
/// 스킬 패널(액티브 · 패시브 · 행마다 레벨업) · 메뉴 4버튼(정보 = 상세정보 + 도감 · 진화 = 조각 팝업 · 각성 · 외형 = 준비 중). 색·스프라이트 = 테마 표(ui_theme.csv) id.
///
public class HeroDetailScreen : OutGameScreen
{
const float SwipeMin = 80f; // 일러 밀기 = 가로 80 px 이상(기준 해상도 px)
static readonly string[] MenuNames = { "정보", "진화", "각성", "외형" };
static readonly string[] MenuIcons = { "info", "star_l", "fire", "top" };
static readonly Vector2[] MenuIconSize = { new Vector2(26f, 60f), new Vector2(58f, 62f), new Vector2(64f, 50f), new Vector2(62f, 46f) };
string id;
readonly List order = new List();
Image bgFill;
Image bgGlow;
Image bgPattern;
// 진영 × 태생 ★ 장면 배경(PD 2026-11-19 · 표 Resources/UI/HeroBg/hero_bg · 표가 없으면 예전 등급 색 바탕)
public const string BgTable = "UI/HeroBg/hero_bg";
ScreenTable bgT;
Image sceneBg;
Image artGlow;
Image artShadow;
Text ownedText;
Text power;
RectTransform art;
float dragX;
readonly GameObject[] slotRoot = new GameObject[6];
readonly Image[] slotGlow = new Image[6];
readonly Image[] slotBg = new Image[6];
readonly Image[] slotDeco = new Image[6];
readonly Image[] slotLight = new Image[6];
readonly Image[] slotIcon = new Image[6];
readonly Text[] slotName = new Text[6];
readonly Image[] slotCheck = new Image[6];
readonly Image[] slotBag = new Image[6];
Text lvBadge;
Text lvText;
Text expText;
RectTransform expFill;
Image levelImg;
Text levelLabel;
Text levelCost;
Image goldIcon;
Image promoteImg;
Text promoteSub;
Image bandImg;
RectTransform factionRoot;
Image clsIcon;
Image paraImg;
Text gradeText;
Text nameText;
Text typeText;
RectTransform starRow;
Image panelImg;
GameObject coolChip;
Text coolText;
readonly Image[] rowImg = new Image[2];
readonly Image[] skFrame = new Image[2];
readonly Image[] skIcon = new Image[2];
readonly Image[] skRing = new Image[2];
readonly Image[] skCls = new Image[2];
readonly Text[] skName = new Text[2];
readonly Text[] skHanja = new Text[2];
readonly Text[] skDesc = new Text[2];
readonly Text[] skLv = new Text[2];
readonly Image[] skBtn = new Image[2];
readonly Text[] skBtnText = new Text[2];
readonly Text[] skBtnSub = new Text[2];
readonly GameObject[] skCost = new GameObject[2];
readonly Text[] skBooks = new Text[2];
readonly Text[] skGold = new Text[2];
Image evolveDot;
public string HeroId
{
get { return id; }
}
public void Select(string heroId)
{
id = heroId;
var h = S.Def(heroId);
order.Clear();
if (h != null)
foreach (var o in S.Owned()) order.Add(o.id);
}
// ---------- 목업 좌표 도우미(부모 왼쪽 위 기준 · y 아래로) · internal = 영웅 정보 팝업(HeroInfoPopup)이 같은 부품·색으로 그림 ----------
internal static Color Col(string colorId)
{
return UISkin.Col(colorId, Color.white);
}
internal static RectTransform At(Transform p, string name, float x, float y, float w, float h)
{
return UiKit.Rect(name, p, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, -y), new Vector2(w, h));
}
internal static Image Spr(Transform p, string name, string skin, float x, float y, float w, float h, string color, bool raycast = false)
{
return UiKit.Skin(At(p, name, x, y, w, h), skin, Col(color), raycast);
}
Image Press(Transform p, string name, string skin, float x, float y, float w, float h, string color, System.Action onClick)
{
var img = Spr(p, name, skin, x, y, w, h, color, true);
img.gameObject.AddComponent