From 44f3808904144086f96e52dd493bcb6758a8b316 Mon Sep 17 00:00:00 2001 From: swrring Date: Thu, 26 Nov 2026 08:46:09 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=B4=EC=83=81=EB=8F=84=20=EB=8C=80?= =?UTF-8?q?=EC=9D=91=20+=20=EA=B5=AC=EA=B8=80=20=ED=94=8C=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=20=EC=9A=94=EA=B1=B4(=EB=B0=B1=ED=82=A4=20=C2=B7=20?= =?UTF-8?q?=EB=85=B8=EC=B9=98=20=EC=95=88=EC=A0=84=20=EC=98=81=EC=97=AD=20?= =?UTF-8?q?=C2=B7=20=EC=95=B1=20=EC=A0=84=ED=99=98=20=EC=9D=BC=EC=8B=9C?= =?UTF-8?q?=EC=A0=95=EC=A7=80=20=C2=B7=2060fps)(PD=202026-11-26=20?= =?UTF-8?q?=E3=80=8C=EC=BB=A4=EB=B0=8B=20=C2=B7=20=ED=91=B8=EC=8B=9C?= =?UTF-8?q?=ED=95=B4=E3=80=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 모바일 영웅 작게 = Android 유닛 그림 최대 512 임포트 × sprite.rect 크기 계산 → UnitArtData.SrcPx(원본 px) · 카드 · 서 있는 유닛 · 내정 NPC · 뽑기 배우 - 뽑기 오른쪽 잘림 = 캔버스 맞춤 Expand(UiLayer.Root · ScaleFactor · 1080×1920 변화 없음) - 로비 · 내정 아래 빔 = UiArtCover 자동 확대 · 영웅 상세 · 편성 · 뽑기 버튼 = UiTallLayout · 태블릿 거래 · 공방 가운데(UiFitHeight.maxWidth) - 안전 영역 UiSafeArea(UiSafeFit · UiSafeBleed · Wrap) = 아웃게임 화면 · 재화 바 · 하단 탭 · 전투 HUD(SafeArea 칸 · FindPart) · 월드맵 · 건너뛰기 · 보상 띠 - 백키 BackKeyRouter · UiBack · ExitConfirm(로비 · 타이틀 = 종료 확인 · 전투 = 중단 팝업 · 덮개 = 닫기/건너뛰기) · 앱 전환 = 전투 중단 팝업 · 모바일 60fps - 해상도 검수 캡처(Logs/ui_capture_size.txt) · BackKeyTests 5 · UILayerTests HUD 경로 반영 - 같은 파일의 다른 세션 미커밋 변경은 제외(이 작업 덩어리만) Co-Authored-By: Claude Opus 5.5 --- .../Scripts/OutGame/Domestic/DomesticScene.cs | 7 + .../OutGame/Domestic/DomesticScreen.cs | 2 +- Assets/Scripts/OutGame/Event/EventScreen.cs | 1 + .../OutGame/FirstFlow/FirstFlowSortie.cs | 2 +- .../Scripts/OutGame/FirstFlow/IntroScreen.cs | 5 + .../OutGame/Treasure/TreasureScreen.cs | 3 +- Assets/Scripts/OutGame/UI/BackKeyRouter.cs | 120 ++++++++++++++ .../Scripts/OutGame/UI/BackKeyRouter.cs.meta | 2 + Assets/Scripts/OutGame/UI/FormationScreen.cs | 7 + Assets/Scripts/OutGame/UI/GachaCutscene.cs | 10 +- Assets/Scripts/OutGame/UI/HeroScreens.cs | 9 +- Assets/Scripts/OutGame/UI/LobbyScreen.cs | 7 + Assets/Scripts/OutGame/UI/OutGameRoot.cs | 74 ++++++++- Assets/Scripts/OutGame/UI/SettingsPopup.cs | 8 + Assets/Scripts/OutGame/UI/TitleScreen.cs | 9 +- Assets/Scripts/OutGame/UI/TradeScreen.cs | 8 +- Assets/Scripts/OutGame/UI/UiArtCover.cs | 49 ++++++ Assets/Scripts/OutGame/UI/UiArtCover.cs.meta | 2 + Assets/Scripts/OutGame/UI/UiFitHeight.cs | 6 +- Assets/Scripts/OutGame/UI/UiKit.cs | 2 +- Assets/Scripts/OutGame/UI/UiTallLayout.cs | 88 ++++++++++ .../Scripts/OutGame/UI/UiTallLayout.cs.meta | 2 + Assets/Scripts/OutGame/UICaptureDriver.cs | 20 +++ .../OutGame/Workshop/WorkshopScreen.cs | 2 +- Assets/Scripts/Runtime/BattleHUD.cs | 34 ++++ Assets/Scripts/Runtime/CameraController.cs | 8 +- Assets/Scripts/Runtime/Scenario/BossIntro.cs | 11 +- .../Scripts/Runtime/Scenario/ScenarioEvent.cs | 11 +- Assets/Scripts/Runtime/SlingshotInput.cs | 31 ++++ .../Runtime/Tutorial/TutorialDirector.cs | 2 +- Assets/Scripts/Runtime/UI/UiBack.cs | 64 ++++++++ Assets/Scripts/Runtime/UI/UiBack.cs.meta | 2 + Assets/Scripts/Runtime/UI/UiLayer.cs | 17 ++ Assets/Scripts/Runtime/UI/UiSafeArea.cs | 155 ++++++++++++++++++ Assets/Scripts/Runtime/UI/UiSafeArea.cs.meta | 2 + Assets/Scripts/Runtime/UnitArt.cs | 12 ++ Assets/Scripts/Runtime/WorldMapScreen.cs | 1 + Assets/Tests/PlayMode/BackKeyTests.cs | 123 ++++++++++++++ Assets/Tests/PlayMode/BackKeyTests.cs.meta | 2 + Assets/Tests/PlayMode/MissionTests.cs | 2 +- Assets/Tests/PlayMode/UILayerTests.cs | 9 +- Assets/Tests/PlayMode/UiCaptureTests.cs | 33 +++- 42 files changed, 931 insertions(+), 33 deletions(-) create mode 100644 Assets/Scripts/OutGame/UI/BackKeyRouter.cs create mode 100644 Assets/Scripts/OutGame/UI/BackKeyRouter.cs.meta create mode 100644 Assets/Scripts/OutGame/UI/UiArtCover.cs create mode 100644 Assets/Scripts/OutGame/UI/UiArtCover.cs.meta create mode 100644 Assets/Scripts/OutGame/UI/UiTallLayout.cs create mode 100644 Assets/Scripts/OutGame/UI/UiTallLayout.cs.meta create mode 100644 Assets/Scripts/Runtime/UI/UiBack.cs create mode 100644 Assets/Scripts/Runtime/UI/UiBack.cs.meta create mode 100644 Assets/Scripts/Runtime/UI/UiSafeArea.cs create mode 100644 Assets/Scripts/Runtime/UI/UiSafeArea.cs.meta create mode 100644 Assets/Tests/PlayMode/BackKeyTests.cs create mode 100644 Assets/Tests/PlayMode/BackKeyTests.cs.meta diff --git a/Assets/Scripts/OutGame/Domestic/DomesticScene.cs b/Assets/Scripts/OutGame/Domestic/DomesticScene.cs index 32b55c13..16194457 100644 --- a/Assets/Scripts/OutGame/Domestic/DomesticScene.cs +++ b/Assets/Scripts/OutGame/Domestic/DomesticScene.cs @@ -82,6 +82,13 @@ namespace TKS.OutGame var fit = img.gameObject.AddComponent(); fit.aspectMode = AspectRatioFitter.AspectMode.WidthControlsHeight; fit.aspectRatio = artW / Mathf.Max(1f, artH); + // 세로로 긴 화면 = 그림 아래끝이 본문 아래끝에 닿을 만큼만 확대(로비와 같음 · PD 2026-11-26 해상도 대응) + var cover = img.gameObject.AddComponent(); + cover.baseZoom = zoom; + cover.artW = artW; + cover.artH = artH; + cover.top = view.y; + cover.Apply(); var amb = LobbyAmbient.Build(art, artW, artH, src); // 위 비네트(로비와 같은 그림 · 탭 글자 대비만) var vg = UiKit.Rect("Vignette", clip, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), Vector2.zero, new Vector2(0f, 180f)); diff --git a/Assets/Scripts/OutGame/Domestic/DomesticScreen.cs b/Assets/Scripts/OutGame/Domestic/DomesticScreen.cs index bf742091..466007d4 100644 --- a/Assets/Scripts/OutGame/Domestic/DomesticScreen.cs +++ b/Assets/Scripts/OutGame/Domestic/DomesticScreen.cs @@ -545,7 +545,7 @@ namespace TKS.OutGame if (data == null || data.Meta.pivot == null || data.Meta.pivot.Length < 2 || !data.Clips.TryGetValue("front_idle", out fr) || fr.Length == 0) continue; float hh = r.h > 0f ? r.h : 150f; float k = hh / Mathf.Max(1f, data.BodyPx); - var rt = UiKit.Rect("Npc_" + r.sprite, line, DomesticScene.Anchor(r.x, r.y, sc.artW, sc.artH), new Vector2(0.5f, data.Meta.pivot[1]), Vector2.zero, fr[0].rect.size * k); + var rt = UiKit.Rect("Npc_" + r.sprite, line, DomesticScene.Anchor(r.x, r.y, sc.artW, sc.artH), new Vector2(0.5f, data.Meta.pivot[1]), Vector2.zero, data.SrcPx(fr[0]) * k); // 원본 px(Android 임포트 축소 무관 · 2026-11-26) var img = rt.gameObject.AddComponent(); img.sprite = fr[0]; img.raycastTarget = false; diff --git a/Assets/Scripts/OutGame/Event/EventScreen.cs b/Assets/Scripts/OutGame/Event/EventScreen.cs index e85b36f2..ed169fad 100644 --- a/Assets/Scripts/OutGame/Event/EventScreen.cs +++ b/Assets/Scripts/OutGame/Event/EventScreen.cs @@ -307,6 +307,7 @@ namespace TKS.OutGame bar.offsetMin = Vector2.zero; bar.offsetMax = new Vector2(0f, OutGameRoot.TabBarH); UiKit.Skin(bar, "tabbar", UiKit.Col("chrome_tab", UiKit.BarColor), true); + OutGameRoot.Bleed(bar, false, UiKit.Col("chrome_tab", UiKit.BarColor)); // 제스처 바 자리까지 같은 색(2026-11-26 · 본 하단 탭과 같음) var items = tb.All("tab"); var ts = L("tab_size"); var tf = L("tab_focus"); diff --git a/Assets/Scripts/OutGame/FirstFlow/FirstFlowSortie.cs b/Assets/Scripts/OutGame/FirstFlow/FirstFlowSortie.cs index 9b2811a5..2bfc717e 100644 --- a/Assets/Scripts/OutGame/FirstFlow/FirstFlowSortie.cs +++ b/Assets/Scripts/OutGame/FirstFlow/FirstFlowSortie.cs @@ -273,7 +273,7 @@ namespace TKS.OutGame void DrawSkillButton(TutorialGuideUI gui, float pulse, float press) { - var rt = battle.Hud != null ? battle.Hud.transform.Find("Info/SkillButton") as RectTransform : null; + var rt = battle.Hud != null ? battle.Hud.FindPart("Info/SkillButton") as RectTransform : null; // 안전 영역 칸 안(2026-11-26) if (rt == null || !rt.gameObject.activeInHierarchy) return; var r = gui.UiRect(rt); gui.Frame(r, false, pulse); diff --git a/Assets/Scripts/OutGame/FirstFlow/IntroScreen.cs b/Assets/Scripts/OutGame/FirstFlow/IntroScreen.cs index 34727a30..1348006b 100644 --- a/Assets/Scripts/OutGame/FirstFlow/IntroScreen.cs +++ b/Assets/Scripts/OutGame/FirstFlow/IntroScreen.cs @@ -200,6 +200,11 @@ namespace TKS.OutGame } skipBtn = holder.gameObject; skipBtn.SetActive(false); + UiBack.Push(gameObject, () => // 물리 뒤로 가기 = 건너뛰기(보일 때만 · 그 전엔 삼킴 · 2026-11-26 Google Play 요건) + { + if (SkipShown) Skip(); + return true; + }); skipShow = sk.Length > 5 && sk[5].Trim().Length > 0 ? At(sk, 5, 0.5f) : ScenarioData.EvCfg("skip_show_after_sec"); // 검정 덮개(첫 장 = 검정에서 밝아짐 · 끝 = 검정으로) diff --git a/Assets/Scripts/OutGame/Treasure/TreasureScreen.cs b/Assets/Scripts/OutGame/Treasure/TreasureScreen.cs index ac876bde..f5306281 100644 --- a/Assets/Scripts/OutGame/Treasure/TreasureScreen.cs +++ b/Assets/Scripts/OutGame/Treasure/TreasureScreen.cs @@ -1583,7 +1583,8 @@ namespace TKS.OutGame var sp = row != null ? UISkin.Icon(row.sprite) : null; if (sp == null || parent == null) return; float w = row.w > 1f ? row.w : sp.rect.width, h = row.h > 1f ? row.h : sp.rect.height; - var rt = UiKit.Rect("RewardTitle", parent, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -row.y), new Vector2(w, h)); + float notch = parent is RectTransform prt ? UiSafeArea.Top * prt.rect.height : 0f; // 노치 밑으로(2026-11-26 해상도 대응) + var rt = UiKit.Rect("RewardTitle", parent, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -row.y - notch), new Vector2(w, h)); OpenTitle = rt.gameObject.AddComponent(); OpenTitle.sprite = sp; OpenTitle.raycastTarget = false; diff --git a/Assets/Scripts/OutGame/UI/BackKeyRouter.cs b/Assets/Scripts/OutGame/UI/BackKeyRouter.cs new file mode 100644 index 00000000..ea0dc1ed --- /dev/null +++ b/Assets/Scripts/OutGame/UI/BackKeyRouter.cs @@ -0,0 +1,120 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace TKS.OutGame +{ + /// + /// 물리 뒤로 가기 · 앱 전환 처리(PD 2026-11-26 「구글 플레이 피처드 정책 — 물리 백키로 돌아가기 or 취소」) — 게임 내내 1개(씬이 바뀌어도 유지). + /// 백키 순서 = 종료 확인창 → OutGameRoot(공용 팝업 → 덮개 UiBack → 전투 중단 팝업 · 결과 확인 → 화면 뒤로 → 로비 = 종료 확인) → (아웃게임 없음) 덮개 UiBack. + /// 앱이 백그라운드로 가면 전투 중 = 중단 팝업(일시정지) · 모바일 프레임 = 60(Google Play 핵심 품질 「렌더링 60fps」 · 유니티 모바일 기본 30). + /// + public class BackKeyRouter : MonoBehaviour + { + static BackKeyRouter inst; + + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] + static void Boot() + { + if (inst != null) return; + var go = new GameObject("BackKeyRouter"); + DontDestroyOnLoad(go); + inst = go.AddComponent(); + if (Application.isMobilePlatform) Application.targetFrameRate = 60; + } + + void Update() + { + if (Input.GetKeyDown(KeyCode.Escape)) Handle(); + } + + /// 백키 1번 처리(시험에서도 부름). + public static void Handle() + { + if (ExitConfirm.IsOpen) + { + ExitConfirm.Close(); + return; + } + var root = OutGameRoot.Instance; + if (root != null && root.HandleBackKey()) return; + UiBack.Handle(); + } + + void OnApplicationPause(bool paused) + { + if (!paused) return; + var root = OutGameRoot.Instance; + if (root != null) root.OnAppPause(); + } + } + + /// + /// 게임 종료 확인창(로비 · 타이틀에서 백키 · PD 2026-11-26) — 모든 화면 위 자기 캔버스(타이틀 850 보다 위) · 백키 = 취소 · 「종료」 = Application.Quit. + /// 모양 = 공용 팝업(OutGameRoot.ModalCustom)과 같은 테마 부품(popup · popup_head · 버튼). + /// + public static class ExitConfirm + { + const int Order = 900; + static GameObject go; + + public static bool IsOpen + { + get { return go != null; } + } + + public static void Show() + { + if (go != null) return; + var cam = Camera.main; + if (cam == null) return; + go = new GameObject("ExitConfirm"); + UiLayer.Root(go, cam, Order, 0.2f, UiLayer.Reference, UiRate.Event); + go.AddComponent(); + Sound.PlayUi(SoundKeys.UiPopup); + var root = (RectTransform)go.transform; + var dim = UiKit.Fill("Dim", root); + UiKit.Paint(dim, UISkin.Col("dim", new Color(0f, 0f, 0f, 0.6f)), false, true); + Image panel; + if (UISkin.Has("popup")) + { + panel = UiKit.Skin(UiKit.Rect("Panel", dim, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 20f), new Vector2(860f, 520f)), "popup", UiKit.Paper, true); + var head = UiKit.TopBand("Head", panel.transform, 6f, 110f, 7f, 7f); + UiKit.Skin(head, "popup_head", UiKit.Col("popup_band", UiKit.Header)); + UiKit.Title(UiKit.FillLabel(head, "게임 종료", 44, UiKit.HeaderText, TextAnchor.MiddleCenter, true, 110f), true); + } + else + { + panel = UiKit.Box("Panel", dim, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 20f), new Vector2(860f, 520f), UiKit.Paper); + panel.raycastTarget = true; + UiKit.Border(panel, UiKit.Line, 4f); + var head = UiKit.TopBand("Head", panel.transform, 0f, 110f); + UiKit.Paint(head, UiKit.Dark); + UiKit.FillLabel(head, "게임 종료", 44, UiKit.White); + } + var body = UiKit.Fill("Content", panel.transform, 40f, 40f, 130f, 160f); + UiKit.FillLabel(body, "게임을 종료하시겠습니까?", 38, UiKit.Ink, TextAnchor.MiddleCenter, false, 10f); + UiKit.Btn("Cancel", panel.transform, "취소", 34, UiKit.Dark, UiKit.White, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-200f, 36f), new Vector2(360f, 100f), Close); + UiKit.Btn("Quit", panel.transform, "종료", 34, UiKit.Red, UiKit.White, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(200f, 36f), new Vector2(360f, 100f), Quit); + } + + public static void Close() + { + if (go == null) return; + Sound.PlayUi(SoundKeys.UiClose); + go.SetActive(false); + Object.Destroy(go); + go = null; + } + + static void Quit() + { + Close(); + Debug.Log("[ExitConfirm] 종료"); +#if UNITY_EDITOR + UnityEditor.EditorApplication.isPlaying = false; +#else + Application.Quit(); +#endif + } + } +} diff --git a/Assets/Scripts/OutGame/UI/BackKeyRouter.cs.meta b/Assets/Scripts/OutGame/UI/BackKeyRouter.cs.meta new file mode 100644 index 00000000..77d19aa2 --- /dev/null +++ b/Assets/Scripts/OutGame/UI/BackKeyRouter.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 44664f0212b17f0409aad10c853e5ba3 \ No newline at end of file diff --git a/Assets/Scripts/OutGame/UI/FormationScreen.cs b/Assets/Scripts/OutGame/UI/FormationScreen.cs index 90b51d3b..0862c96f 100644 --- a/Assets/Scripts/OutGame/UI/FormationScreen.cs +++ b/Assets/Scripts/OutGame/UI/FormationScreen.cs @@ -236,6 +236,13 @@ namespace TKS.OutGame float gridTop = ScreenTable.At(grid, 1, 1110f) - top, gridBottom = OutGameRoot.BodyH - (ScreenTable.At(grid, 2, GridBottomAbs) - top); list = UiKit.ScrollGrid("List", body, side, side, gridTop, gridBottom, cell, new Vector2(17f, 16f), 4, out scroll); UiKit.ScrollFades(body, gridTop, gridBottom, 40f, 30f); + // 세로로 긴 화면(PD 2026-11-26 해상도 대응) = 보유 영웅 판 · 목록을 남는 높이만큼 아래로 늘림(한 번에 더 많은 줄 · 아래 빈 띠 없음) + var tall = body.GetComponent(); + if (tall == null) tall = body.gameObject.AddComponent(); + tall.designH = OutGameRoot.BodyH; + var panelB = body.Find("PanelB") as RectTransform; + if (panelB != null) tall.stretch.Add(panelB); + if (scroll != null) tall.stretch.Add((RectTransform)scroll.transform); } public override void OnShow() diff --git a/Assets/Scripts/OutGame/UI/GachaCutscene.cs b/Assets/Scripts/OutGame/UI/GachaCutscene.cs index 5aa10c91..c3f55952 100644 --- a/Assets/Scripts/OutGame/UI/GachaCutscene.cs +++ b/Assets/Scripts/OutGame/UI/GachaCutscene.cs @@ -341,6 +341,11 @@ namespace TKS.OutGame tap.transition = Selectable.Transition.None; tap.targetGraphic = back; tap.onClick.AddListener(OnPointer); + UiBack.Push(dim.gameObject, () => // 물리 뒤로 가기 = 탭과 같음(장면 건너뛰기 → 카드 전부 공개 → 닫기 · 2026-11-26 Google Play 요건) + { + OnPointer(); + return true; + }); BuildStage(dim); flash = Full("Flash", dim, Color.white); @@ -537,13 +542,14 @@ namespace TKS.OutGame var data = UnitArt.Load(r.sprite); Sprite[] idle; if (data == null || !data.Clips.TryGetValue(IdleClip, out idle) || idle.Length == 0) continue; - float body = data.BodyPx > 0.5f ? data.BodyPx : idle[0].rect.height; + var src = data.SrcPx(idle[0]); // 원본 px(Android 임포트 축소 무관 · 2026-11-26) + float body = data.BodyPx > 0.5f ? data.BodyPx : src.y; float k = r.h / body; var a = new Actor { data = data, idle = idle, phase = r.phase, flip = r.n == 1 ? -1f : 1f }; float pivotY = data.Meta.pivot != null && data.Meta.pivot.Length > 1 ? data.Meta.pivot[1] : 0f; a.shadow = Shadow("Shadow" + r.slot, r.x, r.y, shadowRow != null && shadowRow.scale > 0.5f ? r.h / shadowRow.scale : 1f); if (a.shadow != null) a.shadowHome = a.shadow.anchoredPosition; - a.rt = Px("Actor" + r.slot, frontLayer, r.x, r.y, idle[0].rect.width * k, idle[0].rect.height * k, 0.5f, pivotY); + a.rt = Px("Actor" + r.slot, frontLayer, r.x, r.y, src.x * k, src.y * k, 0.5f, pivotY); a.home = a.rt.anchoredPosition; a.img = a.rt.gameObject.AddComponent(); a.img.sprite = idle[0]; diff --git a/Assets/Scripts/OutGame/UI/HeroScreens.cs b/Assets/Scripts/OutGame/UI/HeroScreens.cs index 8fe85656..bb6efd15 100644 --- a/Assets/Scripts/OutGame/UI/HeroScreens.cs +++ b/Assets/Scripts/OutGame/UI/HeroScreens.cs @@ -132,7 +132,8 @@ namespace TKS.OutGame Image art; if (body > 0.5f && m.pivot != null && m.pivot.Length > 1) { - float hgt = sp.rect.height; + var src = a.SrcPx(sp); // 원본 px(Android 임포트 축소와 무관 · 2026-11-26 모바일 영웅 작게 나옴) + float hgt = src.y; bool mounted = a.Mounted; float k = UnitPx / size * (mounted ? MountedScale : 1f); if (mounted) k = Mathf.Min(k, MountedMaxBody / body); @@ -147,7 +148,7 @@ namespace TKS.OutGame pivotY = Mathf.Clamp01((m.pivot[1] * hgt + body) / hgt); // 머리 끝 = 프레임 아래에서의 비율(눈 높이 없는 그림) y = HeadTop + (mounted ? MountedDrop : FootDrop); } - art = UiKit.Rect("Character", b, new Vector2(0.5f, 1f), new Vector2(0.5f, pivotY), new Vector2(0f, -y), sp.rect.size * k).gameObject.AddComponent(); + art = UiKit.Rect("Character", b, new Vector2(0.5f, 1f), new Vector2(0.5f, pivotY), new Vector2(0f, -y), src * k).gameObject.AddComponent(); } else { @@ -766,6 +767,10 @@ namespace TKS.OutGame evolveDot = Ico(body, "new_dot", 498f, 1380f, 36f, 36f); costumeDot = Ico(body, "new_dot", 1014f, 1380f, 36f, 36f); // 외형 = 새 꾸미기(2026-11-20) } + // 세로로 긴 화면(PD 2026-11-26 해상도 대응) = 레벨 줄(y 630)부터 아래 묶음(레벨 · 이름 띠 · 스킬 · 메뉴)을 남는 높이만큼 내림 → 일러와 레벨 줄 사이가 벌어지고 장면 그림이 더 보임 + var tall = body.gameObject.AddComponent(); + tall.designH = OutGameRoot.BodyH; + tall.splitY = 630f; } /// 그 영웅의 진영 × 태생 ★ 장면(표 bg 줄 · 같은 진영 없으면 other · 같은 ★ 없으면 낮은 ★) + 바탕 색 · 일러 뒤 빛 · 발밑 그림자 · 화면이 넓으면 폭 맞춤. diff --git a/Assets/Scripts/OutGame/UI/LobbyScreen.cs b/Assets/Scripts/OutGame/UI/LobbyScreen.cs index 16241f00..9367e6da 100644 --- a/Assets/Scripts/OutGame/UI/LobbyScreen.cs +++ b/Assets/Scripts/OutGame/UI/LobbyScreen.cs @@ -62,6 +62,13 @@ namespace TKS.OutGame var fit = bimg.gameObject.AddComponent(); fit.aspectMode = AspectRatioFitter.AspectMode.WidthControlsHeight; fit.aspectRatio = artW / Mathf.Max(1f, artH); + // 세로로 긴 화면 = 그림 아래끝이 본문 아래끝에 닿을 만큼만 확대(좌우 조금 잘림 · PD 2026-11-26 「로비 하단이 비어 보임」 · 더 긴 그림이 오면 확대 없이 덮음) + var cover = bimg.gameObject.AddComponent(); + cover.baseZoom = zoom; + cover.artW = artW; + cover.artH = artH; + cover.top = top; + cover.Apply(); // 장면 층(Frame 캔버스 1장) = 뒤 연출(깃발·불빛) → 영웅(대기 프레임 재생) → 앞 연출(새·꽃잎) scene = LobbyAmbient.Build(art2, artW, artH).Lineup; } diff --git a/Assets/Scripts/OutGame/UI/OutGameRoot.cs b/Assets/Scripts/OutGame/UI/OutGameRoot.cs index ba335db8..231d1552 100644 --- a/Assets/Scripts/OutGame/UI/OutGameRoot.cs +++ b/Assets/Scripts/OutGame/UI/OutGameRoot.cs @@ -60,11 +60,14 @@ namespace TKS.OutGame /// /// 제목 띠 아래 ~ 하단 탭 위 본문 — 기준(1080×1920)의 본문 높이보다 화면이 낮으면(예 1536×2048 = 3:4) 본문 전체를 같은 비율로 줄여 탭 바 밑으로 숨지 않게 한다(PD #1100 · 배치는 그대로). /// - protected RectTransform Body(string name = "Body") + /// true = 넓은 화면(태블릿)에서 본문 폭을 기준 1080 으로 가운데(바탕 그림을 본문 안에 깔지 않는 목록형 화면 · 2026-11-26) + protected RectTransform Body(string name = "Body", bool center = false) { var outer = UiKit.Fill(name, Rt, 0f, 0f, OutGameRoot.TopBarH + OutGameRoot.HeaderH, OutGameRoot.TabBarH); var inner = UiKit.Rect("Fit", outer, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), Vector2.zero, new Vector2(OutGameRoot.Reference.x, OutGameRoot.BodyH)); - inner.gameObject.AddComponent().designHeight = OutGameRoot.BodyH; + var fit = inner.gameObject.AddComponent(); + fit.designHeight = OutGameRoot.BodyH; + if (center) fit.maxWidth = OutGameRoot.Reference.x; return inner; } } @@ -101,6 +104,8 @@ namespace TKS.OutGame Canvas topCanvas; Canvas resultCanvas; public RectTransform TopRoot { get; private set; } + /// 위 덮개 캔버스의 안전 영역 칸(재화 바 · 토스트 · 노치 · 제스처 바만큼 들임 · 2026-11-26) — 화면 끝에 붙는 버튼 · 글자를 위 덮개에 둘 때 부모로. + public RectTransform SafeTop { get; private set; } public LobbyScreen Lobby { get; private set; } public HeroListScreen HeroList { get; private set; } @@ -289,6 +294,7 @@ namespace TKS.OutGame { scr.Root = this; scr.Rt = UiKit.Fill(typeof(T).Name, mainCanvas.transform); + scr.Rt.gameObject.AddComponent().Apply(); // 화면 = 안전 영역 안(노치 · 제스처 바 · 2026-11-26) · 위아래 띠 자리는 재화 바 · 하단 탭 덧댐이 덮음 UiLayer.Nest(scr.Rt.gameObject, UiRate.Event, true); // 화면 1장 = 자기 캔버스(값 갱신이 바탕·탭·다른 화면을 다시 묶지 않게) scr.Build(); scr.Rt.gameObject.SetActive(false); @@ -296,6 +302,23 @@ namespace TKS.OutGame return scr; } + /// 안전 영역 칸(부모 = 화면 전체 루트 캔버스 · 노치 · 제스처 바만큼 들임 · 2026-11-26). + static RectTransform SafeBox(Transform canvasRoot) + { + var rt = UiKit.Fill("SafeArea", canvasRoot); + rt.gameObject.AddComponent().Apply(); + return rt; + } + + /// 띠 바탕을 노치 · 제스처 바 자리까지 늘리는 덧댐(위 = 재화 바 위 · 아래 = 하단 탭 아래 · 여백 0 = 높이 0). + public static void Bleed(RectTransform band, bool top, Color col) + { + var b = UiKit.Rect(top ? "SafeBleedTop" : "SafeBleedBottom", band, new Vector2(0.5f, 1f), new Vector2(0.5f, 0f), Vector2.zero, Vector2.zero); + b.SetAsFirstSibling(); + b.gameObject.AddComponent().top = top; + UiKit.Paint(b, col, false, true); + } + Canvas MakeCanvas(string name, int order, float plane, UiRate rate) { var go = new GameObject(name); @@ -398,6 +421,42 @@ namespace TKS.OutGame if (current.OnBack()) return; if (current == HeroDetail) Show(HeroList); else if (current != Lobby) Show(Lobby); + else ExitConfirm.Show(); // 본영 로비 = 맨 처음 화면 → 게임 종료 확인(PD 2026-11-26 Google Play 요건) + } + + /// + /// 물리 뒤로 가기(BackKeyRouter · PD 2026-11-26 Google Play 요건) — 공용 팝업 닫기 → 덮개(설정 · 연출 · 대사 등 UiBack) → + /// 첫 실행 흐름의 대사 · 화면 전환 중 = 받지 않음(기존 결정) → 전투 중 = 중단 팝업 열기/닫기 · 결과 = 확인(탭과 같음) → 화면 뒤로(로비 = 종료 확인) · 처리했으면 true. + /// + public bool HandleBackKey() + { + if (!isActiveAndEnabled) return false; + if (modal != null) + { + CloseModal(); + return true; + } + if (UiBack.Handle()) return true; + if (Flow != null && Flow.Busy) return true; + if (Battle != null && Battle.Phase != BattlePhase.Setup) + { + var ph = Battle.Phase; + if (ph == BattlePhase.StageClear || ph == BattlePhase.Defeat) + { + if (resultDone && result != null && result.Visible) Battle.ContinueAfterResult(); + } + else if (Battle.Hud != null) Battle.Hud.BackKey(); + return true; + } + Back(); + return true; + } + + /// 앱이 백그라운드로 감(홈 · 전환 · 화면 끔) — 전투 중이면 중단 팝업을 띄워 돌아왔을 때 일시정지 상태(Google Play 「앱 전환 시 일시정지 · 복귀 시 재개」). + public void OnAppPause() + { + if (Battle == null || Battle.Hud == null || Battle.Phase == BattlePhase.Setup) return; + if (!Battle.Hud.GiveUpOpen && Battle.Hud.GiveUpVisible) Battle.Hud.OpenGiveUp(); } /// 이벤트 화면(로비 「이벤트」 버튼 · PD 2026-11-19) — 기기 세이브 모드 + 표가 있을 때만 · 아니면 준비 중(PD 결정 ①). @@ -431,7 +490,7 @@ namespace TKS.OutGame if (current != null && ScreensVisible && !inBattle) current.OnTick(); } if (toast != null && Time.unscaledTime > toastUntil) toast.SetActive(false); - if (Input.GetKeyDown(KeyCode.Escape) && !inBattle && !(Flow != null && Flow.Busy)) Back(); // 첫 실행 흐름의 대사 · 화면 전환 중에는 뒤로 가기를 받지 않음 + // 뒤로 가기(Esc · Android 백키) = BackKeyRouter → HandleBackKey(2026-11-26 · 전투 · 덮개 · 로비 종료 확인까지 한곳에서) #if UNITY_EDITOR if (Input.GetKeyDown(KeyCode.F5) && inBattle) RestartPrologueAct(); #endif @@ -458,8 +517,10 @@ namespace TKS.OutGame void BuildCurrencyBar() { - barRoot = UiKit.TopBand("CurrencyBar", TopRoot, 0f, TopBarH); + if (SafeTop == null) SafeTop = SafeBox(TopRoot); // 재화 바 · 토스트 = 안전 영역 안(2026-11-26) + barRoot = UiKit.TopBand("CurrencyBar", SafeTop, 0f, TopBarH); UiLayer.Nest(barRoot.gameObject, UiRate.Event, true); // 군량 타이머 = 1초마다 · 팝업·토스트와 따로 + Bleed(barRoot, true, UiKit.Col("chrome_top", UiKit.Col("chrome_tab", UiKit.BarColor))); // 노치 자리 = 재화 띠와 같은 색 // 투명 판 = 아래 클릭 막기용 UiKit.Paint(barRoot, UISkin.On ? Color.clear : new Color(0.15f, 0.11f, 0.09f), false, true); // 재화 띠 바탕(PD 2026-11-21 「영웅 · 보물 · 내정 · 거래 화면 탑바 배경 통일 · 비어 있기보다 채워진 상태 · 너무 밝지 않게 컨셉에 맞게」) @@ -563,7 +624,8 @@ namespace TKS.OutGame void BuildTabBar() { - var bar = UiKit.Rect("TabBar", mainCanvas.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), Vector2.zero, new Vector2(Reference.x, TabBarH)); + // 하단 탭 = 안전 영역 안(제스처 바 위 · 2026-11-26) · 아래 덧댐이 화면 끝까지 같은 색 + var bar = UiKit.Rect("TabBar", SafeBox(mainCanvas.transform), new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), Vector2.zero, new Vector2(Reference.x, TabBarH)); tabBar = bar; bar.anchorMin = new Vector2(0f, 0f); bar.anchorMax = new Vector2(1f, 0f); @@ -571,6 +633,7 @@ namespace TKS.OutGame bar.offsetMax = new Vector2(0f, TabBarH); if (UISkin.Has("tabbar")) UiKit.Skin(bar, "tabbar", UiKit.Col("chrome_tab", UiKit.BarColor), true); else UiKit.Paint(bar, UiKit.Dark, false, true); + Bleed(bar, false, UiKit.Col("chrome_tab", UiKit.BarColor)); // 탭 번호 = 이 배열의 자리(화면 Tab · OnTab) — 공방 = 5번(PD 2026-11-24) · 놓는 순서는 order(공방 = 내정과 거래 사이 · 번호는 그대로) string[] names = { "영웅", "보물", "내정", "동맹", "거래", "공방" }; string[] marks = { "영", "보", "내", "잠", "거", "공" }; @@ -788,6 +851,7 @@ namespace TKS.OutGame toastText = UiKit.Title(UiKit.FillLabel(img.transform, "", 32, UiKit.White, TextAnchor.MiddleCenter, false, 16f)); // 안내 글자 = 게임 글꼴(PD 2026-11-19) } toast.transform.SetAsLastSibling(); + ((RectTransform)toast.transform).anchoredPosition = new Vector2(0f, TabBarH + 40f + UiSafeArea.Bottom * TopRoot.rect.height); // 제스처 바 위(2026-11-26) · 팝업보다 위에 뜨도록 위 덮개 루트에 그대로 toastText.text = msg; toast.SetActive(true); toastUntil = Time.unscaledTime + 2.2f; diff --git a/Assets/Scripts/OutGame/UI/SettingsPopup.cs b/Assets/Scripts/OutGame/UI/SettingsPopup.cs index d7bb7e93..7597e83d 100644 --- a/Assets/Scripts/OutGame/UI/SettingsPopup.cs +++ b/Assets/Scripts/OutGame/UI/SettingsPopup.cs @@ -137,6 +137,14 @@ namespace TKS.OutGame Close(); Sound.PlayUi(SoundKeys.UiPopup); Build(root); + // 물리 뒤로 가기(2026-11-26 Google Play 요건) = 언어 목록이 떠 있으면 그것만 · 아니면 설정 창 닫기 + if (popup != null) + UiBack.Push(popup, () => + { + if (langPopup != null) CloseLang(); + else Close(); + return true; + }); } public static void Close() diff --git a/Assets/Scripts/OutGame/UI/TitleScreen.cs b/Assets/Scripts/OutGame/UI/TitleScreen.cs index 0f99237d..347df725 100644 --- a/Assets/Scripts/OutGame/UI/TitleScreen.cs +++ b/Assets/Scripts/OutGame/UI/TitleScreen.cs @@ -203,6 +203,11 @@ namespace TKS.OutGame var oc = Opt("canvas"); RootCanvas = UiLayer.Root(gameObject, cam, oc != null ? (int)oc.a : 850, oc != null && oc.b > 0f ? oc.b : 0.3f, UiLayer.Reference, UiRate.Static); var root = (RectTransform)transform; + UiBack.Push(gameObject, () => // 타이틀 = 첫 화면 → 물리 뒤로 가기 = 게임 종료 확인(2026-11-26 Google Play 요건) + { + ExitConfirm.Show(); + return true; + }); HideBelow(RootCanvas.sortingOrder); // 그림 공간(배경 크기 그대로 · 화면을 덮는 배율만 Update 에서) @@ -643,7 +648,7 @@ namespace TKS.OutGame static bool AnyInput() { - if (Input.anyKeyDown) return true; // 키보드 · 마우스 단추 + if (Input.anyKeyDown && !Input.GetKeyDown(KeyCode.Escape)) return true; // 키보드 · 마우스 단추(Esc = Android 백키 = 종료 확인 · 시작이 아님 · 2026-11-26) for (int i = 0; i < Input.touchCount; i++) if (Input.GetTouch(i).phase == TouchPhase.Began) return true; @@ -658,7 +663,7 @@ namespace TKS.OutGame last = now; if (!FixedClock) Elapsed += dt; FitArt(); - if (!Leaving && !IgnoreInput && AnyInput()) Press(); + if (!Leaving && !IgnoreInput && !ExitConfirm.IsOpen && AnyInput()) Press(); Apply(); } diff --git a/Assets/Scripts/OutGame/UI/TradeScreen.cs b/Assets/Scripts/OutGame/UI/TradeScreen.cs index 0bdb6e1e..3f57e809 100644 --- a/Assets/Scripts/OutGame/UI/TradeScreen.cs +++ b/Assets/Scripts/OutGame/UI/TradeScreen.cs @@ -147,7 +147,7 @@ namespace TKS.OutGame Tab = 4; if (UISkin.On) UiKit.Paint(UiKit.Fill("ListBg", Rt), UiKit.Col("list_bg", UiKit.Bg), false); // 목록형 바탕(Fable §5-3) Header("거래", "등용 · 상자 · 상점 · 패스", true); - var body = Body(); + var body = Body("Body", true); // 태블릿 = 가운데 1080(2026-11-26 해상도 대응 · 바탕 = 화면 ListBg) string[] names = { "명장 등용", "보물 상자", "상점·패스" }; for (int i = 0; i < names.Length; i++) { @@ -263,6 +263,12 @@ namespace TKS.OutGame singleCost = UiKit.BtnCost(singleBtn, "cur_gem", "", 44f, 34); tenBtn = UiKit.SkinBtn(p, "Ten", "btn_l_yellow", UiKit.White, g.TenCount + "회 등용", 44, UiKit.Col("text_on_yellow", UiKit.Ink), 1056f - 580f, 1270f, 580f, 122f, () => DoDraw(g.TenCount)); tenCost = UiKit.BtnCost(tenBtn, "cur_gem", "", 44f, 36); + if (p.GetComponent() == null) // 세로로 긴 화면 = 버튼 행을 남는 높이만큼 내려 「탭 바 위 24 고정」 유지(PD 2026-11-26 해상도 대응) + { + var tall = p.gameObject.AddComponent(); + tall.designH = OutGameRoot.BodyH; + tall.splitY = 1260f; + } var f2 = UiKit.Skin(UiKit.Rect("Free2", tenBtn.transform, new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(-14f, 2f), new Vector2(200f, 50f)), "tail", UiKit.Col("tail_red", UiKit.Red)); UiKit.Title(UiKit.FillLabel(f2.transform, "첫 무료", 26, UiKit.White), true); freeChip2 = f2.gameObject; diff --git a/Assets/Scripts/OutGame/UI/UiArtCover.cs b/Assets/Scripts/OutGame/UI/UiArtCover.cs new file mode 100644 index 00000000..d336755a --- /dev/null +++ b/Assets/Scripts/OutGame/UI/UiArtCover.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace TKS.OutGame +{ + /// + /// 폭 맞춤 배경 그림이 세로로 긴 화면에서 아래가 비지 않게(PD 2026-11-26 「로비 화면 하단이 비어 보임」) — 부모(본문) 크기가 바뀔 때마다 + /// 배율 = max(기본 배율, 그림 top 줄 ~ 맨 아래 줄이 본문 높이를 덮는 배율) · 늘어난 몫은 좌우로 같이 잘림(가운데 기준) · 그림 위 장면(영웅 자리 · 연출)은 같이 커짐. + /// 대상 RectTransform = 앵커 x 를 (−pad ~ 1+pad) 로 쓰는 폭 맞춤 그림(AspectRatioFitter WidthControlsHeight · 피벗 y = top 줄). + /// + public class UiArtCover : MonoBehaviour + { + public float baseZoom = 1f; + public float artW = 1080f; + public float artH = 1920f; + /// 본문 맨 위에 오는 그림 줄(px). + public float top; + Vector2 last = new Vector2(-1f, -1f); + + /// 지금 배율(시험 · 캡처 로그). + public float Zoom { get; private set; } + + void OnEnable() + { + last = new Vector2(-1f, -1f); + Apply(); + } + + void LateUpdate() + { + Apply(); + } + + public void Apply() + { + var rt = (RectTransform)transform; + var parent = rt.parent as RectTransform; + if (parent == null) return; + var size = parent.rect.size; + if (size == last || size.x <= 1f || size.y <= 1f) return; + last = size; + float below = Mathf.Max(1f, artH - top); // top 줄 아래 그림 높이(px) + float need = size.y * artW / (below * size.x); // 이 배율이면 그림 아래끝 = 본문 아래끝 + Zoom = Mathf.Max(baseZoom, need); + float pad = (Zoom - 1f) * 0.5f; + rt.anchorMin = new Vector2(-pad, rt.anchorMin.y); + rt.anchorMax = new Vector2(1f + pad, rt.anchorMax.y); + } + } +} diff --git a/Assets/Scripts/OutGame/UI/UiArtCover.cs.meta b/Assets/Scripts/OutGame/UI/UiArtCover.cs.meta new file mode 100644 index 00000000..738d9e70 --- /dev/null +++ b/Assets/Scripts/OutGame/UI/UiArtCover.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 93d34bb3eae079c4fa380ce7128c9866 \ No newline at end of file diff --git a/Assets/Scripts/OutGame/UI/UiFitHeight.cs b/Assets/Scripts/OutGame/UI/UiFitHeight.cs index 2c98e2ca..7cc2ef11 100644 --- a/Assets/Scripts/OutGame/UI/UiFitHeight.cs +++ b/Assets/Scripts/OutGame/UI/UiFitHeight.cs @@ -8,6 +8,8 @@ namespace TKS.OutGame public class UiFitHeight : MonoBehaviour { public float designHeight = 1546f; + /// 폭 상한(0 = 부모 폭 그대로) — 목업 좌표(왼쪽 기준)로 배치한 화면이 태블릿에서 왼쪽에 붙지 않게 가운데 1080(PD 2026-11-26 해상도 대응). + public float maxWidth; Vector2 last = new Vector2(-1f, -1f); void OnEnable() @@ -38,7 +40,9 @@ namespace TKS.OutGame rt.anchorMin = rt.anchorMax = new Vector2(0.5f, 1f); rt.pivot = new Vector2(0.5f, 1f); rt.localScale = new Vector3(s, s, 1f); - rt.sizeDelta = s < 1f ? new Vector2(size.x / s, designHeight) : size; + float w = s < 1f ? size.x / s : size.x; + if (maxWidth > 0f) w = Mathf.Min(w, maxWidth); // 넓은 화면(태블릿) = 기준 폭으로 가운데(왼쪽 붙음 방지 · 2026-11-26) + rt.sizeDelta = s < 1f ? new Vector2(w, designHeight) : new Vector2(w, size.y); rt.anchoredPosition = Vector2.zero; } } diff --git a/Assets/Scripts/OutGame/UI/UiKit.cs b/Assets/Scripts/OutGame/UI/UiKit.cs index 0befefc9..99a840c8 100644 --- a/Assets/Scripts/OutGame/UI/UiKit.cs +++ b/Assets/Scripts/OutGame/UI/UiKit.cs @@ -799,7 +799,7 @@ namespace TKS.OutGame float k = standardPx / size; float top = a.BodyPx * k; if (a.Mounted && mountedMaxTop > 0.01f && top > standardPx * mountedMaxTop) k *= standardPx * mountedMaxTop / top; - var rt = Rect(name, parent, anchor, new Vector2(0.5f, a.Meta.pivot[1]), pos, sp.rect.size * k); + var rt = Rect(name, parent, anchor, new Vector2(0.5f, a.Meta.pivot[1]), pos, a.SrcPx(sp) * k); // 원본 px(Android 임포트 축소 무관 · 2026-11-26) var img = rt.gameObject.AddComponent(); img.sprite = sp; img.raycastTarget = false; diff --git a/Assets/Scripts/OutGame/UI/UiTallLayout.cs b/Assets/Scripts/OutGame/UI/UiTallLayout.cs new file mode 100644 index 00000000..6f14f0e3 --- /dev/null +++ b/Assets/Scripts/OutGame/UI/UiTallLayout.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace TKS.OutGame +{ + /// + /// 세로로 긴 화면(20:9 등)에서 목업 본문(1080 × BodyH · 위에 붙음)이 남기는 아래 빈 높이를 쓰는 법(PD 2026-11-26 해상도 대응 「영웅 상세 · 편성 아래가 크게 빔」). + /// 남는 높이 extra = 부모(본문 Fit) 높이 − designH(0 이하 = 기준 화면 · 변화 없음). + /// ① splitY ≥ 0 = 목업 위에서 splitY px 아래에서 시작하는 자식(위에 붙은 것)을 extra 만큼 아래로(가운데가 벌어짐 · 바탕 그림이 더 보임) + /// ② stretch = 아래끝을 extra 만큼 늘릴 것(목록 판 · 스크롤 목록) — 위에 붙은 것은 높이 + extra · 세로로 늘어나는 것은 아래 여백 − extra. + /// 자식 목록 · 원래 자리는 첫 계산 때 기억(그 뒤 새로 붙는 자식은 건드리지 않음). + /// + public class UiTallLayout : MonoBehaviour + { + public float designH; + public float splitY = -1f; + public readonly List stretch = new List(); + + struct Orig + { + public RectTransform rt; + public Vector2 pos; + public Vector2 size; + public Vector2 offMin; + public bool shift; + public bool grow; + } + + readonly List orig = new List(); + float last = -1f; + + /// 지금 남는 높이(시험 · 캡처 로그). + public float Extra { get; private set; } + + void OnEnable() + { + Apply(); + } + + void LateUpdate() + { + Apply(); + } + + void Remember() + { + orig.Clear(); + var me = (RectTransform)transform; + foreach (Transform t in me) + { + var rt = t as RectTransform; + if (rt == null) continue; + bool grow = stretch.Contains(rt); + bool topAnch = Mathf.Approximately(rt.anchorMin.y, 1f) && Mathf.Approximately(rt.anchorMax.y, 1f); + bool botAnch = Mathf.Approximately(rt.anchorMin.y, 0f) && Mathf.Approximately(rt.anchorMax.y, 0f); + bool shift = !grow && botAnch; // 목업 아래끝에 붙은 것(목록 아래 페이드 등) = 늘어난 아래끝을 따라감 + if (!grow && splitY >= 0f && topAnch) + { + float top = -(rt.anchoredPosition.y + (1f - rt.pivot.y) * rt.sizeDelta.y); // 목업 위에서 이 자식 윗변까지(px) + shift = top >= splitY - 0.5f; + } + if (grow || shift) orig.Add(new Orig { rt = rt, pos = rt.anchoredPosition, size = rt.sizeDelta, offMin = rt.offsetMin, shift = shift, grow = grow }); + } + } + + public void Apply() + { + var parent = transform.parent as RectTransform; + if (parent == null || designH <= 0f) return; + float extra = Mathf.Max(0f, Mathf.Round(parent.rect.height - designH)); + if (Mathf.Abs(extra - last) < 0.5f) return; + if (last < 0f) Remember(); + last = extra; + Extra = extra; + foreach (var o in orig) + { + if (o.rt == null) continue; + if (o.shift) o.rt.anchoredPosition = new Vector2(o.pos.x, o.pos.y - extra); + else if (o.grow) + { + bool topAnch = Mathf.Approximately(o.rt.anchorMin.y, 1f) && Mathf.Approximately(o.rt.anchorMax.y, 1f); + if (topAnch) o.rt.sizeDelta = new Vector2(o.size.x, o.size.y + extra); + else o.rt.offsetMin = new Vector2(o.offMin.x, o.offMin.y - extra); + } + } + } + } +} diff --git a/Assets/Scripts/OutGame/UI/UiTallLayout.cs.meta b/Assets/Scripts/OutGame/UI/UiTallLayout.cs.meta new file mode 100644 index 00000000..36e8a035 --- /dev/null +++ b/Assets/Scripts/OutGame/UI/UiTallLayout.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 466f4c8dbfc104943bc786e019b4b8e4 \ No newline at end of file diff --git a/Assets/Scripts/OutGame/UICaptureDriver.cs b/Assets/Scripts/OutGame/UICaptureDriver.cs index 34314776..f26ccc33 100644 --- a/Assets/Scripts/OutGame/UICaptureDriver.cs +++ b/Assets/Scripts/OutGame/UICaptureDriver.cs @@ -18,6 +18,8 @@ namespace TKS.OutGame /// 열린 에디터에서 시험(UiCaptureTests.Capture_UiOnly)이 부를 때 = 끝나도 에디터를 닫지 않고 Finished 만 올림(2026-11-22 · 「에디터는 닫지 않음」). public bool KeepEditor; public bool Finished { get; private set; } + /// 모든 샷을 이 크기로(해상도 대응 검수 · PD 2026-11-26 · 0 = 샷마다 정한 크기) — UiCaptureTests 가 Logs/ui_capture_size.txt 로 켬. + public static Vector2Int SizeOverride; string[] only; /// 시험용 생성 — 찍을 화면만(쉼표 · 정확한 이름 또는 「접두*」) · 에디터를 닫지 않음. @@ -64,6 +66,13 @@ namespace TKS.OutGame Finish(1); yield break; } + if (SizeOverride.x > 0 && SizeOverride.y > 0) + { + // 해상도 검수 = 처음부터 그 해상도로 그림(실기기처럼 · 찍기 직전에만 바꾸면 LateUpdate 로 다시 배치하는 부품이 한 프레임 늦음 · 2026-11-26) + cam.targetTexture = new RenderTexture(SizeOverride.x, SizeOverride.y, 24); + yield return null; + yield return null; + } var s = root.Session; var db = s.Db; var d = s.Save; @@ -1148,6 +1157,11 @@ namespace TKS.OutGame } matched.Add(k); } + if (SizeOverride.x > 0 && SizeOverride.y > 0) + { + w = SizeOverride.x; + h = SizeOverride.y; + } yield return Wait(); // 캔버스 층 · 드로우콜 실측(PD 2026-11-10 UI 구조 개선 전·후 비교 · ui_layers.csv) yield return UiLayerProbe.Measure(name, Log, OutputDir); @@ -1174,6 +1188,12 @@ namespace TKS.OutGame { Log("finish code=" + code); Finished = true; + if (SizeOverride.x > 0 && Camera.main != null && Camera.main.targetTexture != null) + { + var rt = Camera.main.targetTexture; + Camera.main.targetTexture = null; + rt.Release(); + } if (KeepEditor) { StopAllCoroutines(); diff --git a/Assets/Scripts/OutGame/Workshop/WorkshopScreen.cs b/Assets/Scripts/OutGame/Workshop/WorkshopScreen.cs index 6ca6bb75..589c8883 100644 --- a/Assets/Scripts/OutGame/Workshop/WorkshopScreen.cs +++ b/Assets/Scripts/OutGame/Workshop/WorkshopScreen.cs @@ -50,7 +50,7 @@ namespace TKS.OutGame Tab = TabId; if (UISkin.On) UiKit.Paint(UiKit.Fill("ListBg", Rt), UiKit.Col("list_bg", UiKit.Bg), false); Header("공방", "", true); - var body = Body(); + var body = Body("Body", true); // 태블릿 = 가운데 1080(2026-11-26 해상도 대응) for (int i = 0; i < PageNames.Length; i++) { int k = i; diff --git a/Assets/Scripts/Runtime/BattleHUD.cs b/Assets/Scripts/Runtime/BattleHUD.cs index edfb9d97..15807613 100644 --- a/Assets/Scripts/Runtime/BattleHUD.cs +++ b/Assets/Scripts/Runtime/BattleHUD.cs @@ -390,6 +390,9 @@ namespace TKS // 그리는 순서 = 정적 판(루트 자식들) → Info → Result info.SetAsLastSibling(); resultLayer.SetAsLastSibling(); + // 안전 영역(노치 · 제스처 바 · PD 2026-11-26 해상도 대응): 위 띠 · 중단 버튼 · 칩 · 미니맵 · Info(탁자 · 스킬 · 설명) = 안쪽 · 결과 덮개 = 화면 전체 · + // 위 띠 바탕은 노치 자리까지 덧댐(UiSafeBleed · 여백 0 = 변화 없음) + UiSafeArea.Wrap(transform, true, true, true, resultLayer); if (camCtrl != null) { @@ -405,6 +408,13 @@ namespace TKS var bg = OutGame.UiKit.Fill("Bg", band); if (N("top_band", 5, 0f) > 0.5f) bg.localScale = new Vector3(1f, -1f, 1f); OutGame.UiKit.Skin(bg, S("top_band", 2, "header_bar"), C("top_band", 3, C("top_band", 4, OutGame.UiKit.Header))); + if (N("top_band", 0, 0f) < 0.5f) // 띠가 화면 맨 위에 붙어 있을 때만 = 노치 자리까지 같은 색 덧댐(2026-11-26) + { + var bleed = OutGame.UiKit.Rect("SafeBleedTop", band, new Vector2(0.5f, 1f), new Vector2(0.5f, 0f), Vector2.zero, Vector2.zero); + bleed.SetAsFirstSibling(); + bleed.gameObject.AddComponent().top = true; + OutGame.UiKit.Paint(bleed, C("top_band", 4, OutGame.UiKit.Header), false); + } // 중단 버튼(오른쪽 끝 · PD 2026-11-21 2차 · 2026-11-25 「톱니 → || 형태 아이콘 · 기능 유지」 = 표 settings_btn_art bt_pause) · 누름 = 중단 팝업(SlingshotInput → TryGiveUpTap) · 정적 pauseBtn = Box(transform, "settings_btn", "Settings"); @@ -1220,6 +1230,30 @@ namespace TKS get { return giveUpPopup != null; } } + /// HUD 부품 찾기(경로 · 예 「Info/SkillButton」) — 안전 영역 칸(SafeArea · 2026-11-26) 안을 먼저 · 없으면 루트에서. + public Transform FindPart(string path) + { + var safe = transform.Find("SafeArea"); + var t = safe != null ? safe.Find(path) : null; + return t != null ? t : transform.Find(path); + } + + /// + /// 물리 뒤로 가기(Android 백키 · 제스처 · PD 2026-11-26 Google Play 요건) — 중단 팝업이 떠 있으면 닫기(= 계속) · 아니면 중단 팝업 열기(일시정지) · + /// 열 수 없는 때(연출 · 대사 · 포기 불가 모드)는 아무것도 하지 않음 · 처리했으면 true. + /// + public bool BackKey() + { + if (giveUpPopup != null) + { + CloseGiveUp(); + return true; + } + if (!GiveUpVisible) return false; + OpenGiveUp(); + return true; + } + void RefreshGiveUp() { Show(pauseBtn, GiveUpVisible); diff --git a/Assets/Scripts/Runtime/CameraController.cs b/Assets/Scripts/Runtime/CameraController.cs index a0710d1c..937c7e53 100644 --- a/Assets/Scripts/Runtime/CameraController.cs +++ b/Assets/Scripts/Runtime/CameraController.cs @@ -205,12 +205,12 @@ namespace TKS transform.position = new Vector3(p.x, p.y, -10f); } - /// HUD 높이(기준 px · UI 캔버스 = 1080×1920 · 가로세로 반반 맞춤) → 지금 확대에서 월드 높이. + /// HUD 높이(기준 px · UI 캔버스 = 1080×1920 · Expand 맞춤) → 지금 확대에서 월드 높이. float HudWorld(float refPx, float halfH) { if (refPx <= 0f) return 0f; float w = Mathf.Max(1, Cam.pixelWidth), h = Mathf.Max(1, Cam.pixelHeight); - float scale = Mathf.Sqrt(w / UiLayer.Reference.x * (h / UiLayer.Reference.y)); // CanvasScaler matchWidthOrHeight 0.5 + float scale = UiLayer.ScaleFactor(w, h); // CanvasScaler 와 같은 식(UiLayer.Root · 2026-11-26 Expand) return refPx * scale / h * halfH * 2f; } @@ -220,7 +220,7 @@ namespace TKS /// float MinY(float halfH) { - float m = BottomHudRefPx > 0f ? HudWorld(BottomHudRefPx, halfH) : BottomMargin; + float m = BottomHudRefPx > 0f ? HudWorld(BottomHudRefPx, halfH) + UiSafeArea.Bottom * halfH * 2f : BottomMargin; // + 제스처 바(HUD 가 그만큼 올라감 · 2026-11-26) return Board.Rect.yMin - m + halfH; } @@ -248,7 +248,7 @@ namespace TKS float minX = r.xMin - Margin + halfW; float maxX = r.xMax + Margin - halfW; float minY = MinY(halfH); - float maxY = r.yMax + Mathf.Max(TopMargin, HudWorld(TopHudRefPx, halfH)) - halfH; + float maxY = r.yMax + Mathf.Max(TopMargin, HudWorld(TopHudRefPx, halfH) + UiSafeArea.Top * halfH * 2f) - halfH; // + 노치(위 띠가 그만큼 내려감 · 2026-11-26) p.x = minX > maxX ? 0f : Mathf.Clamp(p.x, minX, maxX); p.y = minY > maxY ? 0f : Mathf.Clamp(p.y, minY, maxY); return p; diff --git a/Assets/Scripts/Runtime/Scenario/BossIntro.cs b/Assets/Scripts/Runtime/Scenario/BossIntro.cs index e0a5cb97..2bd8dfa6 100644 --- a/Assets/Scripts/Runtime/Scenario/BossIntro.cs +++ b/Assets/Scripts/Runtime/Scenario/BossIntro.cs @@ -119,12 +119,21 @@ namespace TKS barTop = Img("BarTop", fx, null, Color.black, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 0f), Vector2.zero, new Vector2(0f, bar)); barBottom = Img("BarBottom", fx, null, Color.black, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 1f), Vector2.zero, new Vector2(0f, bar)); // 건너뛰기(오른쪽 위 · skip_show_after_sec 뒤 보임) - var sb = Img("Skip", root, null, new Color(0f, 0f, 0f, 0.6f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-40f, -60f), new Vector2(190f, 80f)); + // 건너뛰기 = 안전 영역 안(노치 밑에 깔리지 않게 · 2026-11-26) · 물리 뒤로 가기 = 건너뛰기(보일 때만 · 그 전엔 백키를 여기서 삼킴) + var safe = new GameObject("SafeArea", typeof(RectTransform)).GetComponent(); + safe.SetParent(root, false); + safe.gameObject.AddComponent().Apply(); + var sb = Img("Skip", safe, null, new Color(0f, 0f, 0f, 0.6f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-40f, -60f), new Vector2(190f, 80f)); sb.raycastTarget = true; skipBtn = sb.gameObject.AddComponent