A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
UI: the boot-failure line on the loading screen wraps inside the screen (refs #765) (#824)
Berif04197ac4cc9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ff7244933..902373225 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,9 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB## [Unreleased]### Fixed+- The loading screen's boot-failure line wraps inside the screen with a side margin (refs #765). In Hebrew at phone width+ it ran past both edges, so the player could not read "reload the page"; `.loading-line` had no `white-space: normal`.+ `UiLayoutTests.TheBootFailureLineWrapsInsideTheScreen` checks English and Hebrew at 390x844, 960x600 and 1280x720.- Player builds work again (refs #680). Since #680 every `Build.*` failed with "no CRC for the bundle", because Unityreads a bundle's CRC from its `.manifest` and the collection's bundles were copied into StreamingAssets without them.The checks file is now written in the bundle cache and copied beside the shipped bundles.diff --git a/unity/Assets/Tests/EditMode/UiLayoutTests.cs b/unity/Assets/Tests/EditMode/UiLayoutTests.csindex 3b99a1090..f4c35e4d1 100644--- a/unity/Assets/Tests/EditMode/UiLayoutTests.cs+++ b/unity/Assets/Tests/EditMode/UiLayoutTests.cs@@ -682,4 +682,49 @@ public class UiLayoutTestsObject.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt);}}++ /// <summary>#765: a boot failure on the loading line wraps inside the screen with a side margin, in English and in+ /// Hebrew (the longer line, which was clipped at both edges at phone width), at a phone upright, a small window and+ /// 1280x720. The line is set the way GameRoot.OnBootFailed sets it: boot.failed with boot.reason_other, right to left+ /// in the Hebrew face.</summary>+ [UnityTest]+ public IEnumerator TheBootFailureLineWrapsInsideTheScreen()+ {+ const float SideMargin = 16f; // logical px the text keeps from each edge of the panel+ var problems = new List<string>();+ var he = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");+ foreach (var (w, h) in new[] { (390, 844), (960, 600), (1280, 720) })+ foreach (var (lang, text) in new[] { ("en", Text), ("he", he) })+ {+ var rt = new RenderTexture(w, h, 0);+ var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));+ ps.targetTexture = rt;+ var go = new GameObject("LoadingLineTest");+ go.SetActive(false);+ var doc = go.AddComponent<UIDocument>();+ doc.panelSettings = ps;+ doc.visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UiPaths.GameUxml);+ go.SetActive(true);+ try+ {+ var root = doc.rootVisualElement;+ bool hebrew = lang == "he";+ root.Q("root").EnableInClassList(UiLanguage.HebrewClass, hebrew);+ var line = root.Q<Label>("loading");+ line.text = text.Format("boot.failed", text["boot.reason_other"]);+ line.languageDirection = hebrew ? LanguageDirection.RTL : LanguageDirection.Inherit; // as GameRoot.Say: this Hebrew line starts with Hebrew, so RTL+ for (int i = 0; i < 20 && !(line.contentRect.width > 0); i++) yield return null;+ for (int i = 0; i < 4; i++) yield return null;+ var where = $"{w}x{h} {lang}";+ var panel = root.panel.visualTree.worldBound;+ var box = line.worldBound;+ if (box.xMin < panel.xMin - 0.5f || box.xMax > panel.xMax + 0.5f) problems.Add($"{where}: the line {box} leaves the panel {panel}");+ if (line.contentRect.width > panel.width - 2 * SideMargin + 0.5f)+ problems.Add($"{where}: the text may run to the panel's edge (box {line.contentRect.width:0} of {panel.width:0} px)");+ if (!TextFits(line)) problems.Add($"{where}: '{line.text}' does not fit its line {line.contentRect}");+ }+ finally { Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt); }+ }+ Assert.IsEmpty(problems, string.Join("\n", problems));+ }}diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex 2dd7b3988..c792bb045 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -533,8 +533,9 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);.hud-two-row .cabinet-house { justify-content: center; }/* Loading (playtest 2, P2-1): until GameRoot is ready only this line shows; the bar's values, the info panel and the- right-hand column are kept out of sight (visibility, so the layout does not jump when they appear). */-.loading-line { display: none; position: absolute; left: 0; right: 0; top: 45%; -unity-text-align: middle-center; font-size: 28px; color: var(--ink); }+ right-hand column are kept out of sight (visibility, so the layout does not jump when they appear). A boot failure is+ longer than the panel at phone width, so the line wraps with a side margin instead of overflowing both edges (#765). */+.loading-line { display: none; position: absolute; left: 0; right: 0; top: 45%; -unity-text-align: middle-center; font-size: 28px; color: var(--ink); white-space: normal; padding-left: 24px; padding-right: 24px; }.loading .loading-line { display: flex; }.root.loading { background-color: var(--navy-solid); } /* the template's navy, not the default sky (final review M1) */.loading .date-box, .loading .meters, .loading .nav, .loading .left-column, .loading .turn-box, .loading .info-panel, .loading .right-column, .loading .event-layer { visibility: hidden; }