using System.Collections.Generic; using System.Text; using UnityEngine; using UnityEngine.UI; namespace TKS.OutGame { /// /// 전투 결과 패널(기획서 §6 · 비주얼 = Fable 제안서 §4-2 #1104) — 별 3(받침 원 + 등장 튀김) · 조건 행 3 · 보상 타일(골드 · 경험 · 보옥 · 장비 · 상자) · /// 버튼 = 「다시」(Tertiary · 같은 스테이지 재도전) + 「확인」(Primary 노랑) · 승리면 리본 뒤 금빛. /// 전투 HUD 의 승리/패배 판(sortingOrder 100) 위에 덮는다 · 화면 아무 데나 탭 = 기존 그대로(SlingshotInput → 월드맵 복귀 · 「다시」 위만 제외). /// public class BattleResultPanel { // 패널 배치(UI px · 패널 왼쪽 위 기준) const float PW = 920f; const float PH = 1420f; // 글자 1.2 배 · 스테이지 정보 줄(+80 · PD 2026-11-24) + 전리품 줄(+260 · 2026-11-23 스테이지 보상 드랍) — 두 PC 변경 합침 const float Side = 60f; const float RowW = PW - Side * 2f; const float RowH = 64f; const float Tile = 132f; const float BtnY = PH - 40f - 110f; // 승전보 두루마리 = 본문 판보다 옆 · 위 · 아래로 넓게(축이 본문 · 버튼을 덮지 않게) · 제목 명패 크기 const float PaperSide = 28f, PaperTop = 70f, PaperBottom = 96f, PlaqueW = 700f, PlaqueH = 150f; bool paper; readonly OutGameRoot root; readonly GameObject go; readonly Text title; readonly Image ribbon; readonly Image glow; readonly RectTransform starRow; readonly Image[] starImg = new Image[3]; readonly RectTransform body; readonly Text plain; readonly Button retry; readonly Button ok; readonly Text retryCost; string rewardsText = ""; public bool Visible { get { return go.activeSelf; } } public string RewardsText { get { return rewardsText; } } public BattleResultPanel(OutGameRoot r, RectTransform canvas) { root = r; var dim = UiKit.Fill("Result", canvas); UiKit.Paint(dim, UISkin.Col("dim", new Color(0f, 0f, 0f, 0.55f)), false); go = dim.gameObject; Image panel = null; if (UISkin.Has("popup") && UISkin.Has("panel_frame")) { // 리본 뒤 금빛(승리만 · 팩 Glow_Circle01 · 호흡) → 팩 팝업 틀 → 제목 리본(승리 붉은 · 패배 회색) if (UISkin.Has("glow_circle")) { glow = UiKit.Skin(UiKit.Rect("Glow", dim, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 20f + PH * 0.5f + 90f), new Vector2(1240f, 1240f)), "glow_circle", UiKit.Col("ribbon_glow", Color.clear)); var pulse = glow.gameObject.AddComponent(); pulse.min = 0.65f; pulse.period = 1.6f; // 안쪽 한 겹 더(그림 가운데 α 0.5 라 한 장으로는 후광이 약함 · 검수2 보충) var core = UiKit.Skin(UiKit.Rect("Core", glow.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(720f, 720f)), "glow_circle", UiKit.Col("ribbon_glow", Color.clear)); core.raycastTarget = false; } // 패널 = 섹션 패널 층(그림자 · 밝은 프레임 #3F4262 · 필드 #262840 · 윗면 광택 · 검수 결함 10) var holder = UiKit.Rect("Panel", dim, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 20f), new Vector2(PW, PH)); RectTransform froot; UiKit.SectionPanel(holder, "Frame", 0f, 0f, PW, PH, false, false, out froot); var pt = (Transform)holder; // 승전보(PD 2026-11-25 「인게임 결과창도 우리 게임의 컨셉과 화풍에 맞게 통일감 있는 디자인」) = 양피지 두루마리(공방 제작 주문서 · 출정 군령장과 같은 판) · 위아래 축은 본문 밖으로 var paperImg = UiKit.Fill("Paper", holder, -PaperSide, -PaperSide, -PaperTop, -PaperBottom).gameObject.AddComponent(); paperImg.raycastTarget = false; paper = PaperScroll.Apply(paperImg); if (paper) { paperImg.transform.SetAsFirstSibling(); var fr = holder.Find("Frame"); if (fr != null) fr.gameObject.SetActive(false); } else Object.Destroy(paperImg.gameObject); var rib = UiKit.Rect("Ribbon", pt, new Vector2(0.5f, 1f), new Vector2(0.5f, 0.5f), new Vector2(0f, 10f), new Vector2(1000f, 200f)); ribbon = UiKit.Skin(rib, "ribbon", Color.white); title = UiKit.Title(UiKit.FillLabel(rib, "", 88, UiKit.White, TextAnchor.MiddleCenter, true, 150f), true); title.rectTransform.offsetMin = new Vector2(150f, 34f); var plaque = paper ? UISkin.Icon("tre_plaque") : null; if (plaque != null) { // 제목 = 붉은 칠 명패(서양식 팩 리본 대신 · PD 2026-11-21 「리본 형태 UI 가 어울리지 않음」 · 패배 = 어두운 칠) rib.sizeDelta = new Vector2(PlaqueW, PlaqueH); var gl = rib.Find(UISkin.OverlayName); if (gl != null) gl.gameObject.SetActive(false); ribbon.sprite = plaque; ribbon.type = Image.Type.Sliced; ribbon.pixelsPerUnitMultiplier = plaque.rect.height / PlaqueH; title.fontSize = 76; title.rectTransform.offsetMin = new Vector2(90f, 10f); title.rectTransform.offsetMax = new Vector2(-90f, -10f); } // 별 3 = 받침 원 없이 별만 크게(PD 2026-11-24 「별 크기를 키우고 둥근 프레임 제거」) · 가운데 크게 · 위로 · 0.15 s 간격 튀김 starRow = UiKit.At(pt, "StarRow", 0f, 110f, PW, 220f); UiLayer.Nest(starRow.gameObject, UiRate.Frame, false); // 별 3 튀김 = 한 Frame 층(별마다 캔버스를 만들지 않음 · PD 2026-11-10) for (int i = 0; i < 3; i++) { bool mid = i == 1; var pos = new Vector2((i - 1) * 215f, mid ? 14f : -16f); starImg[i] = UiKit.Icon(starRow, "star_on_l", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), pos, mid ? 176f : 140f); if (starImg[i] == null) continue; UiKit.DropShadow(starImg[i], 5f); starImg[i].gameObject.AddComponent().delay = 0.15f * i; } body = UiKit.Fill("Body", pt); retry = UiKit.SkinBtn(pt, "Retry", "round08", UiKit.Col("menu_btn", UiKit.Dark), "다시", 34, UiKit.White, Side, BtnY, 260f, 110f, () => root.RetryStage()); retryCost = UiKit.BtnCost(retry, "cur_stamina", "", 36f, 28); // 재도전 = 군량 소모 표시(검수 결함 2) if (paper) retry.GetComponent().color = UiKit.Col("ws_btn_wood", new Color(0.47f, 0.3f, 0.18f)); // 승전보 위 = 나무색(남색 팩 칠이 혼자 튀지 않게 · QA r3 M10) stageLine = UiKit.Title(UiKit.Label(pt, "", 34, UiKit.Col("text_soft", UiKit.InkSoft), TextAnchor.MiddleCenter, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -334f), new Vector2(RowW, 52f), false)); // 스테이지 정보(PD 2026-11-24 「제목은 승리 · 패배만 · 스테이지 정보는 메뉴 안」) ok = UiKit.SkinBtn(pt, "Ok", UISkin.Has("btn_l_yellow") ? "btn_l_yellow" : "button", UISkin.Has("btn_l_yellow") ? UiKit.White : UiKit.Coin, OkText, 46, UiKit.Col("text_on_yellow", UiKit.Ink), PW - Side - 520f, BtnY, 520f, 110f, null); } else { panel = UiKit.Box("Panel", dim, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 40f), new Vector2(PW, PH), UiKit.Paper); UiKit.Border(panel, UiKit.Line, 4f); var head = UiKit.TopBand("Head", panel.transform, 0f, 170f); UiKit.Paint(head, UiKit.Dark); title = UiKit.FillLabel(head, "", 96, UiKit.White); plain = UiKit.Label(panel.transform, "", 36, UiKit.Ink, TextAnchor.UpperLeft, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -200f), new Vector2(760f, 860f), false); plain.lineSpacing = 1.15f; UiKit.Label(panel.transform, "화면을 탭하면 계속", 34, UiKit.InkSoft, TextAnchor.MiddleCenter, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 36f), new Vector2(800f, 60f), false); } BuildTip(dim); ApplyGameFont(dim, 1.12f); // 게임 글꼴 + 조금 크게(PD 2026-11-24 「우리 게임 폰트 · 모바일에서 잘 보이게」) — 본문은 Fill 에서 따로 go.SetActive(false); } Text stageLine; GameObject tipRoot; /// /// 게임 팁 = 팝업 밖 아래의 「!」 말풍선(PD 2026-11-24 「팝업 UI 에 표시하지 말고 게임 팁 형태로 하단에 별도의 ! 말풍선」) — 패배 때만. /// void BuildTip(RectTransform dim) { var tr = UiKit.Rect("Tip", dim, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 150f), new Vector2(PW, 120f)); tipRoot = tr.gameObject; var bubble = UiKit.Rect("Bubble", tr, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(46f, 0f), new Vector2(PW - 92f, 104f)); if (UiKit.Skin(bubble, "round08", UiKit.Col("tip_bubble", new Color(0.13f, 0.14f, 0.22f, 0.94f))) == null) UiKit.Paint(bubble, new Color(0.13f, 0.14f, 0.22f, 0.94f)); var tail = UiKit.Rect("Tail", bubble, new Vector2(0f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), new Vector2(30f, 30f)); tail.localRotation = Quaternion.Euler(0f, 0f, 45f); UiKit.Paint(tail, UiKit.Col("tip_bubble", new Color(0.13f, 0.14f, 0.22f, 0.94f)), false); var bang = UiKit.Rect("Bang", tr, new Vector2(0f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(46f, 0f), new Vector2(92f, 92f)); if (UiKit.Skin(bang, "circle_frame", UiKit.Col("tip_bang", new Color(1f, 0.72f, 0.16f))) == null) UiKit.Paint(bang, new Color(1f, 0.72f, 0.16f)); UiKit.Title(UiKit.FillLabel(bang, "!", 62, UiKit.White), true); var head = UiKit.Label(bubble, "게임 팁", 26, UiKit.Col("tip_head", new Color(1f, 0.8f, 0.3f)), TextAnchor.UpperLeft, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(64f, -10f), new Vector2(PW - 200f, 36f), false); head.horizontalOverflow = HorizontalWrapMode.Overflow; var body2 = UiKit.Label(bubble, "영웅 레벨업 · 승급 · 편성을 바꿔 다시 도전", 32, UiKit.White, TextAnchor.UpperLeft, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(64f, -48f), new Vector2(PW - 200f, 46f), false); body2.verticalOverflow = VerticalWrapMode.Truncate; // 한 줄 · 넘치면 줄임(최적 맞춤은 Truncate 여야 높이를 봄) body2.resizeTextForBestFit = true; body2.resizeTextMaxSize = 32; body2.resizeTextMinSize = 22; tipRoot.SetActive(false); } /// 게임 글꼴(제목 글꼴 = 인게임 HUD 와 같음) 적용 + 글자 크기 배율(PD 2026-11-24). static void ApplyGameFont(Transform t, float scale) { if (t == null) return; foreach (var x in t.GetComponentsInChildren(true)) { UISkin.UseTitle(x); x.fontSize = Mathf.RoundToInt(x.fontSize * scale); if (x.resizeTextForBestFit) x.resizeTextMaxSize = Mathf.RoundToInt(x.resizeTextMaxSize * scale); } } public void SetVisible(bool on) { if (go.activeSelf != on) go.SetActive(on); } /// 화면 좌표가 「다시」 버튼 위인가 — 화면 탭(월드맵 복귀)을 이 버튼에서는 건너뛴다. public bool PointerOnRetry(Vector2 screen) { if (retry == null || !go.activeInHierarchy || !retry.gameObject.activeSelf) return false; var c = go.GetComponentInParent(); return RectTransformUtility.RectangleContainsScreenPoint((RectTransform)retry.transform, screen, c != null ? c.worldCamera : null); } public void Fill(StageReward r) { var s = root.Session; rewardsText = r.win ? RewardText(s, r) : "보상 없음"; title.text = r.win ? "승리" : "패배"; // 제목 = 승리 · 패배만(PD 2026-11-24) if (stageLine != null) { string nm = root.Battle != null && root.Battle.Stage != null ? root.Battle.Stage.title : ""; stageLine.text = r.chapter + "-" + r.stage + (r.boss ? " 보스" : "") + (string.IsNullOrEmpty(nm) ? "" : " " + nm); stageLine.gameObject.SetActive(true); } if (tipRoot != null) tipRoot.SetActive(!r.win); ShowStars(r.win ? r.stars : 0, r.win); SetButtons(true); if (retryCost != null && root.Battle != null && root.Battle.Config != null && root.Battle.StageIndex >= 0 && root.Battle.StageIndex < root.Battle.Config.stages.Length) { int cost = EconomyRules.StageCost(s.Db, s.Save, root.Battle.Config.stages[root.Battle.StageIndex], s.Hard); retryCost.text = cost.ToString(); retry.GetComponent().color = s.Save.stamina >= cost ? (paper ? UiKit.Col("ws_btn_wood", new Color(0.47f, 0.3f, 0.18f)) : UiKit.Col("menu_btn", UiKit.Dark)) : UiKit.Col("disabled", UiKit.Disabled); // 승전보 위 = 나무색 } if (body == null) { plain.text = (r.win ? "별 " + UiKit.Stars(r.stars, 3) + "\n\n" : "아군이 전멸했습니다\n\n") + rewardsText; return; } UiKit.Clear(body); float y = 400f; // 스테이지 정보 줄 아래(PD 2026-11-24) if (r.win) { string[] cond = { "스테이지 클리어", "아군 전원 생존", r.starTurns + "턴 이내 클리어 (" + r.turns + "턴)" }; for (int i = 0; i < 3; i++) UiKit.CondRow(body, "Cond" + i, Side, y + i * (RowH + 8f), RowW, RowH, r.conds[i] ? "check" : "x_small", r.conds[i], cond[i], 30); } else { UiKit.CondRow(body, "Cond0", Side, y, RowW, RowH, "x_small", false, "아군이 전멸했습니다", 30); UiKit.CondRow(body, "Cond1", Side, y + RowH + 8f, RowW, RowH, "cur_stamina", false, "군량 " + r.stamina + " 소모 · 별 없음", 30, false); } y = 630f; var rewardTitle = UiKit.SubTitle(body, "보상" + MultNote(r), Side, y, RowW); // 지역 · 보스 배율이 붙은 판 = 소제목에 「골드 ×1.5」(stage_drop) rewardTitle.name = "RewardTitle"; y += 64f; if (!r.win) { var none = UiKit.Title(UiKit.Label(body, "보상 없음", 40, UiKit.Col("text_soft", UiKit.InkSoft), TextAnchor.MiddleCenter, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(Side, -y - 10f), new Vector2(RowW, 70f))); none.horizontalOverflow = HorizontalWrapMode.Overflow; ApplyGameFont(body, 1.2f); // 팁 = 팝업 밖 「!」 말풍선(BuildTip) return; } Tiles(s, r, y); float sy = y + Tile + 62f; Spoils(s, r, sy); Notes(s, r, sy + 64f + Tile + 96f); ApplyGameFont(body, 1.2f); if (paper) PaperScroll.Tone(body.parent); // 본문 + 스테이지 줄 // 종이 위 색(먹 글자 · 황갈 줄) } /// 보상 타일 행(가운데 정렬 · 칸 아래 이름) — 골드 · 경험 · 보옥(있을 때) · 보물 상자(있을 때) · 장비는 아래 「전리품」 줄. void Tiles(OutGameSession s, StageReward r, float y) { var list = new List(); // 아이콘 · 수량 · 칸 색 접두 · 이름 list.Add(new[] { "cur_gold", r.gold.ToString("N0"), "gear_white_", r.first ? "골드" : "골드 ×" + s.Db.Economy.RepeatRewardMult }); list.Add(new[] { "cur_exp", r.exp.ToString("N0"), "gear_white_", "경험 · " + r.expTo.Count + "명" }); if (r.gem > 0) list.Add(new[] { "cur_gem", r.gem.ToString("N0"), "gear_blue_", "보옥" }); if (r.shards > 0) list.Add(new[] { "cur_shard", r.shards.ToString("N0"), "gear_purple_", (s.Def(r.shardHero) != null ? s.Def(r.shardHero).nameKo : r.shardHero) + " 조각" }); // 하드 보스 조각(2026-11-24) if (!string.IsNullOrEmpty(r.chest) && s.Db.Chests != null && s.Db.Chests.Get(r.chest) != null) list.Add(new[] { "chest_" + r.chest, "", "gear_purple_", s.Db.Chests.Get(r.chest).nameKo }); float gap = list.Count >= 5 ? 22f : 30f; float x = (PW - list.Count * Tile - (list.Count - 1) * gap) * 0.5f; for (int i = 0; i < list.Count; i++) { var e = list[i]; float tx = x + i * (Tile + gap); var cell = UiKit.RewardTile(body, "Tile" + i, tx, y, Tile, e[2], e[0], e[1], e[2] != "gear_white_"); if (r.first && (e[0] == "cur_gold" || e[0] == "cur_gem")) FirstBadge(cell); // 첫 클리어 = 뱃지(스테이지 팝업과 같은 표현 · 검수 결함 8) var n = UiKit.Label(body, e[3], 26, UiKit.Col("text_soft", UiKit.InkSoft), TextAnchor.UpperCenter, new Vector2(0f, 1f), new Vector2(0.5f, 1f), new Vector2(tx + Tile * 0.5f, -y - Tile - 12f), new Vector2(Tile + gap, 36f), false); n.horizontalOverflow = HorizontalWrapMode.Overflow; } } /// /// 「전리품」 줄(2026-11-23 스테이지 보상 드랍 §2-3) — 상자 1개 = 장비 칸 1개(등급 색) · 보스 첫 클리어 확정 상자 = 「확정」 뱃지 · /// 칸 아래 이름 + 꼬리표(「지정 장비」 = 이 스테이지 지정 2종 · 「필요 영웅」 = 내 영웅의 빈 승급 칸에 들어가는 장비) · 상자가 없던 판 = 한 줄 안내. /// void Spoils(OutGameSession s, StageReward r, float y) { var soft = UiKit.Col("text_soft", UiKit.InkSoft); UiKit.SubTitle(body, "전리품", Side, y, RowW); y += 64f; if (r.gearIds.Count == 0) { var none = UiKit.Label(body, "이번에는 장비가 나오지 않았습니다", 30, soft, TextAnchor.MiddleCenter, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(Side, -y - 36f), new Vector2(RowW, 60f), false); none.name = "NoSpoils"; none.horizontalOverflow = HorizontalWrapMode.Overflow; return; } var focus = s.Db.Gear.FocusFor(r.chapter, r.stage); int n = Mathf.Min(r.gearIds.Count, MaxSpoilTiles); float gap = n >= 5 ? 22f : 34f; float x = (PW - n * Tile - (n - 1) * gap) * 0.5f; for (int i = 0; i < n; i++) { var g = s.Db.Gear.Get(r.gearIds[i]); string grade = g != null && !string.IsNullOrEmpty(g.grade) ? g.grade : "white"; float tx = x + i * (Tile + gap); var cell = UiKit.RewardTile(body, "Spoil" + i, tx, y, Tile, "gear_" + grade + "_", g != null ? (g.icon.Length > 0 ? g.icon : "gear_" + g.kind) : "cur_gear", "", true); if (i < r.fixedChests) FirstBadge(cell, "확정", 20); var nm = UiKit.Label(body, g != null ? g.nameKo : r.gearIds[i], 26, soft, TextAnchor.UpperCenter, new Vector2(0f, 1f), new Vector2(0.5f, 1f), new Vector2(tx + Tile * 0.5f, -y - Tile - 10f), new Vector2(Tile + gap, 36f), false); nm.horizontalOverflow = HorizontalWrapMode.Overflow; string tag = SpoilTag(s, r, g, focus); if (tag.Length == 0) continue; var tg = UiKit.Label(body, tag, 22, UiKit.Col("select_line", UiKit.Coin), TextAnchor.UpperCenter, new Vector2(0f, 1f), new Vector2(0.5f, 1f), new Vector2(tx + Tile * 0.5f, -y - Tile - 44f), new Vector2(Tile + gap, 30f), false); tg.name = "SpoilTag" + i; tg.horizontalOverflow = HorizontalWrapMode.Overflow; } } /// 이번 판에 곱해진 스테이지 배율 글(「 · 골드 ×1.5」 · 「 · 골드 ×2 · 경험 ×2」 · 배율 1 = 빈 글자). static string MultNote(StageReward r) { if (!r.win) return ""; var inv = System.Globalization.CultureInfo.InvariantCulture; string t = ""; if (r.goldMult != 1f) t += " · 골드 ×" + r.goldMult.ToString("0.##", inv); if (r.expMult != 1f) t += " · 경험 ×" + r.expMult.ToString("0.##", inv); return t; } /// 전리품 줄에 그리는 장비 칸 수 상한(화면 폭) — 넘는 상자도 지급은 된다. const int MaxSpoilTiles = 5; /// 장비 꼬리표 — 「필요 영웅 이름」(출전 영웅 먼저 · 다음 보유 영웅의 빈 승급 칸) 이 「지정 장비」 보다 먼저. static string SpoilTag(OutGameSession s, StageReward r, GearDb.Item g, GearDb.StageDrop focus) { if (g == null) return ""; string need = NeedHero(s, g.id, r.expTo); if (need.Length > 0) return "필요 " + need; if (focus != null && g.unitType == focus.unitType && System.Array.IndexOf(focus.kinds, g.kind) >= 0) return "지정 장비"; return ""; } /// 그 장비가 빈 승급 칸에 들어가는 영웅 이름(first = 먼저 볼 영웅 id · 없으면 빈 글자). static string NeedHero(OutGameSession s, string gearId, List first) { string other = ""; foreach (var hs in s.Save.heroes) { var h = s.Def(hs.id); var list = h != null ? s.Db.Heroes.GearFor(h, hs.grade) : null; if (list == null) continue; for (int i = 0; i < list.Count && i < hs.gear.Count; i++) { if (list[i] != gearId || !string.IsNullOrEmpty(hs.gear[i])) continue; if (first != null && first.Contains(hs.id)) return h.nameKo; if (other.Length == 0) other = h.nameKo; break; } } return other; } /// 뱃지(Label_Badge01_Yellow · 칸 오른쪽 위 · 글자 = 「첫」 · 「확정」). public static void FirstBadge(Transform cell, string text = "첫", int size = 24) { var b = UiKit.Icon(cell, "badge_first", new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), new Vector2(-8f, -6f), 58f); if (b != null) UiKit.Title(UiKit.FillLabel(b.transform, text, size, UiKit.White), true); } /// 타일 아래 = 레벨업 가능 칩(위 화살표 + 노란 글자 · 검수 결함 8) · 없으면 비움. void Notes(OutGameSession s, StageReward r, float y) { var ready = ReadyNames(s, r); if (ready.Length == 0) return; string text = "레벨업 가능 " + ready; var t = UiKit.InfoChip(body, "LevelUp", Side, y, RowW, 56f, "up_green", text, 28); t.color = UiKit.Col("select_line", UiKit.Coin); float w = Mathf.Min(RowW, Mathf.Ceil(t.preferredWidth * 1.2f) + 120f); // 뒤에서 글자 1.2 배(ApplyGameFont) — 넘친 글자가 종이 위 흰 글자로 남지 않게 var c = (RectTransform)t.transform.parent; c.anchoredPosition = new Vector2((PW - w) * 0.5f, -y); c.sizeDelta = new Vector2(w, 56f); t.rectTransform.sizeDelta = new Vector2(w - 80f, 56f); } /// 연무장 결과(탑 · 던전 · 투기장 · 적장 토벌 · PD #1093 C) — 별 없음 · 결과 행 · 탭 = 연무장. public void FillMode(ModeResult r) { SetButtons(false); if (stageLine != null) stageLine.gameObject.SetActive(false); // 연무장 결과 = 스테이지 정보 줄 · 게임 팁 없음 if (tipRoot != null) tipRoot.SetActive(false); rewardsText = r != null ? string.Join("\n", r.lines.ToArray()) : ""; if (r == null) { title.text = "군영"; // PD 2026-11-21 「연무장 → 군영」 ShowStars(-1, true); if (body != null) UiKit.Clear(body); else plain.text = ""; return; } bool win = r.win || r.kind == ArenaRules.Raid; title.text = r.kind == ArenaRules.Raid ? "토벌 종료" : r.win ? "승리" : "패배"; ShowStars(-1, win); if (body == null) { plain.text = "" + r.title + "\n\n" + rewardsText; return; } UiKit.Clear(body); var head = UiKit.Title(UiKit.Label(body, r.title, 44, UiKit.White, TextAnchor.MiddleCenter, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(Side, -150f), new Vector2(RowW, 110f)), true); head.horizontalOverflow = HorizontalWrapMode.Overflow; UiKit.SubTitle(body, "결과", Side, 290f, RowW); float y = 354f; for (int i = 0; i < r.lines.Count && y + RowH <= BtnY - 20f; i++, y += RowH + 8f) UiKit.CondRow(body, "Line" + i, Side, y, RowW, RowH, null, true, r.lines[i], 30); if (paper) PaperScroll.Tone(body.parent); // 본문 + 스테이지 줄 } /// 「확인」 버튼 글자를 바꾼다(첫 실행 흐름의 서장 패배 = 「다시 도전」 · 다음 결과를 채울 때 「확인」으로 돌아감). public void SetOkText(string s) { var t = ok != null ? UiKit.LabelOf(ok) : null; if (t != null && !string.IsNullOrEmpty(s)) t.text = s; } const string OkText = "확인"; /// 스테이지 = 「다시」 + 「확인」 · 연무장 = 「확인」 가운데. void SetButtons(bool stage) { if (ok != null && UiKit.LabelOf(ok) != null) UiKit.LabelOf(ok).text = OkText; if (retry == null) return; retry.gameObject.SetActive(stage); ((RectTransform)ok.transform).anchoredPosition = new Vector2(stage ? PW - Side - 520f : (PW - 520f) * 0.5f, -BtnY); } /// 별 아이콘(n < 0 = 숨김) · 리본 색(승리 붉은 · 패배 회색) · 금빛 = 승리만. void ShowStars(int n, bool win) { if (glow != null) glow.gameObject.SetActive(win); if (starRow == null) return; starRow.gameObject.SetActive(n >= 0); for (int i = 0; i < 3; i++) if (starImg[i] != null) starImg[i].sprite = UISkin.Icon(i < n ? "star_on_l" : "star_off") ?? starImg[i].sprite; if (ribbon != null && paper && ribbon.sprite == UISkin.Icon("tre_plaque")) ribbon.color = win ? Color.white : UiKit.Col("ws_tab_off", new Color(0.34f, 0.3f, 0.32f, 1f)); // 명패 = 승리 붉은 칠 · 패배 어두운 칠 else if (ribbon != null && !UISkin.Apply(ribbon, win ? "ribbon" : "ribbon_gray")) ribbon.color = win ? Color.white : UiKit.Disabled; } static string ReadyNames(OutGameSession s, StageReward r) { var ready = new StringBuilder(); foreach (var id in r.expTo) { var lv = s.Save.Level(id); if (HeroRules.CanLevelUp(s.Db, s.Save, lv) != null) continue; if (ready.Length > 0) ready.Append(" · "); ready.Append(s.Def(id).nameKo); } return ready.ToString(); } /// 보상 줄(소탕 팝업 · 테마 없을 때 결과 화면 공용). public static string RewardText(OutGameSession s, StageReward r) { var e = s.Db.Economy; var sb = new StringBuilder(); sb.Append("골드 +").Append(r.gold.ToString("N0")).Append(r.first ? " (첫 클리어)" : " (반복 ×" + e.RepeatRewardMult + ")"); sb.Append("\n경험 +").Append(r.exp).Append(" 출전 ").Append(r.expTo.Count).Append("명"); if (r.gem > 0) sb.Append("\n보옥 +").Append(r.gem).Append(r.boss ? " (첫 클리어 + 보스)" : " (첫 클리어)"); if (r.shards > 0) sb.Append("\n").Append(s.Def(r.shardHero) != null ? s.Def(r.shardHero).nameKo : r.shardHero).Append(" 조각 +").Append(r.shards); for (int i = 0; i < r.gearIds.Count; i++) { var g = s.Db.Gear.Get(r.gearIds[i]); sb.Append("\n장비 ").Append(g != null ? g.nameKo + " (" + UiKit.GearGradeKo(g.grade) + ")" : r.gearIds[i]).Append(i < r.fixedChests ? " 획득 (확정 상자)" : " 획득"); } if (r.gearIds.Count == 0) sb.Append("\n이번에는 장비가 나오지 않았습니다"); if (!string.IsNullOrEmpty(r.chest) && s.Db.Chests != null && s.Db.Chests.Get(r.chest) != null) sb.Append("\n").Append(s.Db.Chests.Get(r.chest).nameKo).Append(" 획득 (보물 > 상자)"); if (r.sweep) sb.Append("\n군량 ").Append(r.stamina).Append(" 소모 · 소탕(전투 없음)"); var ready = ReadyNames(s, r); if (ready.Length > 0) sb.Append("\n레벨업 가능: ").Append(ready).Append(""); return sb.ToString(); } } }