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; } 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 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"), 1780f); var panel = (RectTransform)content.parent; foreach (var dd in new[] { -1, 1 }) { int k = dd; var b = Box(panel, dd < 0 ? "Prev" : "Next", W - (dd < 0 ? 300f : 216f), 26f, 72f, 72f, UiKit.Col("chip_dark", UiKit.Dark), true); b.gameObject.AddComponent