using System; using System.Collections.Generic; using System.Globalization; using UnityEngine; using UnityEngine.UI; namespace TKS.OutGame { /// /// 영웅 「정보」 창(2026-11-20 개발요청_영웅정보 · 목업 영웅정보_img 01 · 02 · 03) — 배너(진영 색 · 큰 유닛 · 한자 무늬 · 이름판) · 탭 능력치 / 열전 · ◀ ▶. /// 능력치 = 기본(병종 기본 × 영웅 배율) + 성장 = 합계(HeroRules.Compute 그대로) · 전투 능력치 7(스킬 패시브 + 각성 + 보물 세트 · 0 = 회색) · 성장 내역 6 + 바로가기 · 칸 = 내역 창. /// 열전 = hero_chronicle(연도 · 사건 · 연의 전기 편) · 없으면 「열전 준비 중」. 글자 = UI/HeroInfo/info_text · 값 = 표(C45). /// public static class HeroInfoWindow { public const string Texts = "UI/HeroInfo/info_text"; const float W = 940f; const float L = 34f; const float RW = 872f; static string heroId; static bool bio; /// 시험 · 캡처 — 마지막 창(stats · bio · breakdown). public static string Last { get; private set; } [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] static void ResetStatics() { heroId = Last = null; bio = false; descs = null; } static string T(string k) { return UiText.T(k).Replace("\\n", "\n"); } static string F(string k, params string[] a) { return UiText.F(k, a).Replace("\\n", "\n"); } static string P(float v) { return v.ToString("0.#", CultureInfo.InvariantCulture); } static Text Txt(RectTransform p, string name, string s, int size, Color c, float x, float y, float w, float h, TextAnchor a = TextAnchor.MiddleLeft, bool title = false) { var t = UiKit.Label(p, s, size, c, a, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, -y), new Vector2(w, h), title); t.name = name; if (title) UiKit.Title(t, true); t.horizontalOverflow = HorizontalWrapMode.Overflow; return t; } static Image Box(RectTransform p, string name, float x, float y, float w, float h, Color c, bool raycast = false) { return UiKit.Skin(UiKit.At(p, name, x, y, w, h), "card", c, raycast); } static Color Soft { get { return UiKit.Col("text_soft", UiKit.InkSoft); } } // ---------- 값(지금 HeroRules 그대로 · 기본 · 성장 몫만 나눠 꺼냄) ---------- /// 기본(병종 기본 × 영웅 배율) · 합계 — stat = hp|atk|def. public static void BaseTotal(HeroRules.Stats st, string stat, out float baseV, out float total) { switch (stat) { case "hp": baseV = st.baseHp * st.hpMult; total = st.hp; break; case "def": baseV = st.baseDef * st.defMult; total = st.def; break; default: baseV = st.baseAtk * st.atkMult; total = st.atk; break; } } /// 성장 내역 % (공격력 기준 · hero_info_sources s_key). public static float SourcePct(HeroRules.Stats st, string key) { switch (key) { case "lv": return st.lvPct; case "promo": return st.promoPct + st.gearPct; case "star": return st.starPct; case "train": return st.trainPct; case "treasure": return st.treasureAtkPct; case "awaken": return st.awakenAtkPct; } return 0f; } /// 전투 능력치(표 Battle 키 → 표시 % · 스킬 패시브 + 각성 + 보물 세트 합 · 밀기 = 곱 → % · 받는 피해 감소 = 양수 %). public static Dictionary BattleStats(OutGameSession s, HeroDb.Hero h, HeroState hs) { var db = s.Db; var res = new Dictionary(); foreach (var r in db.HeroInfo.stats) if (r.section == "Battle") res[r.key] = 0f; var fx = new List(); fx.AddRange(AwakenRules.Effects(db, hs)); var sk = SkillCatalog.Get(h.skillPassive); if (sk != null) fx.AddRange(sk.ScaledEffects(SkillRules.Level(hs, 1), SkillRules.PassiveMult(db, hs != null ? hs.star : h.rarity))); var tre = TreasureRules.BattleEffects(db, s.Save); if (tre != null) fx.AddRange(tre); foreach (var e in fx) { if (e == null || !res.ContainsKey(e.Key)) continue; float v; switch (e.Key) { case SkillKeys.PushMult: v = (e.P - 1f) * 100f; break; case SkillKeys.CounterTakenPct: case SkillKeys.DmgTakenRangedPct: v = -e.P * 100f; break; default: v = e.P * 100f; break; } res[e.Key] += v; } return res; } public const string DescTable = "UI/HeroInfo/hero_desc"; static Dictionary descs; /// 인물 설명 문단(표 s_key = 영웅 id · ko) · 없으면 "". public static string DescOf(string id) { if (descs == null) { descs = new Dictionary(); var rows = UiText.Rows(DescTable); if (rows != null) foreach (var r in rows) { string k, v; if (r.TryGetValue("s_key", out k) && r.TryGetValue("ko", out v) && !string.IsNullOrEmpty(k)) descs[k] = v; } } string d; return id != null && descs.TryGetValue(id, out d) ? d : ""; } // ---------- 창 ---------- public static void Open(OutGameRoot root, string id) { heroId = id; bio = false; Draw(root); } static void Draw(OutGameRoot root) { UiText.Use(Texts); var s = root.Session; var db = s.Db; var h = s.Def(heroId); var hs = s.Save.Hero(heroId); if (h == null || h.isSoldier || db.HeroInfo == null) { root.Toast(T("hi_none")); return; } Last = bio ? "bio" : "stats"; var content = root.ModalCustom(T("hi_title"), 1690f); var panel = (RectTransform)content.parent; // ◀ ▶ = 「영웅 정보」 제목 좌우(PD 2026-11-20) GrowthUi.TitleArrows(panel, k => { heroId = root.HeroDetail.StepHero(k); Draw(root); }); var st = s.StatsOf(heroId); // 장면 창 = 로비 배경 · 영웅 오른쪽(PD 2026-11-20 「캐릭터 배경을 로비와 같이」 · 구 진영 원색 판 폐지) var sc = GrowthUi.Scene(panel, "info", h); float y = sc.anchoredPosition.y * -1f; var ic = GrowthUi.L("info_card"); float cx = GrowthUi.At(ic, 0, 54f), cy = GrowthUi.At(ic, 1, 150f), cw = GrowthUi.At(ic, 2, 440f); // 진영 · 병종 · 승급 칩 var fb = UiKit.FactionBadge(panel, h.faction, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(cx + 26f, -(cy + 26f)), 48f); if (fb != null) UiKit.DropShadow(fb, 2f); var ti = UiKit.Icon(panel, UiKit.TypeSymbolId(h.type), new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(cx + 84f, -(cy + 26f)), 48f); if (ti != null) UiKit.DropShadow(ti, 2f); if (hs != null) { var gc = UiKit.Skin(UiKit.At(panel, "Grade", cx + 116f, cy + 4f, 60f, 44f), "chip", UiKit.GradeColor(hs.grade)); UiKit.GradeTint(gc, hs.grade); UiKit.Title(UiKit.FillLabel(gc.transform, UiKit.GradeKo(hs.grade), 24, UiKit.White), true); } // 이름 = 붉은 옻칠 명패 var np = GrowthUi.L("name_plaque"); GrowthUi.Plaque(panel, "Name", h.nameKo, cx, cy + 60f, Mathf.Min(cw, GrowthUi.At(np, 1, 404f)), GrowthUi.At(np, 2, 92f), 46); // 별호 · ★ · 레벨 = 장면 위 어두운 반투명 판 var card = GrowthUi.Card(panel, "Plate", cx, cy + 164f, cw, 150f, GrowthUi.At(ic, 3, 0.82f)).rectTransform; string ep = db.HeroInfo.EpithetOf(h.id); Txt(card, "Epithet", (ep.Length > 0 ? ep + " · " : "") + UnitTypeInfo.Korean(h.type), 24, GrowthUi.Col("soft", Soft), 20f, 10f, cw - 40f, 36f); int max = db.Evolve.MaxStar, star = hs != null ? hs.star : h.rarity; for (int i = 0; i < max; i++) { var si = UiKit.Icon(card, i < star ? "star_l" : "star_off", new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(42f + i * 50f, -74f), 48f); if (si != null) UiKit.DropShadow(si, 2f); } var lv = s.Save.Level(heroId); Txt(card, "Lv", "Lv " + (lv != null ? lv.lv : 1) + " / " + AwakenRules.HeroLevelCap(db, s.Save, lv), 30, UiKit.White, 24f, 102f, cw - 48f, 40f, TextAnchor.MiddleLeft, true); // 전투력 = 목패 + 칼 아이콘 · 각성 몫은 아래 작은 글자 var pt = GrowthUi.Tag(panel, "Power", "sword", F("hi_power", st.power.ToString("N0")), cx, cy + 326f, cw, 64f, 32, GrowthUi.Col("gold", UiKit.Coin)); if (hs != null) { var aw = Txt((RectTransform)pt.transform.parent, "AwPower", F("hi_awaken_power", AwakenRules.Power(db, s.Cfg, h, hs, s.Save).ToString("N0")), 22, GrowthUi.Col("soft", Soft), 0f, 14f, cw - 18f, 36f, TextAnchor.MiddleRight); aw.raycastTarget = false; } y += sc.rect.height + 20f; // 탭 float tw = (RW - 16f) * 0.5f; for (int i = 0; i < 2; i++) { bool on = (i == 1) == bio; bool to = i == 1; var tb = UiKit.SkinBtn(panel, i == 0 ? "TabStats" : "TabBio", on ? "btn_red" : "btn_s_gray", UiKit.White, T(i == 0 ? "hi_tab_stats" : "hi_tab_bio"), 32, UiKit.White, L + i * (tw + 16f), y, tw, 78f, () => { bio = to; Draw(root); }); if (!UISkin.Has(on ? "btn_red" : "btn_s_gray")) tb.GetComponent().color = on ? UiKit.Red : UiKit.Dark; } y += 96f; float end = bio ? DrawBio(root, panel, h, y) : DrawStats(root, panel, h, hs, st, y); GrowthUi.Place(panel, end); // 판 윗변 고정 · 높이 = 내용(Fable QA r1 M1 · M2) } static void Section(RectTransform panel, string name, string head, string hint, float y) { var t = Txt(panel, name, head, 30, UiKit.White, L + 10f, y, 400f, 44f, TextAnchor.MiddleLeft, true); Txt(panel, name + "Hint", hint, 20, Soft, L + 24f + t.preferredWidth, y + 6f, 400f, 34f); } static float DrawStats(OutGameRoot root, RectTransform panel, HeroDb.Hero h, HeroState hs, HeroRules.Stats st, float y) { var db = root.Session.Db; float cw = (RW - 16f) * 0.5f; Section(panel, "Base", T("hi_base"), T("hi_base_hint"), y); y += 52f; int bi = 0; var bicons = new Dictionary(); foreach (var b in GrowthUi.Tb != null ? GrowthUi.Tb.All("base_icon") : new List()) bicons[ScreenTable.Str(b, 0)] = ScreenTable.Str(b, 1); foreach (var r in db.HeroInfo.stats) { if (r.section != "Base") continue; float x = L + (bi % 2) * (cw + 16f), cy = y + (bi / 2) * 96f; var c = GrowthUi.Row(panel, "Base_" + r.key, x, cy, cw, 86f, r.show == "BaseBonus"); var cr = c.rectTransform; string bic; float nx = 16f; if (bicons.TryGetValue(r.key, out bic)) { var bimg = UiKit.Icon(cr, bic, new Vector2(0f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(46f, 0f), 62f); if (bimg != null) { UiKit.DropShadow(bimg, 2f); nx = 86f; } } Txt(cr, "Name", r.nameKo, 26, UiKit.White, nx, 22f, 200f, 42f, TextAnchor.MiddleLeft, true); if (r.show == "BaseBonus") { float bv, tot; BaseTotal(st, r.key, out bv, out tot); Txt(cr, "Base", Mathf.RoundToInt(bv).ToString("N0"), 20, UiKit.White, cw - 330f, 12f, 120f, 30f, TextAnchor.MiddleRight); Txt(cr, "Bonus", "+" + Mathf.RoundToInt(tot - bv).ToString("N0"), 20, UiKit.Col("up", UiKit.Ok), cw - 330f, 42f, 120f, 30f, TextAnchor.MiddleRight); Txt(cr, "Total", Mathf.RoundToInt(tot).ToString("N0"), 38, UiKit.White, cw - 200f, 18f, 184f, 50f, TextAnchor.MiddleRight, true); string key = r.key, nm = r.nameKo; c.gameObject.AddComponent