using System; using System.Collections.Generic; using System.Globalization; using UnityEngine; using UnityEngine.UI; namespace TKS.OutGame { /// /// 임무 화면(2026-11-20 PD 컨펌 · 목업 미션_img 02~06) — 탭 3(일일 · 주간 · 업적 · 빨간 점 = 받기 줄 수) · 포인트 판(원 + 막대 + 구간 상자 + 초기화 시계) · /// 임무 줄(아이콘 · 제목 · 대체 표시 · 진행 막대 · 도움말 · +포인트 · 받기/완료/이동/진행 중) · 업적(분류 칩 · 지금 단계 1줄 · 연쇄 안내) · 모두 받기 · 보상 팝업. /// 화풍(PD 2026-11-20 「미션 메뉴에 적합한 UI 배경 · UI 디자인」 · Fable 초안 `mission_ui/design/디자인기획_초안_r1.md`) = 「본영 마당의 방(榜) 게시판」: /// 군막 앞 마당 배경 + 어둠 한 겹 · 포인트 판 = 붉은 현판 + 금 테 · 나무 게시판 위에 크림 종이 쪽지 줄(왼쪽 금 띠 + 스티커 아이콘) · 버튼 · 탭 = 팩 그대로. /// 값 = 임무 표(MissionDb) · 글자 = UI/Mission/mission_text · 아이콘 · 색 · 좌표 · 그림 · 바로가기 = UI/Mission/mission_screen(C45). /// 캔버스 = 배경 · 나무 판 = Static(탭을 바꿀 때만) · 화면 Event(OutGameRoot.Add) · 줄 목록 = ScrollGrid Frame · 시계 칩 = 자기 Event 캔버스(1초마다 글자만) · 받을 상자 빛 = UiPulse. /// public class MissionScreen : OutGameScreen { public const string Table = "UI/Mission/mission_screen"; public const string Texts = "UI/Mission/mission_text"; public const int DailyTab = 0, WeeklyTab = 1, AchieveTab = 2; const float PageTop = 116f; static Dictionary cfg; static readonly Dictionary sprites = new Dictionary(); static Material grayMat; int tab; string cat = ""; string boardKey; RectTransform body; RectTransform page; RectTransform artPage; readonly Button[] tabs = new Button[3]; readonly Text[] tabBadges = new Text[3]; /// 시험 · 캡처용 — 지금 탭 · 줄 상태(claim · done · go · wait) · 마지막 팝업 제목. public int CurrentTab { get { return tab; } } public readonly List RowStates = new List(); public readonly List RowTitles = new List(); public string LastPopup { get; private set; } public static string T(string key) { return UiText.T(key).Replace("\\n", "\n"); } public static string F(string key, params string[] args) { return UiText.F(key, args).Replace("\\n", "\n"); } /// 화면 표 값(없으면 def). public 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; } public static Color Col(string key, Color def) { Color c; return ColorUtility.TryParseHtmlString(Cfg("color." + key), out c) ? c : def; } /// 표 값 「a|b|c」 → 숫자 배열(칸이 없거나 숫자가 아니면 def 의 같은 칸). public static float[] V(string key, params float[] def) { var p = Cfg(key).Split('|'); var r = new float[Mathf.Max(p.Length, def.Length)]; for (int i = 0; i < r.Length; i++) { float f; r[i] = i < p.Length && float.TryParse(p[i].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out f) ? f : i < def.Length ? def[i] : 0f; } return r; } /// Resources 스프라이트(표의 경로 · 없으면 null). public static Sprite Res(string path) { if (string.IsNullOrEmpty(path)) return null; Sprite s; if (!sprites.TryGetValue(path, out s)) { s = Resources.Load(path); sprites[path] = s; } return s; } [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] static void ResetStatics() { cfg = null; sprites.Clear(); grayMat = null; } public override void Build() { UiText.Use(Texts); SceneBg(); Header(T("mission_title"), T("mission_sub"), true); body = Body(); // 나무 게시판 = Static 층(탭을 바꿀 때만 다시 그림 · 쪽 목록보다 뒤) artPage = UiKit.Fill("ArtPage", UiLayer.Group("BoardArt", body, UiRate.Static), 0f, 0f, PageTop, 0f); string[] keys = { "tab_daily", "tab_weekly", "tab_achieve" }; for (int i = 0; i < 3; i++) { int k = i; tabs[i] = UiKit.SubTab(body, "Tab" + i, T(keys[i]), 24f + i * 348f, 18f, 332f, 84f, () => SetTab(k)); var b = UiKit.Skin(UiKit.Rect("Badge", tabs[i].transform, new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), new Vector2(-10f, -6f), new Vector2(48f, 50f)), "badge_circle", Col("badge", UiKit.Red)); b.preserveAspect = true; tabBadges[i] = UiKit.Title(UiKit.FillLabel(b.transform, "", 26, UiKit.White), true); } page = UiKit.Fill("Page", body, 0f, 0f, PageTop, 0f); } /// 화면 전체 배경(표 bg = Resources 그림 · 화면 비가 달라도 덮음) + 어둠 한 겹(color.dim) — Static 층 · 재화 바 · 제목 띠 뒤. void SceneBg() { var sp = Res(Cfg("bg")); if (sp == null) return; var g = UiLayer.Group("SceneArt", Rt, UiRate.Static); g.SetAsFirstSibling(); var bg = UiKit.Rect("SceneBg", g, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, OutGameRoot.Reference).gameObject.AddComponent(); bg.sprite = sp; bg.raycastTarget = false; var fit = bg.gameObject.AddComponent(); fit.aspectMode = AspectRatioFitter.AspectMode.EnvelopeParent; fit.aspectRatio = sp.rect.width / Mathf.Max(1f, sp.rect.height); var dim = UiKit.Fill("Dim", g).gameObject.AddComponent(); dim.color = Col("dim", Color.clear); dim.raycastTarget = false; } public override void OnShow() { S.MissionRoll(); } public void SetTab(int t) { tab = Mathf.Clamp(t, 0, 2); Refresh(); } public void SetCategory(string c) { cat = c ?? ""; Refresh(); } public override void Refresh() { if (page == null || S.Db.Missions == null) return; var og = S.Db; var d = S.Save; int[] n = { MissionRules.Badge(og, d, MissionDb.Daily), MissionRules.Badge(og, d, MissionDb.Weekly), MissionRules.AchBadge(og, d) }; for (int i = 0; i < 3; i++) { UiKit.SetSubTab(tabs[i], i == tab); tabBadges[i].text = n[i].ToString(CultureInfo.InvariantCulture); tabBadges[i].transform.parent.gameObject.SetActive(n[i] > 0); } string bk = tab == AchieveTab ? "achieve" : tab == DailyTab ? MissionDb.Daily : MissionDb.Weekly; if (bk != boardKey) Board(bk); UiKit.Clear(page); RowStates.Clear(); RowTitles.Clear(); if (tab == AchieveTab) BuildAchievements(); else BuildMissions(tab == DailyTab ? MissionDb.Daily : MissionDb.Weekly); } static float PageH { get { return OutGameRoot.BodyH - PageTop; } } /// 나무 게시판(표 board.<탭> = x | 위 y | 아래 여백 | 안쪽 들임 · 테 = 팩 card · 안쪽 = soft · 네 귀 못) — 탭이 바뀔 때만(Static). void Board(string key) { boardKey = key; UiKit.Clear(artPage); // 3차(PD 2026-11-21 · Fable 디자인기획_r3) = 금 마개 들보 + 두 기둥 + 밑틀의 나무 게시대 그림(표 board_art · board_art.<탭> = x | 위 y | 폭 | 아래 여백) · 없으면 예전 색 판 var bart = V("board_art." + key, 4f, 238f, 1072f, 132f); if (SlicedArt(UiKit.At(artPage, "Board", bart[0], bart[1], bart[2], PageH - bart[1] - bart[3]), Cfg("board_art")) != null) return; UiKit.Clear(artPage); var b = V("board." + key, 20f, 268f, 140f, 14f); float w = OutGameRoot.Reference.x - 2f * b[0], h = PageH - b[1] - b[2]; var frame = UiKit.At(artPage, "Board", b[0], b[1], w, h); UiKit.Skin(frame, "card", Col("board", new Color(0.42f, 0.27f, 0.16f))); UiKit.Skin(UiKit.Fill("Inner", frame, b[3], b[3], b[3], b[3]), "soft", Col("board_in", new Color(0.55f, 0.36f, 0.21f))); var nl = V("board_nail", 0f, 0f); if (nl[0] <= 0f) return; foreach (var p in new[] { new Vector2(nl[1], nl[1]), new Vector2(w - nl[1], nl[1]), new Vector2(nl[1], h - nl[1]), new Vector2(w - nl[1], h - nl[1]) }) { var rim = UiKit.Rect("Nail", frame, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(p.x, -p.y), new Vector2(nl[0], nl[0])).gameObject.AddComponent(); rim.sprite = UiKit.Circle; rim.color = Col("nail_rim", Color.black); rim.raycastTarget = false; var dot = UiKit.Fill("Head", rim.transform, 4f, 4f, 4f, 4f).gameObject.AddComponent(); dot.sprite = UiKit.Circle; dot.color = Col("nail", UiKit.Coin); dot.raycastTarget = false; } } // ---------- 일일 · 주간 ---------- void BuildMissions(string kind) { var og = S.Db; var db = og.Missions; var d = S.Save; int max = db.PointMax(kind); int pts = MissionRules.Points(d, kind); // 포인트 띠(PD 2026-11-21 「포인트 정보를 심플하게 · 레퍼런스 참고」) = 붉은 칠 띠 한 장 + 금 테 // · 왼쪽 = 임무 포인트 아이콘 크게 + 그 아래 지금 포인트 숫자만 · 막대 위 상자 · 상자 밑 어두운 알약에 구간 숫자 · 시계 = 오른쪽 위 작게 // (현판 · 원 · 상한 · 안내 글 · 「받기」 꼬리표 없앰 · 받을 상자 = 번짐 빛만) var pr = V("points_rect", 20f, 4f, 1040f, 250f); var panel = UiKit.At(page, "Points", pr[0], pr[1], pr[2], pr[3]); // 3차(PD 2026-11-21 「배경 패널을 컨셉으로 다시」 · Fable 디자인기획_r3) = 금 테 · 금 구름 귀 붉은 옻칠 현판 그림(표 points_art · 9 분할 좌우) · 없으면 예전 색 띠 var plaque = SlicedArt(panel, Cfg("points_art")); if (plaque == null) { var band = UiKit.Skin(panel, "card", Col("points_band", Col("panel", UiKit.Dark))); if (band != null && Cfg("color.points_top").Length > 0) UiGradient.Add(band, Col("points_top", UiKit.Red), Col("points_bottom", UiKit.Red)); Line(panel, Cfg("points_line"), Col("panel_line", UiKit.Coin), 0f); } // 옻칠 면 구름 음각 무늬(PD 2026-11-21 8차 「상단 UI 의 남는 여백을 좀 더 꾸며봐」 · Fable 디자인기획_r4 §2 · 표 points_pattern = 그림 | x | y | 폭 | 높이 · 정보 뒤 · 금 테 · 귀 구름 밖으로 안 나감) if (plaque != null) { var pp = Cfg("points_pattern").Split('|'); var pv4 = V("points_pattern", 0f, 32f, 38f, 976f, 172f); var psp = pp.Length > 0 && pp[0].Length > 0 ? UISkin.Icon(pp[0]) : null; if (psp != null) { var pimg = UiKit.At(panel, "Pattern", pv4[1], pv4[2], pv4[3], pv4[4]).gameObject.AddComponent(); pimg.sprite = psp; pimg.raycastTarget = false; } } // 시계 = 게시대 제목 줄(PD 2026-11-21 8차 시안 「초기화 시간을 아래쪽 상단에」 · 표 list_head = x | y | 폭 | 높이 | 제목 글자 | 제목 x · 없으면 예전처럼 현판 위) var lh = V("list_head", 0f, 0f, 0f, 0f, 40f, 0f); if (lh[2] > 0f && lh[3] > 0f) ListHead(kind, lh); else Timer(panel, kind); // 임무 포인트 아이콘(표 point_icon.<종류> · 일일 = 백호 · 주간 = 청룡 = 타이틀 로고 그림 · PD 2026-11-21) + 지금 포인트(표 point_big = 가운데 x | 가운데 y | 크기 | 숫자 가운데 y | 글자 · 숫자는 아이콘 아래 따로) var pb = V("point_big", 104f, 112f, 150f, 196f, 52f); var big = UiKit.Icon(panel, PointIcon(kind), new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(pb[0], -pb[1]), pb[2]); if (big != null) { big.name = "PointIcon"; UiKit.DropShadow(big, 4f); } var pv = UiKit.Title(UiKit.Label(panel, pts.ToString(CultureInfo.InvariantCulture), (int)pb[4], Col("text_panel", UiKit.White), TextAnchor.MiddleCenter, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(pb[0], -pb[3]), new Vector2(200f, pb[4] + 18f)), true); pv.name = "PointValue"; // 막대(홈 + 금 채움) + 구간 상자(상자 + 접지 그림자 · 받을 것 = 번짐 빛 · 받음 = 탈색 + 체크) + 구간 숫자 알약 var br = V("bar", 216f, 140f, 760f, 30f); float X0 = br[0], BarY = br[1], W = br[2]; var steps = db.Steps(kind); // 상자 줄 가운데 y(표 box_y · 비면 막대 위에 걸침 = 막대 y − 4) — PD 2026-11-21 「게이지는 아이콘 하단에」 = 상자가 막대 위 · 막대는 상자 아래 float BoxY = V("box_y", BarY - 4f)[0]; // 받을 상자 빛 = 막대보다 먼저(뒤) 그림 — 빛이 막대 홈을 밝혀 채움 끝이 흐려지지 않게(QA r4 M1) foreach (var s in steps) if (!MissionRules.BoxClaimed(d, kind, s.step) && pts >= s.need) ReadyGlow(panel, new Vector2(X0 + W * Mathf.Clamp01(s.need / (float)Mathf.Max(1, max)), -BoxY)); var fill = UiKit.Bar("Bar", panel, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(X0, -BarY), new Vector2(W, br[3]), Col("track_panel", UiKit.Dark), Col("bar_full", UiKit.Coin)); Track(fill, Col("track_panel", UiKit.Dark)); if (plaque != null) Groove(fill, Col("track_panel", UiKit.Dark)); UiKit.SetBar(fill, max > 0 ? pts / (float)max : 0f); var fimg = fill.GetComponent(); if (fimg != null && Cfg("color.bar_top").Length > 0) UiGradient.Add(fimg, Col("bar_top", UiKit.Coin), Col("bar_bottom", UiKit.Coin)); // 구간 눈금(PD 2026-11-21 「상자가 실제 달성도 % 에 맞게」 → 막대 위 구간 자리에 금 눈금 · 상자 · 숫자가 그 눈금 위아래 · 표 bar_tick = 폭 | 높이 · 비면 없음) var tk = V("bar_tick", 0f, 0f); if (tk[0] > 0f) foreach (var s in steps) { float tx = X0 + W * Mathf.Clamp01(s.need / (float)Mathf.Max(1, max)); var ol = UiKit.Box("Tick" + s.step, panel, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(tx, -BarY), new Vector2(tk[0] + 4f, tk[1] + 4f), Col("bar_tick_line", UiKit.Ink), false); ol.raycastTarget = false; var inn = UiKit.Box("In", ol.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(tk[0], tk[1]), Col("bar_tick", UiKit.Coin), false); inn.raycastTarget = false; } var icons = Split(Cfg("box_icons")); var bx = V("box", 96f, 88f, 196f); for (int i = 0; i < steps.Count; i++) { var s = steps[i]; float x = X0 + W * Mathf.Clamp01(s.need / (float)Mathf.Max(1, max)); bool got = MissionRules.BoxClaimed(d, kind, s.step); string icon = icons.Count == 0 ? "" : icons[Mathf.Min(icons.Count - 1, Mathf.RoundToInt(i * (icons.Count - 1) / (float)Mathf.Max(1, steps.Count - 1)))]; var box = UiKit.Rect("Box" + s.step, panel, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(x, -BoxY), new Vector2(bx[0], bx[0])); var hit = box.gameObject.AddComponent(); hit.color = Color.clear; // 누름 칸(그림 없음) Shadow(box, bx[1]); var bt = box.gameObject.AddComponent