using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; namespace TKS.OutGame { /// /// UI 리뉴얼 검증 캡처(PD #1100 · 에디터 DataImporter.CaptureUI 가 SessionState 로 출력 폴더를 넘기면 생성 · 세이브 = 메모리 전용 신규 유저). /// 1080×1920 = 로비 · 영웅 목록 · 영웅 상세 · 편성 · 거래 · 보물 · 내정 · 연무장 · 월드맵 팝업 · 전투 HUD · 전투 결과 · 팝업 + 1536×2048 = 로비 · 영웅 상세(겹침 확인) · 끝나면 스스로 종료. /// public class UICaptureDriver : MonoBehaviour { public const string DirKey = "TKS_UI_CAPTURE_DIR"; /// 찍을 화면만(쉼표 · 정확한 이름 또는 「접두*」 · 비면 전부) — PD 2026-11-09 「수정된 화면만 체크」. public const string OnlyKey = "TKS_UI_CAPTURE_ONLY"; public string OutputDir; string[] only; readonly HashSet matched = new HashSet(); const int W = 1080, H = 1920, W2 = 1536, H2 = 2048; const int HTall = 2340; // 19.5:9 긴 화면(투기장 아트 납품 긴 판 1080×2340 과 같은 비 · PD 2026-11-18) readonly List log = new List(); int shot = 1; #if UNITY_EDITOR [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] static void AutoSpawn() { string dir = UnityEditor.SessionState.GetString(DirKey, ""); if (string.IsNullOrEmpty(dir)) return; UnityEditor.SessionState.EraseString(DirKey); var d = new GameObject("UICaptureDriver").AddComponent(); d.OutputDir = dir; string only = UnityEditor.SessionState.GetString(OnlyKey, ""); UnityEditor.SessionState.EraseString(OnlyKey); if (!string.IsNullOrEmpty(only)) d.only = only.Split(new[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); } #endif IEnumerator Start() { Directory.CreateDirectory(OutputDir); yield return null; yield return null; var root = OutGameRoot.Instance; var cam = Camera.main; if (root == null || cam == null) { Log("FAIL: OutGameRoot 또는 카메라 없음"); Finish(1); yield break; } var s = root.Session; var db = s.Db; var d = s.Save; Log("theme=" + (UITheme.Current != null) + " titleFont=" + (UISkin.TitleFont != null ? UISkin.TitleFont.name : "-") + " memoryOnly=" + SaveStore.MemoryOnly); // 캡처용 진행(메모리 세이브만): 재화 · 장비 · 보물 · 상자 · 순찰 d.gold = 124500; d.gem = 1280; var id = db.Economy.StartHeroes.Length > 1 ? db.Economy.StartHeroes[1] : db.Economy.StartHeroes[0]; var h = s.Def(id); var hs = s.Save.Hero(id); for (int i = 0; i < 4; i++) d.inv.AddGear(HeroRules.RequiredGear(db, h, hs, i), 1); for (int i = 0; i < 3; i++) s.Equip(id, i); HeroRules.GrantExp(hs, db.Levels.Get(1).expToNext + 5); var rng = new System.Random(1100); Counts.Set(d.inv.chests, "gold", 6); for (int i = 0; i < 6; i++) TreasureRules.Open(db, d, "gold", rng); Counts.Set(d.inv.chests, "bronze", 4); Counts.Set(d.inv.chests, "silver", 18); Counts.Set(d.inv.chests, "general", 1); d.inv.chestPoints = 35; d.patrol.startAt = SaveStore.Iso(s.Now.AddHours(-7)); s.Commit(); yield return LoadingShots(cam); // 로딩 화면(PD 2026-11-13 · -uiOnly loading* 일 때만) yield return BootShots(cam, root); // 시작 흐름 다운로드 → 페이드 → 로비(PD 2026-11-13 · -uiOnly boot_anim 일 때만) root.ShowLobby(); yield return Shot(cam, "lobby", W, H); yield return LobbyAnim(cam); // 목록 카드 등급색 확인용(메모리 세이브만): 나머지 시작 영웅 등급 = 각자 장비 세트의 다음 등급들 int gi = 1; foreach (var sid in db.Economy.StartHeroes) { var sh = s.Def(sid); var shs = s.Save.Hero(sid); if (sid == id || sh == null || shs == null || sh.gear.Count == 0) continue; shs.grade = sh.gear[Mathf.Min(gi++, sh.gear.Count - 1)].grade; } // 진영 원 배지 확인용(메모리 세이브만 · PD 2026-11-09): 위 · 오 · 군 영웅 1명씩 보유 추가 foreach (var fac in new[] { "wei", "wu", "other" }) foreach (var fh in db.Heroes.heroes) if (!fh.isSoldier && fh.faction == fac && !d.Owns(fh.id)) { HeroRules.Grant(db, d, fh, HeroRules.GearSlotCount(db)); break; } root.Show(root.HeroList); yield return Shot(cam, "hero_list", W, H); Log("hero_list cols=" + root.HeroList.Columns); // 해상도 대응(PD 2026-11-09): 넓은 화면(3:4) · 좁은 화면(9:20) yield return Shot(cam, "hero_list_1536x2048", W2, H2); Log("hero_list_1536x2048 cols=" + root.HeroList.Columns); yield return Shot(cam, "hero_list_1080x2400", 1080, 2400); Log("hero_list_1080x2400 cols=" + root.HeroList.Columns); yield return Shot(cam, "hero_list_1080x2520", 1080, 2520); Log("hero_list_1080x2520 cols=" + root.HeroList.Columns); root.ShowHero(id); yield return Shot(cam, "hero_detail", W, H); // 영웅 상세 등급 변형(UI 상업용 재설계 ① · 목업 hero_detail_5등급 대조 · 메모리 세이브만) = 그 영웅 장비 세트의 등급 순서대로 string g0 = hs.grade; foreach (var set in h.gear) { if (set.grade == g0) continue; hs.grade = set.grade; root.HeroDetail.Refresh(); yield return Shot(cam, "hero_detail_" + set.grade, W, H); } hs.grade = g0; root.HeroDetail.Refresh(); root.Show(root.Formation); yield return Shot(cam, "formation", W, H); root.Show(root.Trade); root.Trade.SetPage(0); yield return Shot(cam, "trade_gacha", W, H); yield return RecruitShots(cam, root); // 명장 등용 배너(PD 2026-11-13 · 픽업 · 국가별 상시 4 · 상세 정보 팝업) yield return GachaShots(cam, root); // 뽑기 연출(삼고초려 장면 → 카드 획득 · PD 2026-11-13 · -uiOnly gacha_cut1|2|3 · gacha_cards 일 때만) root.Show(root.Treasures); root.Treasures.SetPage(2); root.Treasures.SelectChest("gold"); yield return Shot(cam, "treasure_chests", W, H); root.Treasures.SelectChest("silver"); // 보유 상자(열기 버튼 활성 · PD 2026-11-13 금고 받침대 확인) yield return Shot(cam, "treasure_chests_ready", W, H); root.Treasures.SetPage(0); yield return Shot(cam, "treasure_owned", W, H); // 등급 드롭다운(PD 2026-11-13 3차 「등급 칩 줄 → 드롭다운 · 전체 ~ 등급별」) — 펼친 목록 · 영웅 등급만 거른 목록 root.Treasures.ToggleGradeFilter(); yield return Shot(cam, "treasure_owned_filter_open", W, H); root.Treasures.SetGradeFilter(db.Economy.TreasureGrades.Count > 1 ? db.Economy.TreasureGrades[1].Key : ""); yield return Shot(cam, "treasure_owned_filtered", W, H); root.Treasures.SetGradeFilter(""); // 유물 정보 팝업(PD 2026-11-13 2차 「선택된 유물의 정보 화면에 선반 컨셉 강조」) = 보유한 첫 유물 foreach (var ti in db.Treasures.items) if (d.inv.Treasure(ti.id) != null) { root.Treasures.Detail(ti.id); break; } yield return Shot(cam, "treasure_detail", W, H); root.CloseModal(); root.Treasures.SetPage(1); yield return Shot(cam, "treasure_sets", W, H); // 세트 탭(PD 2026-11-13 보물고 진열대 · 같은 배경) // 상자 결과 팝업(PD 2026-11-16 「획득 유물 = 팝업 위 바깥에 강조 · 게임 폰트」) — 은 상자를 유물이 나올 때까지(최대 5) 열고 튀어 나옴이 끝난 뒤 · 보물 캡처 맨 끝(보유 수가 바뀜) root.Treasures.SetPage(2); for (int i = 0; i < 5; i++) { root.Treasures.DoOpen("silver"); if (root.Treasures.LastOpen == null || root.Treasures.LastOpen.treasureId != null) break; } yield return new WaitForSecondsRealtime(0.6f); yield return Shot(cam, "treasure_open", W, H); root.CloseModal(); // 일괄 획득 결과(PD 2026-11-16 7차) — 은 상자 최대 개수 일괄 열기 · 아이콘 차례 튀어 나옴이 끝난 뒤 root.Treasures.DoOpenMany("silver", TKS.OutGame.TreasureScreen.BatchMax); yield return new WaitForSecondsRealtime(1.2f); yield return Shot(cam, "treasure_open_batch", W, H); root.CloseModal(); // 내정(PD 2026-11-12 내정 메뉴 개편 · 탭마다 배경 장면) — 훈련(병종별) · 훈련 동작 연속 · 순찰 · 드롭다운 펼침 · 수확 팝업(광고 2배 선택) · 개발 // 파견(메모리 세이브만 · PD 2026-11-12 「영웅 파견 · 지휘관 · 문 앞 · 개발 배치」) = 보유 영웅으로 훈련(보·창·기·궁·책 각 1) · 순찰 · 개발 foreach (var ut in root.Domestic.TrainTypes) { var c = DispatchRules.Candidates(db, d, DispatchRules.TrainSlot(ut)); if (c.Count > 0) DispatchRules.Assign(db, d, DispatchRules.TrainSlot(ut), c[0].id); } foreach (var slot in new[] { DispatchRules.Patrol, DispatchRules.Dev }) foreach (var c in DispatchRules.Candidates(db, d, slot)) if (DispatchRules.Where(d, c.id) == null) { DispatchRules.Assign(db, d, slot, c.id); break; } s.Commit(); root.Show(root.Domestic); root.Domestic.SetTrainType(UnitType.Infantry); root.Domestic.SetPage(0); yield return Shot(cam, "domestic_train", W, H); Log("domestic dispatch train=" + DispatchRules.Get(d, DispatchRules.TrainSlot(UnitType.Infantry)) + " patrol=" + DispatchRules.Get(d, DispatchRules.Patrol) + " dev=" + DispatchRules.Get(d, DispatchRules.Dev)); Log("domestic_train soldiers=" + root.Domestic.SoldierCount); yield return DomesticAnim(cam); foreach (var ut in root.Domestic.TrainTypes) { if (ut == UnitType.Infantry) continue; root.Domestic.SetTrainType(ut); yield return Shot(cam, "domestic_train_" + ut.ToString().ToLowerInvariant(), W, H); // 병종별 훈련 동작 연속 캡처(PD 2026-11-12 기병 박자 · 궁병 다시 제작 · 책사 크기) — -uiOnly 에 이름을 줄 때만 yield return AnimFrames(cam, "domestic_train_anim_" + ut.ToString().ToLowerInvariant(), 40, 0.06f); } root.Domestic.SetTrainType(UnitType.Infantry); root.Domestic.SetPage(1); yield return Shot(cam, "domestic_patrol", W, H); yield return AnimFrames(cam, "domestic_patrol_anim", 24, 0.12f); // 순찰 영웅·창병·NPC 대기 숨 고르기 확인(PD 2026-11-12) root.Domestic.OpenHarvest(); yield return Shot(cam, "domestic_patrol_harvest", W, H); root.CloseModal(); root.Domestic.OpenDispatch(DispatchRules.Patrol); yield return Shot(cam, "domestic_dispatch", W, H); Log("domestic_dispatch choices=" + root.Domestic.DispatchChoices); root.CloseModal(); root.Domestic.SetPage(2); yield return Shot(cam, "domestic_dev", W, H); Log("domestic_dev hero=" + root.Domestic.DevHeroShown + " nodes=" + root.Domestic.NodeCount); root.Arena.SetPage(0); root.Show(root.Arena); yield return Shot(cam, "arena", W, H); // 연무장 허브 연출(PD 2026-11-18) — 연속 캡처(-uiOnly arena_anim · 원본 크기 0.1 초 간격) · 왼쪽 끝 스크롤(탑 아래 조는 병사 · -uiOnly arena_anim_left) var hubFx = root.Arena.Hub != null ? root.Arena.Hub.Fx : null; if (hubFx != null) Log("arena_fx duels=" + hubFx.DuelCount + " shooters=" + hubFx.ShooterCount + " sleepers=" + hubFx.SleeperCount + " triggers=" + hubFx.TriggerCount + " clouds=" + hubFx.CloudCount); yield return AnimFrames(cam, "arena_anim", 60, 0.1f); if (hubFx != null) Log("arena_fx fired=" + hubFx.Fired + " particles=" + hubFx.ParticlesOn + " frames " + hubFx.TriggerFrames()); if (only != null && Match("arena_anim_left") != null && root.Arena.Hub != null && root.Arena.Hub.Scroll != null) { root.Arena.Hub.Scroll.horizontalNormalizedPosition = 0f; yield return AnimFrames(cam, "arena_anim_left", 30, 0.1f); root.Arena.Hub.Scroll.horizontalNormalizedPosition = 0.5f; } yield return HubLockShots(cam, root); // 연무장 잠김 이름표 · 마구간 안내(PD 2026-11-19 · -uiOnly arena_locked,arena_stable_notice) yield return LeagueShots(cam, root); // 투기장 아트 화면(PD 2026-11-18 「투기장 UI 완료」 · -uiOnly arena_league,arena_league_tall,arena_league_locked) yield return ScenarioShots(cam, root); // 연의 전기 아트 화면(PD 2026-11-18 「연의 전기 통과」 · -uiOnly scn_*) yield return TowerShots(cam, root); // 천하제일 탑 아트 화면(PD 2026-11-18 「B안으로 진행해」 · -uiOnly arena_tower*) yield return SupplyShots(cam, root); // 훈련장(보급전) 메뉴 아트 목록(PD 2026-11-18 · -uiOnly supply_list,supply_list_bottom,supply_locked,supply_one_locked) yield return RaidShots(cam, root); // 맹장 토벌전 아트 화면(PD 2026-11-18 · -uiOnly arena_raid,arena_raid_shop,arena_raid_locked) root.StaminaModal(); yield return Shot(cam, "popup_stamina", W, H); root.CloseModal(); root.ShowLobby(); root.ShowHero(id); yield return Shot(cam, "hero_detail_1536x2048", W2, H2); root.ShowLobby(); yield return Shot(cam, "lobby_1536x2048", W2, H2); root.OpenWorldMap(); yield return Wait(); var wm = root.Map; wm.OpenPopup(0); yield return Shot(cam, "worldmap_popup", W, H); wm.ConfirmPopup(); var bm = root.Battle; float t0 = Time.realtimeSinceStartup; while (bm.Phase != BattlePhase.PlayerTurn && Time.realtimeSinceStartup - t0 < 10f) yield return null; yield return new WaitForSecondsRealtime(0.6f); Unit pick = null; foreach (var u in bm.AliveUnits(Faction.Player)) if (bm.Skills != null && bm.Skills.Of(u) != null && bm.Skills.Of(u).Active != null) { pick = u; break; } if (pick != null) bm.Sling.Select(pick); Log("hud select=" + (pick != null ? pick.DisplayName : "-") + " skill=" + bm.Hud.SkillButtonText); yield return Shot(cam, "battle_hud", W, H); foreach (var e in bm.AliveUnits(Faction.Enemy)) e.TakeDamage(e.Hp); bm.CheckBattleEnd(); yield return new WaitForSecondsRealtime(0.6f); yield return Shot(cam, "battle_result", W, H); Finish(0); } /// /// 로비 배경 연출 연속 캡처(-uiOnly lobby_anim 일 때만 · PD 2026-11-11 로비 연출 개선 확인) — 원본 크기(1080×1920 · 해상도 판단용 · 반 크기는 축소로 깨져 보임) 40장 · /// 실제 시각(초)을 로그에 남김(움직임 영상 만들 때 간격). /// IEnumerator LobbyAnim(Camera cam) { if (only == null || Match("lobby_anim") == null) yield break; matched.Add("lobby_anim"); float t0 = Time.realtimeSinceStartup; var times = new List(); for (int f = 0; f < 40; f++) { yield return new WaitForSecondsRealtime(0.05f); times.Add((Time.realtimeSinceStartup - t0).ToString("0.000", System.Globalization.CultureInfo.InvariantCulture)); yield return CaptureUtil.Capture(cam, W, H, Path.Combine(OutputDir, "lobby_anim_" + f.ToString("00") + ".png")); } Log("lobby_anim times " + string.Join(",", times)); } /// /// 훈련 장면 병사 동작 연속 캡처(-uiOnly domestic_train_anim 일 때만 · PD 2026-11-12 내정 개편) — 원본 크기 45장 · 0.08 초 간격(동작 1회 3.0 초를 덮음) · 실제 시각을 로그에(영상 간격). /// IEnumerator DomesticAnim(Camera cam) { if (only == null || Match("domestic_train_anim") == null) yield break; matched.Add("domestic_train_anim"); float t0 = Time.realtimeSinceStartup; var times = new List(); for (int f = 0; f < 45; f++) { yield return new WaitForSecondsRealtime(0.08f); times.Add((Time.realtimeSinceStartup - t0).ToString("0.000", System.Globalization.CultureInfo.InvariantCulture)); yield return CaptureUtil.Capture(cam, W, H, Path.Combine(OutputDir, "domestic_train_anim_" + f.ToString("00") + ".png")); } Log("domestic_train_anim times " + string.Join(",", times)); } /// /// 로딩 화면 두 경우(PD 2026-11-13 · 지정했을 때만 · -uiOnly loading*): /// loading = 원격 다운로드(배경 + 위 타이틀 로고 + 조운·병졸 · 12.4 / 48.0 MB) · loading_anim = 그 화면 원본 크기 연속 48장(게임 시간 1/16 초 간격) /// loading_simple = 일반 로딩(검은 화면 + 유비·관우·장비 · 60 %) · loading_simple_anim = 그 화면 연속 48장. /// 확인용 입력값(용량·진행률)은 PD 지시 예시 그대로 — 게임 데이터 아님. /// IEnumerator LoadingShots(Camera cam) { if (only == null || Match("loading") == null && Match("loading_anim") == null && Match("loading_simple") == null && Match("loading_simple_anim") == null) yield break; var ls = LoadingScreen.Show(cam, LoadingMode.Download); ls.SetDownload(13002342L, 50331648L, true); yield return new WaitForSecondsRealtime(0.5f); // 먼지가 몇 개 나온 뒤 yield return Shot(cam, "loading", W, H); yield return LoadingAnim(cam, "loading_anim"); ls.SetMode(LoadingMode.Loading); ls.SetProgress(0.6f, true); yield return new WaitForSecondsRealtime(0.5f); yield return Shot(cam, "loading_simple", W, H); yield return LoadingAnim(cam, "loading_simple_anim"); ls.Hide(); yield return null; } /// /// 게임 시작 흐름(PD 2026-11-13 「스플래쉬 → 리소스 다운로드 화면 → 다 받으면 페이드 → 타이틀」 · -uiOnly boot_anim 일 때만) — /// 가짜 받기(48 MB · 초당 32 MB · 확인 0.1 초 · 확인용 값 · 게임 데이터 아님) → 100 % → 페이드 아웃 → 로비(타이틀 화면 아직 없음) → 페이드 인을 /// 원본 크기 56장(게임 시간 1/16 초 간격 = 3.5 초)으로. 칸마다 흐름 단계를 로그에. /// IEnumerator BootShots(Camera cam, OutGameRoot root) { const string name = "boot_anim"; if (only == null || Match(name) == null) yield break; matched.Add(name); float prevDt = Time.captureDeltaTime; Time.captureDeltaTime = 1f / 16f; float tOffset = LoadingScreen.Now - Time.time; LoadingScreen.Clock = () => Time.time + tOffset; BootFlow.OverrideDownloader = new SimulatedDownload(48f, 32f, 0.1f); var bf = BootFlow.Begin(cam, root.ShowLobby); float t0 = LoadingScreen.Now; var times = new List(); for (int f = 0; f < 56; f++) { string st = bf != null ? bf.State.ToString() : "Done"; string a = bf != null && bf.Fader != null ? bf.Fader.Alpha.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) : "-"; times.Add((LoadingScreen.Now - t0).ToString("0.000", System.Globalization.CultureInfo.InvariantCulture) + ":" + st + ":" + a); yield return CaptureUtil.Capture(cam, W, H, Path.Combine(OutputDir, name + "_" + f.ToString("00") + ".png")); } BootFlow.OverrideDownloader = null; LoadingScreen.Clock = null; Time.captureDeltaTime = prevDt; Log(name + " game-times:state:fade " + string.Join(",", times)); } /// /// 로딩 화면 연속 캡처 48장 — 게임 시간을 캡처 한 장마다 1/16 초씩만 진행(Time.captureDeltaTime + 로딩 화면 시계 = Time.time) = 원본 크기 화면 읽기가 느려도 16 fps 영상과 같은 간격 /// (Time.unscaledTime 은 captureDeltaTime 을 따르지 않음 · 2026-11-13 실측 장당 0.08 초). /// IEnumerator LoadingAnim(Camera cam, string name) { if (Match(name) == null) yield break; matched.Add(name); float prevDt = Time.captureDeltaTime; Time.captureDeltaTime = 1f / 16f; float tOffset = LoadingScreen.Now - Time.time; LoadingScreen.Clock = () => Time.time + tOffset; float t0 = LoadingScreen.Now; var times = new List(); for (int f = 0; f < 48; f++) { times.Add((LoadingScreen.Now - t0).ToString("0.000", System.Globalization.CultureInfo.InvariantCulture)); yield return CaptureUtil.Capture(cam, W, H, Path.Combine(OutputDir, name + "_" + f.ToString("00") + ".png")); } LoadingScreen.Clock = null; Time.captureDeltaTime = prevDt; Log(name + " game-times " + string.Join(",", times)); } /// /// 뽑기 연출 연속 캡처(PD 2026-11-13 삼고초려 · 지정했을 때만): gacha_cut1 · gacha_cut2 · gacha_cut3 = 그 등급 1장 뽑기(기다림 → 덜컹 → 서서히 열리며 빛 → 활짝 → 카드 1장) · /// gacha_cards = 10장(장면을 탭으로 건너뛴 뒤 카드 획득). 원본 크기 · 연출 시간 1/15 초 간격(연출을 한 칸씩 직접 진행 = 캡처에 걸리는 시간과 무관). /// 뽑힌 영웅 = 캡처용 지정(등급별 풀에서 고름 · 확률 표와 무관) — 세이브(메모리)에는 실제 뽑기처럼 반영. /// IEnumerator GachaShots(Camera cam, OutGameRoot root) { if (only == null) yield break; var s = root.Session; const float dt = 1f / 15f; GachaCutscene.Manual = true; for (int tier = 1; tier <= 3; tier++) { string name = "gacha_cut" + tier; if (Match(name) == null) continue; matched.Add(name); var pulls = new List { CapturePull(s, tier, 0) }; var cut = GachaCutscene.Show(root, s, pulls, null); yield return null; int n = Mathf.CeilToInt((cut.SceneEnd + 1.8f) / dt); bool probed = false; for (int f = 0; f < n; f++) { cut.Tick(dt); yield return CaptureUtil.Capture(cam, W, H, Path.Combine(OutputDir, name + "_" + f.ToString("000") + ".png")); if (!probed && cut.Stage == GachaCutscene.Step.Open) { probed = true; yield return UiLayerProbe.Measure(name, Log, OutputDir); } } Log(name + " frames=" + n + " dt=" + dt.ToString("0.0000", System.Globalization.CultureInfo.InvariantCulture) + " sceneEnd=" + cut.SceneEnd.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) + " tier=" + cut.Tier + " reaction=" + cut.Reaction + " actors=" + cut.ActorCount + " rattles=" + cut.RattleCount + " hero=" + pulls[0].heroId + " cards landed=" + cut.CardsLanded + "/" + cut.CardCount + " stage=" + cut.Stage); if (cut != null) Destroy(cut.gameObject); yield return null; } if (Match("gacha_cards") != null) { matched.Add("gacha_cards"); // 등급이 섞인 10장(★★★ 1 · ★★ 3 · ★ 6 · 같은 영웅 중복 포함 = 조각 게이지가 차례로 쌓이는지) int[] tiers = { 1, 2, 1, 1, 3, 1, 2, 1, 2, 1 }; int[] pick = { 0, 0, 1, 0, 0, 2, 0, 1, 1, 3 }; var pulls = new List(); for (int i = 0; i < tiers.Length; i++) pulls.Add(CapturePull(s, tiers[i], pick[i])); var cut = GachaCutscene.Show(root, s, pulls, null); yield return null; cut.Tick(0.6f); cut.Tap(); // 장면 건너뛰기 → 카드 for (int f = 0; f < 54; f++) { cut.Tick(dt); yield return CaptureUtil.Capture(cam, W, H, Path.Combine(OutputDir, "gacha_cards_" + f.ToString("000") + ".png")); } Log("gacha_cards landed=" + cut.CardsLanded + "/" + cut.CardCount + " stage=" + cut.Stage + " tier=" + cut.Tier); yield return UiLayerProbe.Measure("gacha_cards", Log, OutputDir); if (cut != null) Destroy(cut.gameObject); yield return null; } GachaCutscene.Manual = false; } /// 캡처용 뽑기 1장 = 등급 tier 풀의 k 번째 유닛 · 세이브에도 실제 뽑기처럼(새 유닛 = 획득 · 중복 = 조각 / 병사 = 골드 · GachaRules.Draw 와 같은 처리). const string GachaShowcase = "zhugeliang"; /// /// 명장 등용 배너 캡처(PD 2026-11-13): trade_recruit_pickup(픽업 배너) · trade_recruit_<배너 id>(국가별 상시 = 진영 깃발 고름) · /// trade_recruit_info(픽업 영웅 상세 정보 팝업) · trade_recruit_info_hero(상시 배너 가운데 영웅 상세 정보). 기간이 지난 뒤에도 찍히게 시계를 픽업 기간 안으로 둔다(캡처 동안만). /// IEnumerator RecruitShots(Camera cam, OutGameRoot root) { var s = root.Session; var clock = s.Clock; GachaConfig.Banner pick = null; foreach (var b in s.Db.Gacha.banners) if (b.IsPickup && pick == null) pick = b; if (pick != null && !GachaRules.IsOpen(pick, s.Now) && GachaRules.StartOf(pick) != null) { var inside = GachaRules.StartOf(pick).Value.AddHours(22.5); s.Clock = () => inside; } if (pick != null) { root.Trade.SelectBanner(pick.id); yield return Shot(cam, "trade_recruit_pickup", W, H); yield return Shot(cam, "trade_recruit_pickup_1080x2400", 1080, 2400); // 좁고 긴 화면(9:20) yield return Shot(cam, "trade_recruit_pickup_1536x2048", W2, H2); // 넓은 화면(3:4) Log("recruit pickup banner=" + root.Trade.Banner.id + " page=" + root.Trade.BannerPage + "/" + root.Trade.BannerPageCount + " open=" + GachaRules.IsOpen(pick, s.Now)); } GachaConfig.Banner first = null; foreach (var b in s.Db.Gacha.banners) { if (b.IsPickup) continue; if (first == null) first = b; root.Trade.SelectBanner(b.id); yield return Shot(cam, "trade_recruit_" + b.id, W, H); Log("recruit " + b.id + " featured=" + root.Trade.FeaturedShown + " flags=" + root.Trade.FlagCount); } if (pick != null) { root.Trade.SelectBanner(pick.id); root.Trade.ShowBannerInfo(); yield return Shot(cam, "trade_recruit_info", W, H); var st = HeroInfoPopup.LastStats; Log("recruit info " + HeroInfoPopup.LastHeroId + " hp=" + st.Hp + " atk=" + st.Atk + " def=" + st.Def + " power=" + st.power); root.CloseModal(); } if (first != null && first.featured.Count > 0) { root.Trade.SelectBanner(first.id); root.Trade.ShowHeroInfo(first.featured[0]); yield return Shot(cam, "trade_recruit_info_hero", W, H); root.CloseModal(); } s.Clock = clock; root.Trade.SelectBanner(GachaRules.Default(s.Db, s.Now).id); } static GachaPull CapturePull(OutGameSession s, int tier, int k) { // 전 진영이 나오는 배너의 풀(없으면 지금 열린 첫 배너) GachaConfig.Banner all = null; foreach (var b in s.Db.Gacha.banners) if (all == null && b.pool.Contains(GachaConfig.PoolAll)) all = b; var list = GachaRules.Candidates(s.Db, all ?? GachaRules.Default(s.Db, s.Now), tier); var h = s.Def(list[k % list.Count].heroId); // ★★★ 첫 장 = 제갈량(삼고초려 장면 확인용 · 풀에 있을 때만 · 캡처 전용 선택 — 게임 확률과 무관) if (tier == 3 && k == 0) foreach (var e in list) if (e.heroId == GachaShowcase) h = s.Def(e.heroId); var p = new GachaPull { heroId = h.id, tier = tier }; if (HeroRules.Grant(s.Db, s.Save, h, HeroRules.GearSlotCount(s.Db))) p.isNew = true; else if (h.isSoldier) { p.gold = s.Db.Economy.SoldierDupGold; s.Save.gold += p.gold; } else { p.shards = s.Db.Economy.ShardDup(h.rarity); s.Save.Hero(h.id).shards += p.shards; } return p; } /// 지정했을 때만(-uiOnly 이름) 원본 크기 연속 캡처 n 장 · 실제 시각을 로그에. IEnumerator AnimFrames(Camera cam, string name, int n, float gap) { if (only == null || Match(name) == null) yield break; matched.Add(name); float t0 = Time.realtimeSinceStartup; var times = new List(); for (int f = 0; f < n; f++) { yield return new WaitForSecondsRealtime(gap); times.Add((Time.realtimeSinceStartup - t0).ToString("0.000", System.Globalization.CultureInfo.InvariantCulture)); yield return CaptureUtil.Capture(cam, W, H, Path.Combine(OutputDir, name + "_" + f.ToString("00") + ".png")); } Log(name + " times " + string.Join(",", times)); } static IEnumerator Wait() { yield return null; yield return new WaitForSecondsRealtime(0.3f); } /// 떠 있는 팝업 글자(로그용 · 없으면 빈 글). static string ModalText() { var m = GameObject.Find("Modal"); var texts = new List(); if (m != null) foreach (var t in m.GetComponentsInChildren(true)) if (t.text.Length > 0) texts.Add(t.text); return string.Join(" | ", texts.ToArray()); } /// 세이브의 스테이지 기록을 잠깐 바꾸고 되돌림(메모리 세이브 · 캡처용) — 없던 기록이면 지움. class StageTemp { StageState st; int clears0; bool created; SaveData d; public StageTemp(SaveData d, string key) { int ch, sn; if (!ArenaRules.ParseStageKey(key, out ch, out sn)) return; this.d = d; created = d.Stage(ch, sn, false) == null; st = d.Stage(ch, sn, true); clears0 = st.clears; } public void Set(bool cleared) { if (st != null) st.clears = cleared ? Mathf.Max(1, clears0) : 0; } public void Restore() { if (st == null) return; st.clears = clears0; if (created) d.stages.Remove(st); st = null; } } /// /// 연무장 잠김 이름표 · 마구간 안내(PD 2026-11-19) — arena_locked = 투기장 · 맹장 토벌전 해금 스테이지를 잠깐 안 깬 것으로(이름 앞 자물쇠 + 상태 줄 개방 조건) · /// arena_stable_notice = 마구간(표 open update) 누름 안내 팝업. 로그 = 잠김 · 상태 줄 · 팝업 글자. /// IEnumerator HubLockShots(Camera cam, OutGameRoot root) { if (only != null && Match("arena_locked") == null && Match("arena_stable_notice") == null) yield break; var d = root.Session.Save; var lg = new StageTemp(d, LeagueRules.UnlockStage); var rd = new StageTemp(d, RaidRules.UnlockStage); lg.Set(false); rd.Set(false); root.Arena.SetPage(0); root.Show(root.Arena); var hub = root.Arena.Hub; yield return Shot(cam, "arena_locked", W, H); if (hub != null) foreach (var s in hub.Spots) if (s.open == "league" || s.open == "raid" || s.locked) Log("arena_locked " + s.id + " lock=" + hub.LockShown(s.id) + " status=" + hub.StatusOf(s.id)); if (hub != null && (only == null || Match("arena_stable_notice") != null)) { ArenaHub.Spot upd = null; foreach (var s in hub.Spots) if (s.open == "update") upd = s; if (upd != null) { hub.Press(upd.id); yield return Shot(cam, "arena_stable_notice", W, H); Log("arena_stable_notice spot=" + upd.id + " page=" + root.Arena.Page + " modal=" + ModalText()); root.CloseModal(); } } lg.Restore(); rd.Restore(); root.Arena.SetPage(0); } /// /// 훈련장(보급전) 메뉴 아트 목록(PD 2026-11-18 · 시안 mock_s_top · bottom · locked) — 던전 해금 스테이지를 잠깐 깬 것으로 바꿔 찍고 되돌림(메모리 세이브): /// supply_list = 위 · supply_list_bottom = 맨 아래로 스크롤 · supply_locked = 모든 던전 해금 전 · supply_one_locked = 병법 훈련만 잠김(던전마다 개방 조건 · PD 2026-11-19 · /// 그 던전 조건을 스테이지 표 맨 끝 스테이지로 잠깐 바꿈 = SupplyRules.UnlockOverride). 오늘 요일 = 실제 날짜(닫힌 카드는 그날 따라 다름). 로그 = 카드 수 · 닫힌 · 잠긴 카드 · 조건 문장 · 요일 점 수. /// IEnumerator SupplyShots(Camera cam, OutGameRoot root) { if (only != null && Match("supply_list") == null && Match("supply_list_bottom") == null && Match("supply_locked") == null && Match("supply_one_locked") == null) yield break; var d = root.Session.Save; var temps = new Dictionary(); foreach (var dg in SupplyData.AllDungeons()) { var k = SupplyRules.UnlockStage(dg); if (!temps.ContainsKey(k)) temps[k] = new StageTemp(d, k); } // 한 던전만 잠김 = 스테이지 표 맨 끝 스테이지(장 · 번호 최대)를 조건으로 · 그 기록을 잠깐 안 깬 것으로 string lastKey = null; var cfg = root.Battle != null ? root.Battle.Config : null; if (cfg != null) { BalanceConfig.StageDef last = null; foreach (var sd in cfg.stages) if (last == null || sd.chapter > last.chapter || (sd.chapter == last.chapter && sd.stage > last.stage)) last = sd; if (last != null) lastKey = last.chapter + "-" + last.stage; } StageTemp lastTemp = lastKey != null && !temps.ContainsKey(lastKey) ? new StageTemp(d, lastKey) : null; root.Show(root.Arena); foreach (var key in new[] { "supply_list", "supply_list_bottom", "supply_locked", "supply_one_locked" }) { if (only != null && Match(key) == null) continue; foreach (var t in temps.Values) t.Set(key != "supply_locked"); SupplyRules.UnlockOverride.Clear(); if (key == "supply_one_locked" && lastKey != null) { SupplyRules.UnlockOverride[SupplyData.Tactics] = lastKey; if (lastTemp != null) lastTemp.Set(false); } root.Arena.SetPage(0); root.Arena.SetPage(2); var sp = root.Arena.Supply; if (key == "supply_list_bottom" && sp != null && sp.Scroll != null) { Canvas.ForceUpdateCanvases(); sp.Scroll.verticalNormalizedPosition = 0f; } yield return Shot(cam, key, W, H); if (sp != null) { var info = new List(); foreach (var dg in SupplyData.AllDungeons()) { var card = sp.CardOf(dg.id); info.Add(dg.id + ":" + sp.DayDotsOf(dg.id) + (sp.IsClosed(dg.id) ? "(닫힘)" : "") + (sp.IsLocked(dg.id) ? "(잠김 " + LockOverlay.TextOf(card, LockOverlay.CondName) + ")" : "")); } Log(key + " visible=" + root.Arena.SupplyVisible + " cards=" + sp.CardCount + " lockedCards=" + sp.LockedCount + " screenOverlay=" + (LockOverlay.Find(sp.View) != null) + " days=" + string.Join(",", info.ToArray())); } } SupplyRules.UnlockOverride.Clear(); foreach (var t in temps.Values) t.Restore(); if (lastTemp != null) lastTemp.Restore(); root.Arena.SetPage(0); } /// /// 맹장 토벌전 아트 화면(PD 2026-11-18 · 시안 raid_banner/final/mock_raid.png) — 해금 스테이지(raid.unlock_stage)를 잠깐 깬 것으로 바꿔 찍고 되돌림(메모리 세이브): /// arena_raid = 토벌 탭(메인 · 서브 카드 · 주간 점수 띠) · arena_raid_shop = 훈장 상점 탭 · arena_raid_locked = 해금 전(해금 스테이지를 잠깐 안 깬 것으로 · 들어가지 않고 허브 + 개방 조건 안내 팝업 · PD 2026-11-19). 이번 주 메인 · 오늘 서브 = 실제 날짜. 로그 = 메인 · 서브 · 카드 · 칸 · 상점 줄 수 · 팝업 글자. /// IEnumerator RaidShots(Camera cam, OutGameRoot root) { if (only != null && Match("arena_raid") == null && Match("arena_raid_shop") == null && Match("arena_raid_locked") == null) yield break; var d = root.Session.Save; int lc, ls; StageState st = null; int clears0 = 0; bool created = false; if (ArenaRules.ParseStageKey(ContentTables.Str(RaidData.Mode, "unlock_stage"), out lc, out ls)) { created = d.Stage(lc, ls, false) == null; st = d.Stage(lc, ls, true); clears0 = st.clears; st.clears = Mathf.Max(1, st.clears); } root.Show(root.Arena); foreach (var key in new[] { "arena_raid", "arena_raid_shop", "arena_raid_locked" }) { if (only != null && Match(key) == null) continue; if (st != null) st.clears = key == "arena_raid_locked" ? 0 : Mathf.Max(1, clears0); // 해금 전 = 잠김 덮개(PD 2026-11-18) root.Arena.SetPage(0); root.Arena.SetPage(4); // 해금 전 = 들어가지 않고 허브 + 개방 조건 안내 팝업(PD 2026-11-19) var rd = root.Arena.Raid; if (rd != null && key == "arena_raid_shop") rd.PressTab("shop"); yield return Shot(cam, key, W, H); if (key == "arena_raid_locked") Log(key + " page=" + root.Arena.Page + " modal=" + ModalText()); else if (rd != null) Log(key + " visible=" + root.Arena.RaidVisible + " main=" + rd.MainId + " sub=" + rd.SubId + " cards=" + rd.CardCount + " tiles=" + rd.TileCount + " shop=" + rd.ShopRows + " locked=" + rd.Locked); root.CloseModal(); } root.Arena.SetPage(0); if (st != null) { st.clears = clears0; if (created) d.stages.Remove(st); } } /// /// 천하제일 탑 아트 화면(PD 2026-11-18 「B안으로 진행해」 · 시안 mock_t_b2 · b37) — 깬 층을 잠깐 바꿔 찍고 되돌림(메모리 세이브): /// arena_tower = 지금 진행 그대로 · arena_tower_10 = 9층까지 깸(보스 층 도전) · arena_tower_37 = 36층까지 · arena_tower_tall = 37층 긴 화면(1080×2340). /// 로그 = 도전 층 · 보이는 조각 · 현판 글자 · 적 칸 수. /// IEnumerator TowerShots(Camera cam, OutGameRoot root) { if (only != null && Match("arena_tower") == null && Match("arena_tower_10") == null && Match("arena_tower_37") == null && Match("arena_tower_tall") == null) yield break; var d = root.Session.Save; int best0 = d.arena.towerFloor; root.Show(root.Arena); foreach (var sh in new[] { new KeyValuePair("arena_tower", best0), new KeyValuePair("arena_tower_10", 9), new KeyValuePair("arena_tower_37", 36), new KeyValuePair("arena_tower_tall", 36) }) { if (only != null && Match(sh.Key) == null) continue; d.arena.towerFloor = sh.Value; root.Arena.SetPage(0); root.Arena.SetPage(1); bool tall = sh.Key.EndsWith("_tall"); yield return Shot(cam, sh.Key, W, tall ? HTall : H); var tw = root.Arena.Tower; if (tw != null) Log(sh.Key + " visible=" + root.Arena.TowerVisible + " current=" + tw.Current + " pieces=" + tw.VisiblePieces + " plaques=" + tw.VisiblePlaques + " enemies=" + tw.EnemyCards + " cam=" + tw.Cam.ToString("0.0")); } d.arena.towerFloor = best0; root.Arena.SetPage(0); } /// /// 투기장 아트 화면(PD 2026-11-18 「투기장 UI 완료」) — 16:9(1080×1920) + 긴 화면(1080×2340) · 해금 스테이지(arena.unlock_stage)를 깬 것으로 잠깐 바꿔 찍고 되돌림(메모리 세이브 · 뒤 화면에 영향 없음). /// arena_league_locked = 해금 전(해금 스테이지를 잠깐 안 깬 것으로 · 들어가지 않고 허브 + 개방 조건 안내 팝업 · PD 2026-11-19). 로그 = 유닛 · NPC · 목패 · 이름표 수 · 화면 배율 · 팝업 글자. /// IEnumerator LeagueShots(Camera cam, OutGameRoot root) { if (only != null && Match("arena_league") == null && Match("arena_league_tall") == null && Match("arena_league_locked") == null) yield break; var d = root.Session.Save; int lc, ls; StageState st = null; int clears0 = 0; bool created = false; if (ArenaRules.ParseStageKey(ContentTables.Str("arena", "unlock_stage"), out lc, out ls)) { created = d.Stage(lc, ls, false) == null; st = d.Stage(lc, ls, true); clears0 = st.clears; st.clears = Mathf.Max(1, st.clears); } root.Show(root.Arena); root.Arena.SetPage(3); yield return Shot(cam, "arena_league", W, H); var lg = root.Arena.League; if (lg != null) Log("arena_league visible=" + root.Arena.LeagueVisible + " units=" + lg.UnitCount + " npcs=" + lg.NpcCount + " plaques=" + lg.PlaqueCount + " tags=" + lg.TagCount + " zoom=" + (lg.Fitter != null ? lg.Fitter.Zoom.ToString("0.000") : "-")); yield return Shot(cam, "arena_league_tall", W, HTall); if (lg != null) Log("arena_league_tall zoom=" + (lg.Fitter != null ? lg.Fitter.Zoom.ToString("0.000") : "-")); if (st != null && (only == null || Match("arena_league_locked") != null)) // 해금 전 = 들어가지 않고 허브 + 개방 조건 안내 팝업(PD 2026-11-19) { st.clears = 0; root.Arena.SetPage(0); root.Arena.SetPage(3); yield return Shot(cam, "arena_league_locked", W, H); Log("arena_league_locked page=" + root.Arena.Page + " modal=" + ModalText()); root.CloseModal(); } root.Arena.SetPage(0); if (st != null) { st.clears = clears0; if (created) d.stages.Remove(st); } } /// /// 연의 전기 아트 화면(PD 2026-11-18 「연의 전기 통과」) — 탭 3장(처음 탭 · 1부 상 · 빈 탭 2부) + 펼침 연출 연속(-uiOnly scn_open_anim 일 때만) + 상세 + 긴 화면(목록 · 상세). /// 캡처용 진행(메모리 세이브 · 찍은 뒤 되돌림): 편 번호 1~8 의 해금 스테이지와 9장 해금 스테이지 · 서장 스테이지를 깬 것으로 · 1~8 편 연의 승리(+ 도전 1) = 9장 장판파가 새 편(시안 예시와 같은 탭). /// IEnumerator ScenarioShots(Camera cam, OutGameRoot root) { string[] names = { "scn_list", "scn_list_b", "scn_list_p2", "scn_open_anim", "scn_detail", "scn_list_tall", "scn_detail_tall" }; if (only != null && System.Array.TrueForAll(names, n => Match(n) == null)) yield break; var d = root.Session.Save; string scnBackup = JsonUtility.ToJson(d.scenario); var stagesBackup = d.stages.ConvertAll(s => JsonUtility.FromJson(JsonUtility.ToJson(s))); int ch, st; string newId = ""; foreach (var b in ScenarioModeRules.Battles()) { int no = b.I("n_no"); if (no == 0) { var p = d.Stage(b.I("n_spec_chapter"), b.I("n_acts"), true); p.clears = Mathf.Max(1, p.clears); continue; } if (no > 9 || !ArenaRules.ParseStageKey(b.S("s_unlock_stage"), out ch, out st)) continue; var s = d.Stage(ch, st, true); s.clears = Mathf.Max(1, s.clears); if (no == 9) { newId = b.S("s_id"); continue; } var e = d.scenario.Get(b.S("s_id"), true); e.normal[0] = true; e.normal[1] = no % 2 == 1; } root.Show(root.Arena); root.Arena.SetPage(ArenaScreen.ScenarioPage); var sc = root.Arena.Scenario; yield return Shot(cam, "scn_list", W, H); if (sc != null) { Log("scn_list visible=" + root.Arena.ScenarioVisible + " tab=" + sc.TabId + " rolls=" + sc.RollCount + " tabs=" + sc.TabCount + " new=" + newId + " stars=" + sc.TextOf("StarsText")); string first = sc.TabId; sc.SetTab("p1_a"); yield return Shot(cam, "scn_list_b", W, H); Log("scn_list_b tab=" + sc.TabId + " rolls=" + sc.RollCount); sc.SetTab("p2"); yield return Shot(cam, "scn_list_p2", W, H); sc.SetTab(first); if (only != null && Match("scn_open_anim") != null) { yield return new WaitForSecondsRealtime(0.3f); sc.Open(newId); yield return AnimFrames(cam, "scn_open_anim", 12, 0.22f); sc.CloseDetail(); } sc.Open(newId, true); yield return Shot(cam, "scn_detail", W, H); Log("scn_detail open=" + sc.OpenId + " title=" + sc.TextOf("DetailTitle") + " win=" + sc.TextOf("Win_tagText") + " team=" + sc.TextOf("TeamName")); sc.CloseDetail(); yield return Shot(cam, "scn_list_tall", W, HTall); Log("scn_list_tall zoom=" + (sc.Fitter != null ? sc.Fitter.Zoom.ToString("0.000") : "-")); sc.Open(newId, true); yield return Shot(cam, "scn_detail_tall", W, HTall); sc.CloseDetail(); } root.Arena.SetPage(0); JsonUtility.FromJsonOverwrite(scnBackup, d.scenario); d.stages.Clear(); d.stages.AddRange(stagesBackup); } /// 지정 목록에 맞는 토큰(없으면 null). string Match(string name) { foreach (var t in only) { string k = t.Trim(); if (k.EndsWith("*") ? name.StartsWith(k.Substring(0, k.Length - 1)) : name == k) return k; } return null; } IEnumerator Shot(Camera cam, string name, int w, int h) { if (only != null) { string k = Match(name); if (k == null) { // 지정 화면을 모두 찍었으면 나머지 흐름(월드맵 · 전투 등)은 건너뛰고 끝낸다 if (matched.Count >= only.Length) Finish(0); yield break; } matched.Add(k); } yield return Wait(); // 캔버스 층 · 드로우콜 실측(PD 2026-11-10 UI 구조 개선 전·후 비교 · ui_layers.csv) yield return UiLayerProbe.Measure(name, Log, OutputDir); string file = Path.Combine(OutputDir, shot.ToString("00") + "_" + name + ".png"); shot++; yield return CaptureUtil.Capture(cam, w, h, file); Log("shot " + file); } void Log(string s) { log.Add(s); Debug.Log("[UICapture] " + s); try { File.WriteAllLines(Path.Combine(OutputDir, "capture_log.txt"), log.ToArray()); } catch { } } void Finish(int code) { Log("finish code=" + code); #if UNITY_EDITOR UnityEditor.EditorApplication.Exit(code); #else Application.Quit(code); #endif } } }