using System; using System.Collections.Generic; using System.Globalization; using UnityEngine; using UnityEngine.UI; namespace TKS.OutGame { /// /// 영웅 각성 · 진화 창 9종(2026-11-20 요청서 §0-5 · §5 2차 · 목업 각성진화_img 01~09) — 각성 · 각성 확률 · 높은 등급 경고 · 진화 · 진화 완료 · 비서 교환 · 각성 칸 열림 · 스킬 강화 · 만능 조각 확인. /// 창 위 = 고른 영웅 카드(초상 · 진영 · 병종 · 승급 등급 · 이름 · ★ · Lv / 최대 · 전투력 · 각성 몫) · ◀ ▶ = 영웅 정보 화면과 같은 순서로 넘김(창을 닫지 않음). /// 창 = 팝업(OutGameRoot.ModalCustom · Event) · 바뀌면 같은 창을 다시 그린다. 글자 = UI/Awaken/awaken_text · 아이콘·색 = awaken_screen · 값 = 표(C45). /// public static class AwakenWindows { public const string Texts = "UI/Awaken/awaken_text"; public const string Table = "UI/Awaken/awaken_screen"; const float W = 940f; const float L = 34f; const float RW = 872f; static Dictionary cfg; static string shopFaction; static string shopPick; /// 시험 · 캡처 — 마지막으로 연 창(awaken · prob · warn · evolve · done · shop) · 그 창의 영웅. public static string Last { get; private set; } public static string HeroId { get; private set; } [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] static void ResetStatics() { cfg = null; shopFaction = shopPick = null; Last = HeroId = 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 N(int v) { return v.ToString("N0", CultureInfo.InvariantCulture); } static string Cfg(string key, string def = "") { if (cfg == null) { cfg = new Dictionary(); var rows = UiText.Rows(Table); if (rows != null) foreach (var r in rows) { string k, v; if (r.TryGetValue("s_key", out k) && r.TryGetValue("s_value", out v) && k.Length > 0) cfg[k] = v; } } string s; return cfg.TryGetValue(key, out s) && s.Length > 0 ? s : def; } static Color Col(string key, Color def) { Color c; return ColorUtility.TryParseHtmlString(Cfg("color." + key), out c) ? c : def; } static Color Hex(string hex, Color def) { Color c; return ColorUtility.TryParseHtmlString(hex, out c) ? c : def; } // ---------- 공용 부품 ---------- /// 창 틀(팝업 · 버튼 없음) · 반환 = 판(왼쪽 위 기준 그리기 · 제목 띠 아래 y = 130 부터). static RectTransform Panel(OutGameRoot root, string title, float h, string headColor, string last, string heroId) { UiText.Use(Texts); Last = last; HeroId = heroId; var content = root.ModalCustom(title, h); var panel = (RectTransform)content.parent; var head = panel.Find("Head"); if (head != null && head.GetComponent() != null && headColor != null) head.GetComponent().color = Col(headColor, UiKit.Header); return panel; } 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 Image Ico(RectTransform p, string iconKey, float cx, float cy, float s) { var ic = UiKit.Icon(p, Cfg("icon." + iconKey, iconKey), new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(cx, -cy), s); if (ic != null) UiKit.DropShadow(ic, 2f); return ic; } static Button Btn(RectTransform p, string name, string skin, Color tint, string label, int size, Color fg, float x, float y, float w, float h, Action onClick) { return UiKit.SkinBtn(p, name, UISkin.Has(skin) ? skin : "button", tint, label, size, fg, x, y, w, h, onClick); } /// 고른 영웅 카드(창 위 · ◀ ▶) — small = 비서 교환 창의 작은 카드(넘김 없음). static float HeroCard(OutGameRoot root, RectTransform panel, string id, float y, bool awaken, Action reopen) { var s = root.Session; var h = s.Def(id); var hs = s.Save.Hero(id); var lv = s.Save.Level(id); var card = Box(panel, "HeroCard", L, y, RW, 200f, Col("card", UiKit.Dark)); var cr = card.rectTransform; if (reopen != null && GrowthUi.On) { // ◀ ▶ = 제목 좌우(PD 2026-11-20 · 성장 창 공통 자리) GrowthUi.TitleArrows(panel, d => reopen(root.HeroDetail.StepHero(d))); reopen = null; } if (reopen != null) { foreach (var d in new[] { -1, 1 }) { int dd = d; var ar = Box(cr, d < 0 ? "Prev" : "Next", d < 0 ? 12f : RW - 68f, 50f, 56f, 100f, Col("chip", UiKit.Dark), true); ar.gameObject.AddComponent