using System; using UnityEngine; namespace TKS.OutGame { /// /// 등급 투기장 화면(컨텐츠 모드 기획 10판 ④ · 2026-11-18) — **더미 UI**(개발 요청서 §G · 나중 = 비무대 bg_arena_ring + 도전장 목패 + arena_spots.csv): /// 내 등급 · 점수 · 남은 입장 · 상대 3명(강한 · 비슷한 · 약한 = 이기면 / 지면 점수) · 새로고침 · 입장 구매 · 이번 시즌 지형. /// public partial class ArenaScreen { void BuildLeague() { ContentTables.Reload(); var db = S.Db; var d = S.Save; var now = S.Now; Title("투기장", ArenaRules.Arena); if (!LeagueRules.Unlocked(d)) { UiKit.Label(root, ContentTables.Str("arena", "unlock_stage") + " 클리어 뒤 열립니다", 36, UiKit.Red, TextAnchor.MiddleCenter, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -200f), new Vector2(1000f, 60f), false); return; } int left = LeagueRules.Left(db, d, now); var s = d.league; int tier = s.serverView && s.tier > 0 ? s.tier : LeagueRules.Tier(s.score); string board = ArenaLeagueRules.SeasonBoard(LeagueSeason()); var bRow = ContentTables.Find("arena_boards", "s_board", board); var me = Panel("Me", 124f, 200f); UiKit.Label(me, LeagueRules.TierName(tier) + " · 점수 " + s.score + (s.rank > 0 ? " · " + s.rank + "위 / " + s.rankTotal : "") + "\n" + s.wins + "승 " + s.losses + "패 · 메달 " + d.arena.medals + "\n이번 시즌 전장 = " + (bRow != null ? bRow.S("s_name_ko") : board) + " · 교대 조작 · " + ContentTables.Int("arena", "max_rounds") + "라운드", 30, UiKit.Ink, TextAnchor.UpperLeft, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(24f, -14f), new Vector2(980f, 180f), false); var bar = Panel("Bar", 340f, 120f); UiKit.Label(bar, "오늘 남은 입장 " + left, 32, UiKit.Ink, TextAnchor.MiddleLeft, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(24f, 0f), new Vector2(360f, 90f), false); UiKit.Btn("Refresh", bar, "새로고침\n무료 " + Mathf.Max(0, ContentTables.Int("arena", "refresh_free_per_day") - s.refreshUsed) + "", 28, UiKit.Dark, UiKit.White, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-270f, 0f), new Vector2(240f, 100f), () => { S.LeagueRefresh(why => { Root.Toast(why ?? "상대를 새로 골랐습니다"); if (page == 3) Refresh(); }); }); UiKit.Btn("Buy", bar, "입장 +1\n보옥 " + ContentTables.Int("arena", "buy_entry_gem") + "", 28, UiKit.Grain, UiKit.White, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-16f, 0f), new Vector2(240f, 100f), () => { S.LeagueBuy(why => { Root.Toast(why ?? "입장 +1"); if (page == 3) Refresh(); }); }); var winMap = ContentTables.Map("arena", "score_win"); var loseMap = ContentTables.Map("arena", "score_lose"); for (int k = 0; k < s.pick.Count; k++) { int idx = s.pick[k]; if (idx < 0 || idx >= d.arena.samples.Count) continue; var sm = d.arena.samples[idx]; string kind = k < s.kinds.Count ? s.kinds[k] : ""; float wv, lv; winMap.TryGetValue(kind, out wv); loseMap.TryGetValue(kind, out lv); var box = Panel("Opp" + k, 480f + k * 230f, 214f); string kindKo = kind == "strong" ? "강한 상대" : kind == "weak" ? "약한 상대" : "비슷한 상대"; UiKit.Label(box, kindKo + " · " + sm.name + "\n점수 " + sm.score + " · 이기면 +" + Mathf.RoundToInt(wv) + " / 지면 " + Mathf.RoundToInt(lv), 30, UiKit.Ink, TextAnchor.UpperLeft, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(24f, -16f), new Vector2(680f, 110f), false); var names = new System.Collections.Generic.List(); foreach (var h in sm.heroes) { var def = db.Heroes.Get(h); names.Add(def != null ? def.nameKo : h); } UiKit.Label(box, string.Join(" · ", names.ToArray()), 24, UiKit.InkSoft, TextAnchor.MiddleLeft, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(24f, 14f), new Vector2(680f, 60f), false); int kk = k; var why = LeagueRules.Can(db, d, k, now); var go = UiKit.Btn("Go", box, "도전", 38, why == null ? UiKit.Red : UiKit.Disabled, UiKit.White, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-20f, 0f), new Vector2(240f, 150f), () => LeagueGo(kk)); go.interactable = why == null; } } int LeagueSeason() { var s = S.Save.league; if (s.serverView && s.season > 0) return s.season; int days = (int)(S.Now.ToLocalTime().Date - new DateTime(2000, 1, 3)).TotalDays; return days / Mathf.Max(1, ContentTables.Int("arena", "season_days")); } void LeagueGo(int k) { var d = S.Save; int idx = d.league.pick[k]; var stage = ArenaRules.ArenaStage(S.Db, Root.Battle.Config, d.arena.samples[idx]); stage.aiAccuracy = ContentTables.Num("arena", "ai_accuracy"); stage.aiAggroRange = 999f; var rules = new ArenaLeagueRules { BoardId = ArenaLeagueRules.SeasonBoard(LeagueSeason()) }; var why = rules.Prepare(stage); if (why != null) { Root.Toast(why); return; } var w = S.LeagueEnter(k); if (w != null) { Root.Toast(w); return; } Root.StartMode(LeagueRules.Kind, "", k, stage, ContentTables.Int("arena", "max_rounds"), 3, rules); } } }