A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Decision videos, phase 3: outcome clips at End Turn (historical orders only) (#466)
Eyal Golan3fecea93f655
diff --git a/ASSETS.yaml b/ASSETS.yamlindex 0b6931a9d..74a290aca 100644--- a/ASSETS.yaml+++ b/ASSETS.yaml@@ -294,6 +294,25 @@ rules:ai_generated: truesource: "The burned-in label 'AI-generated · נוצר בבינה מלאכותית' of the decision-card clips, rendered by tools/encode_event_videos.py --make-bug in Chrome for Testing from HTML written by an AI coding agent on 2026-10-14, set in EB Garamond and Frank Ruhl Libre (OFL, unity/Assets/UI/Fonts)"status: verified+ # --- Decision outcome clips: played once at End Turn for the historical order (docs/event-videos.md; owner ruling D-V) ---+ - glob: "unity/Assets/StreamingAssets/video/maabarot_policy-outcome.mp4"+ licence: CC0-1.0+ ai_generated: true+ source: "Seedance 2.0 (Dreamina); the Dreamina AI badge is kept, generated 2026-10-12 (promo shot A08, promo/demo2/clips/A08.mp4, not in the repository; sha256 5f4a0d2f7280f3ca23deec059d59ef1e4ad21821ec76d719727f98fc0a5152ce); cut and re-encoded 2026-10-14 by tools/encode_event_videos.py: the steadiest 3.5 s (frames 2-85 at 24 fps, duplicate frames of the 60 fps file dropped first (decimate)), 960x540, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png; nothing else changed"+ status: verified+ note: "Decision D1: AI-only output CC0 / no rights claimed. Owner ruling D-V (2026-10-13, merged in #449): the generator terms were not checked, by the owner's choice. Played once at End Turn when the player ordered the historical option (maabarot_policy: maabarot), captioned as the order, skippable; never for a counterfactual option or Deport. No identifiable real person (frames checked 2026-10-14)."+ - glob: "unity/Assets/StreamingAssets/video/hula_drainage-outcome.mp4"+ licence: CC0-1.0+ ai_generated: true+ source: "Veo 3.1 Fast (ElevenLabs), generated 2026-10-12 (promo shot W08, promo/demo3/clips/W08.mp4, not in the repository; sha256 818de9680bfc193d3b13cd51cc24ab4a66e2ef5a3da3aae21e512faba8ea75a3); cut and re-encoded 2026-10-14 by tools/encode_event_videos.py: the steadiest 3.5 s (frames 12-95 at 24 fps), 960x540, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png; nothing else changed"+ status: verified+ note: "Decision D1: AI-only output CC0 / no rights claimed. Owner ruling D-V (2026-10-13, merged in #449): the generator terms were not checked, by the owner's choice. Played once at End Turn when the player ordered the historical option (hula_drainage: continue_works), captioned as the order, skippable; never for a counterfactual option or Deport. No identifiable real person (frames checked 2026-10-14)."+ - glob: "unity/Assets/StreamingAssets/video/operation_horev-outcome.mp4"+ licence: CC0-1.0+ ai_generated: true+ source: "Seedance 2.0 (Dreamina); the Dreamina AI badge is kept, generated 2026-10-12 (promo shot A05, promo/demo2/clips/A05.mp4, not in the repository; sha256 c0725105f17ae4b9a9f91417f83e5357ba725504a737d557da380573fc6e77d0); cut and re-encoded 2026-10-14 by tools/encode_event_videos.py: the steadiest 3.5 s (frames 2-85 at 24 fps, duplicate frames of the 60 fps file dropped first (decimate)), 960x540, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png; nothing else changed"+ status: verified+ note: "Decision D1: AI-only output CC0 / no rights claimed. Owner ruling D-V (2026-10-13, merged in #449): the generator terms were not checked, by the owner's choice. Played once at End Turn when the player ordered the historical option (operation_horev: launch), captioned as the order, skippable; never for a counterfactual option or Deport. No identifiable real person (frames checked 2026-10-14). SENSITIVE: the clip needs the owner's sensitivity review before a shareable build may carry it (sensitivity_reviewed in event-videos.yaml; Build.cs -shareable refuses until then)."# --- Event-card header photographs: real archival photos, never AI (docs/event-images.md; owner rulings 2026-10-11) ---# Licences and artists re-read from each Commons file page on 2026-10-11; CC BY 4.0 credits are the licensor's credit# line from the page's licence template. The mapping and alt texts: unity/Assets/UI/EventImages/event-images.yaml.diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ed605caec..db7f7a05c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -29,6 +29,12 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBcredit "Recording: Ralph Hellinger, Israel State Archives" is on screen. It never plays on its own, never on Continueor New Game, and not in automated runs. A slow or failed load says so. The file is a cut of the archive's own upload,decoded to WAV with no other processing (1.8 MB), and fetched only when asked for.+- Decision videos, phase 3: outcome clips at End Turn. When the player has ordered the historical option of one of three+ events (the transit camps, the Hula works, Operation Horev) and the turn applies it, a 3.5 s silent AI-generated clip+ plays once, captioned "Your order: ...". It is drawn over any open screen, which closes, and holds the keyboard focus:+ a click, Enter or Space skips it, and Esc skips them all. A counterfactual option, a delegated answer, a refused order+ and Deport get none, and there is none in automated runs. The Horev clip waits for the owner's sensitivity review+ before a shareable build. Presentation only: no golden moves.- Decision videos, phase 2 (#434 follow-up). On 11 decision cards an Illustration switch over the photograph plays ashort, silent AI-generated loop. It is labelled "AI-generated illustration" in place of the credit and carries a smallburned-in bilingual label. The photograph always shows first; nothing plays until the player asks, and the choice holdsdiff --git a/LICENSING.md b/LICENSING.mdindex c941f359e..cce58954e 100644--- a/LICENSING.md+++ b/LICENSING.md@@ -15,6 +15,7 @@ Different parts of this repository are under different licences. Where a file is| Portraits | `unity/Assets/UI/Portraits/`, `promo/ref/people/`, `promo/ref/*-sheet.jpg` | Public-domain photographs from Wikimedia Commons, CC0 files, and Meitar Collection photographs under CC BY 4.0 (credits in [NOTICE](NOTICE)). Per-file sources are in `content/people.yaml` and `promo/CREDITS.md`. || Event-card photographs | `unity/Assets/UI/EventImages/*.jpg` | Archival photographs from Wikimedia Commons, each under its own licence: CC BY 4.0 (Meitar Collection, National Library of Israel; credits in [NOTICE](NOTICE)), CC0 1.0 (Nationaal Archief) or public domain (US National Archives). All are adapted (graded and cropped). Per-file records in `ASSETS.yaml`; the mapping `event-images.yaml` beside them is CC BY 4.0 like the other UI assets. || Ben-Gurion's 1948 recording | `unity/Assets/StreamingAssets/audio/declaration-1948-isa-00113hj.wav` | An excerpt of the recording of the ceremony of 14 May 1948, Israel State Archives item ISA-Collections-Recordings-00113hj, under the Israel State Archives terms of use. It is a stream-copy cut of the archive's upload, decoded to PCM WAV with no other processing. Credit "Recording: Ralph Hellinger, Israel State Archives" ([NOTICE](NOTICE)). Its open questions are decision D-R in `docs/oss/DECISIONS.md` (`ASSETS.yaml`, owner-verify). |+| Decision-card and outcome clips | `unity/Assets/StreamingAssets/video/*.mp4` | AI-generated (Veo 3.1 through ElevenLabs; Seedance 2.0 through Dreamina), cut and re-encoded with a burned-in "AI-generated" label; CC0 1.0 under decision D1, used under the owner's ruling D-V in `docs/oss/DECISIONS.md`. Per-file records in `ASSETS.yaml` and `docs/ai-disclosure.md`; the mapping `unity/Assets/Resources/EventVideos/event-videos.yaml` is CC BY 4.0 like the other UI assets; the label `tools/event_videos/ai-bug.png` is CC BY 4.0. || Fonts | `unity/Assets/UI/Fonts/` | EB Garamond, [SIL Open Font License 1.1](unity/Assets/UI/Fonts/OFL.txt); Frank Ruhl Libre (`FrankRuhlLibre/`), [SIL Open Font License 1.1](unity/Assets/UI/Fonts/FrankRuhlLibre/OFL.txt) || Terrain heightmap | `unity/Assets/StreamingAssets/map/heightmap.*`, `content/map/hexes.json` (elevations) | Derived from Copernicus GLO-30 under the Copernicus DEM licence. Required notice: "produced using Copernicus WorldDEM-30 (c) DLR e.V. 2010-2014 and (c) Airbus Defence and Space GmbH 2014-2018 provided under COPERNICUS by the European Union and ESA; all rights reserved" || Precipitation grid | `content/map/precip_bio12.*` | CHELSA V2.1, CC0 1.0 (Karger et al. 2017, 2021; see `tools/README.md`) |diff --git a/README.he.md b/README.he.mdindex 1b5c44898..142d8ca64 100644--- a/README.he.md+++ b/README.he.md@@ -104,7 +104,7 @@ https://github.com/user-attachments/assets/56571db8-446b-444b-8db9-fce57dac53a7## שימוש בבינה מלאכותית-הפרויקט נבנה בסיוע נרחב של בינה מלאכותית. קוד נכתב עם סוכני קוד ונבדק בבדיקות ובסקירות קוד; תמונות הקונספט והפרומו הן תוצר של בינה מלאכותית, וכך גם הציור במסך הפתיחה, סמל הלשונית של דף המשחק צויר בסיועה, וטקסט האירועים נוסח בסיועה וכל עובדה בו נבדקת מול המקור המצוטט. הפורטרטים הם צילומים בנחלת הכלל או ברישיונות CC0 ו־CC BY 4.0 (הקרדיטים ב־NOTICE), בכרטיסי האירועים יש צילומי ארכיון, ובחלקם מתג "איור" מציג לולאה קצרה ושקטה שנוצרה בבינה מלאכותית ומסומנת ככזו. אין סאונד שנוצר בבינה מלאכותית; מסך הפתיחה יכול להשמיע את ההקלטה המקורית של בן־גוריון קורא את ההכרזה (1948, ארכיון המדינה). דבר אינו נוצר בזמן אמת במהלך המשחק.+הפרויקט נבנה בסיוע נרחב של בינה מלאכותית. קוד נכתב עם סוכני קוד ונבדק בבדיקות ובסקירות קוד; תמונות הקונספט והפרומו הן תוצר של בינה מלאכותית, וכך גם הציור במסך הפתיחה, סמל הלשונית של דף המשחק צויר בסיועה, וטקסט האירועים נוסח בסיועה וכל עובדה בו נבדקת מול המקור המצוטט. הפורטרטים הם צילומים בנחלת הכלל או ברישיונות CC0 ו־CC BY 4.0 (הקרדיטים ב־NOTICE), בכרטיסי האירועים יש צילומי ארכיון, ובחלקם מתג "איור" מציג לולאה קצרה ושקטה שנוצרה בבינה מלאכותית ומסומנת ככזו, ובכמה פקודות היסטוריות מוצג בסוף התור קטע קצר שנוצר בבינה מלאכותית ומסומן ככזה. אין סאונד שנוצר בבינה מלאכותית; מסך הפתיחה יכול להשמיע את ההקלטה המקורית של בן־גוריון קורא את ההכרזה (1948, ארכיון המדינה). דבר אינו נוצר בזמן אמת במהלך המשחק.## רישיוןdiff --git a/README.md b/README.mdindex e94e774c2..af8f614a1 100644--- a/README.md+++ b/README.md@@ -138,7 +138,7 @@ You need Unity **6000.3.25f1 (6.3 LTS)** with Web Build Support; the exact versiThis project is built with heavy AI assistance, disclosed here using itch.io's categories:- **Code:** written with AI coding agents and reviewed through tests and review gates.-- **Graphics:** the concept and promo images in `promo/` are AI-generated, as is the start screen's painting, and the web page's tab icon was drawn with AI help. The game's terrain comes from real elevation data. The portraits are public-domain, CC0 or CC BY 4.0 photographs (credited in NOTICE), and the event cards use archival photographs; on some cards an Illustration switch plays a short, silent AI-generated loop, labelled as such.+- **Graphics:** the concept and promo images in `promo/` are AI-generated, as is the start screen's painting, and the web page's tab icon was drawn with AI help. The game's terrain comes from real elevation data. The portraits are public-domain, CC0 or CC BY 4.0 photographs (credited in NOTICE), and the event cards use archival photographs; on some cards an Illustration switch plays a short, silent AI-generated loop, and a few historical orders show a short AI-generated clip at End Turn, both labelled as such.- **Text:** event and content text was drafted with AI, and every fact is checked against the cited source.- **Sound:** no AI sound. The start screen can play the original 1948 recording of Ben-Gurion reading the Declaration (Israel State Archives).diff --git a/docs/ai-disclosure.md b/docs/ai-disclosure.mdindex bacecad25..e0a20be4d 100644--- a/docs/ai-disclosure.md+++ b/docs/ai-disclosure.md@@ -28,11 +28,14 @@ This is not a licence clearance or a completed store content survey. owner-verif| unity/Assets/StreamingAssets/video/austerity_1949.mp4 | ASSETS.yaml | Seedance 2.0 (Dreamina); the Dreamina AI badge is kept, generated 2026-10-12 (promo shot A09, promo/demo2/clips/A09.mp4, not in the repository; sha256 79ab0b07145177d9899e1c39136e5e04c3f7ca8f0a310a7c905042fab1dc6cd2); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified || unity/Assets/StreamingAssets/video/first_truce.mp4 | ASSETS.yaml | Veo 3.1 Fast (ElevenLabs), generated 2026-10-12 (promo shot K03a, promo/demo3/clips/K03a.mp4, not in the repository; sha256 75156139ee81c1d6962d593e3f55a4f9233d9d2a0955b1d1dff5e7dc62431dcd); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified || unity/Assets/StreamingAssets/video/frumkin_commission.mp4 | ASSETS.yaml | Veo 3.1 Fast (ElevenLabs), generated 2026-10-12 (promo shot W05b, promo/demo3/clips/W05b.mp4, not in the repository; sha256 ea1b9fdce8f9499dec68a3d3cc61195e5ccea0156229e8fcd51f5abc44354461); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified |+| unity/Assets/StreamingAssets/video/hula_drainage-outcome.mp4 | ASSETS.yaml | Veo 3.1 Fast (ElevenLabs), generated 2026-10-12 (promo shot W08, promo/demo3/clips/W08.mp4, not in the repository; sha256 818de9680bfc193d3b13cd51cc24ab4a66e2ef5a3da3aae21e512faba8ea75a3); cut and re-encoded 2026-10-14 by tools/encode_event_videos.py: the steadiest 3.5 s (frames 12-95 at 24 fps), 960x540, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png; nothing else changed | verified || unity/Assets/StreamingAssets/video/hula_drainage.mp4 | ASSETS.yaml | Veo 3.1 Fast (ElevenLabs), generated 2026-10-12 (promo shot W06, promo/demo3/clips/W06.mp4, not in the repository; sha256 39ea857ef8927780bb6fa874df72ef38450bb7f11e1b9b786f5db20cbecce379); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified || unity/Assets/StreamingAssets/video/iraqi_exodus.mp4 | ASSETS.yaml | Seedance 2.0 (Dreamina); the Dreamina AI badge is kept, generated 2026-10-12 (promo shot A07, promo/demo2/clips/A07.mp4, not in the repository; sha256 8b3fc06d8a7836e82896a9fd09a3b874dbfdd7f9eca9e7be63f70202630af783); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified || unity/Assets/StreamingAssets/video/jerusalem_ceasefire.mp4 | ASSETS.yaml | Veo 3.1 Fast (ElevenLabs), generated 2026-10-12 (promo shot K03b, promo/demo3/clips/K03b.mp4, not in the repository; sha256 a6a63909bd06e13a263de2d340552f6e5ee66d7b1f567335df7bc469c152f691); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified || unity/Assets/StreamingAssets/video/latrun_proposal.mp4 | ASSETS.yaml | Veo 3.1 (ElevenLabs), from a GPT Image 2.5 still, generated 2026-10-12 (promo shot L14, promo/demo2/clips-v2/L14.mp4, not in the repository; sha256 f1e6c57c01ee4665c4e3948172c749973a2d335f83c65f8d8522f6f72706751b); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified || unity/Assets/StreamingAssets/video/law_of_return.mp4 | ASSETS.yaml | Veo 3.1 Fast (ElevenLabs), generated 2026-10-12 (promo shot K04a, promo/demo3/clips/K04a.mp4, not in the repository; sha256 5bb6e584eb57771bef155f4dcf2be847d1a8f50302b8dbffd30723806ab4a2b9); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified |+| unity/Assets/StreamingAssets/video/maabarot_policy-outcome.mp4 | ASSETS.yaml | Seedance 2.0 (Dreamina); the Dreamina AI badge is kept, generated 2026-10-12 (promo shot A08, promo/demo2/clips/A08.mp4, not in the repository; sha256 5f4a0d2f7280f3ca23deec059d59ef1e4ad21821ec76d719727f98fc0a5152ce); cut and re-encoded 2026-10-14 by tools/encode_event_videos.py: the steadiest 3.5 s (frames 2-85 at 24 fps, duplicate frames of the 60 fps file dropped first (decimate)), 960x540, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png; nothing else changed | verified || unity/Assets/StreamingAssets/video/maabarot_policy.mp4 | ASSETS.yaml | Veo 3.1 Fast (ElevenLabs), generated 2026-10-12 (promo shot W05a, promo/demo3/clips/W05a.mp4, not in the repository; sha256 b3cd6cf07004c80ee89bf679ac89608ae6edd594a172b36b566a239e983bfecc); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified |+| unity/Assets/StreamingAssets/video/operation_horev-outcome.mp4 | ASSETS.yaml | Seedance 2.0 (Dreamina); the Dreamina AI badge is kept, generated 2026-10-12 (promo shot A05, promo/demo2/clips/A05.mp4, not in the repository; sha256 c0725105f17ae4b9a9f91417f83e5357ba725504a737d557da380573fc6e77d0); cut and re-encoded 2026-10-14 by tools/encode_event_videos.py: the steadiest 3.5 s (frames 2-85 at 24 fps, duplicate frames of the 60 fps file dropped first (decimate)), 960x540, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png; nothing else changed | verified || unity/Assets/StreamingAssets/video/operation_yoav.mp4 | ASSETS.yaml | Veo 3.1 Fast (ElevenLabs), generated 2026-10-12 (promo shot W04a, promo/demo3/clips/W04a.mp4, not in the repository; sha256 26bf28dae5b96170057a5b4b894eff2d80c5f81503d53f4affad228055393d91); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified || unity/Assets/StreamingAssets/video/ten_days.mp4 | ASSETS.yaml | Veo 3.1 (ElevenLabs), from a GPT Image 2.5 still, generated 2026-10-13 (promo shot J09, promo/demo2/clips-v2/J09.mp4, not in the repository; sha256 7a1242da163d3fae432889643a64abf7fd9eff73d700cad978d30c0c32b6c571); re-encoded 2026-10-14 by tools/encode_event_videos.py: 960x540, 24 fps, H.264 CRF 28, no audio, with the burned-in label tools/event_videos/ai-bug.png at the top left; nothing else changed | verified |diff --git a/docs/event-videos.md b/docs/event-videos.mdindex 96f7921d0..1743a810f 100644--- a/docs/event-videos.md+++ b/docs/event-videos.md@@ -1,4 +1,4 @@-# Decision-card illustration loops+# Decision-card video: illustration loops and outcome clipsOn some decision cards, an **Illustration** switch over the photograph's top right corner plays a short, silent,AI-generated loop in the 16:9 media header. Owner rulings of 2026-10-13 cover it (`reports/Video at decision@@ -15,8 +15,9 @@ moments.md`, the "Full plan"; plan: `docs/superpowers/plans/2026-10-13-decision-- The file carries a small burned-in label, "AI-generated · נוצר בבינה מלאכותית", so it says what it is even when itis downloaded on its own. The Dreamina shots also keep Dreamina's own "AI" badge (D-D).- **Silent.** The clips have no audio stream (`tools/encode_event_videos.py` refuses one).-- **Opt-in.** Nothing plays until the player presses the switch, so the loop needs no separate pause button and no- reduced-motion setting. Pressing the switch again stops it.+- **Opt-in.** A card's loop plays only after the player presses the switch, so it needs no separate pause button and no+ reduced-motion setting. Pressing the switch again stops it. (The outcome clips below play at End Turn without a+ switch, once, for 3.5 s: a click, Enter or Space skips one, and Esc skips them all.)- The choice holds for the session: later cards open on their clip until the player switches back.- It is not saved, and every launch starts on the photograph.- **Deport never gets any video** (GDD owner ruling 1). `EventVideoMapping.Problems` refuses a row for an event with a@@ -24,18 +25,49 @@ moments.md`, the "Full plan"; plan: `docs/superpowers/plans/2026-10-13-decision-- **No recognisable real person** in any clip. Every frame sheet was checked before the clip was committed.- **Sensitive events.** A clip on an event with a sensitive tag is `sensitive: true`. A `-shareable` build refuses ituntil the owner sets `sensitivity_reviewed: true` (`Build.ShareableRefusal`). Today that applies to `ten_days` (J09)- and `operation_yoav` (W04a).+ and `operation_yoav` (W04a), and to the `operation_horev` outcome clip (A05).- **Rights:** owner ruling D-V (`docs/oss/DECISIONS.md`, merged in #449), "no need to check, just use them". Every clip has an`ASSETS.yaml` row with `ai_generated: true`, the generator and the date, and those rows feed `docs/ai-disclosure.md`.+## Outcome clips at End Turn (phase 3)++When a turn runs, every event the player answered with its **historical** option, if the turn applied the order and the+event has an outcome clip, plays that clip once, in the middle of the screen, before the game goes on (`OutcomePresenter`).++- **Only for an order.** A clip plays only for the historical option the player chose. A delegated answer gets none,+ and so does a counterfactual option (there is no footage of what did not happen). `EventVideoMapping.OutcomeProblems`+ refuses a row for a non-historical option, and any row that involves Deport.+- **3.5 s, silent.** The caption is worded as the order, "Your order: …", because the clip illustrates the order and+ does not show its outcome.+ - A click, Enter or Space (or a gamepad's Submit) skips the clip. Esc (or Cancel) skips all of the turn's clips.+ - A screen open at End Turn (Cabinet, Budget, Defence, Why) closes when the clip starts. The clip is drawn over+ everything but the toast, and while it plays the decision card, the top bar and the panels wait, so no order can be+ given under it.+ - It has its own player, separate from the card's loop.+ - The keyboard focus goes to the clip while it plays, then back to the open decision card, or to where it was.+- **The steadiest window.** AI shots often morph in their first frames, so each clip keeps the steadiest 3.5 s of its+ shot, not the first 3.5 s. "Steadiest" means the least frame-to-frame change, and above all no sudden jump in it. The+ search is `tools/encode_event_videos.py --steadiest`, and the row records `start_frame` and `frames` so the cut+ reproduces. The 60 fps Dreamina files repeat frames, so they are decimated first (`decimate: true`).+- **The clips:**+ - maabarot_policy / maabarot: A08, a transit camp;+ - hula_drainage / continue_works: W08, the drained valley;+ - operation_horev / launch: A05, jeeps and an armoured carrier crossing the Negev. This one is sensitive and not yet+ reviewed, so a shareable build refuses it. Its vehicles (jeeps, a tracked carrier) match the 8th Brigade's tanks,+ jeeps and APCs (en.wikipedia "8th Armored Brigade (Israel)", checked 2026-10-14), and it shows no flag or marking.+- **Dropped in review (2026-10-14):** first_truce / accept (A02, the Burma Road convoy of June 1948, a poor picture for+ a truce whose terms bar bringing in men and materiel) and law_of_return / enact (K04b, not in the plan's list and with+ no recorded ruling). A replacement needs the owner's word before anything new is generated.+## Where things are| What | Where ||---|---|-| The mapping: event, file, promo shot and its SHA-256, generator, date, alt text, sensitivity flags | `unity/Assets/Resources/EventVideos/event-videos.yaml` |-| The clips (960x540 H.264, about 0.4 to 1.5 MB each) | `unity/Assets/StreamingAssets/video/<event>.mp4` |+| The mapping: event (and, for an outcome, option and window), file, promo shot and its SHA-256, generator, date, alt text, sensitivity flags | `unity/Assets/Resources/EventVideos/event-videos.yaml` |+| The clips (960x540 H.264, about 0.4 to 1.5 MB each) | `unity/Assets/StreamingAssets/video/<event>.mp4`, and `<event>-outcome.mp4` for the outcome clips || The encode, pinned, and the burned-in label | `tools/encode_event_videos.py`, `tools/event_videos/ai-bug.png` |-| The player: one lazy VideoPlayer playing a URL into one 960x540 RenderTexture | `CardVideo` |+| The player: a lazy VideoPlayer playing a URL into a 960x540 RenderTexture; one for the card's loop and one for the outcome clips | `CardVideo` |+| The outcome clips at End Turn | `OutcomePresenter` || The switch | `EventCardPresenter.ApplyIllustration` |The mapping is **not game content**: the sim never reads it, and the goldens and the content hash cannot move for itdiff --git a/tools/encode_event_videos.py b/tools/encode_event_videos.pyindex bf18ee115..a0b290d43 100644--- a/tools/encode_event_videos.py+++ b/tools/encode_event_videos.py@@ -1,9 +1,11 @@# /// script# requires-python = ">=3.11"-# dependencies = ["pillow==12.3.0", "pyyaml==6.0.3", "websockets==15.0.1"]+# dependencies = ["pillow==12.3.0", "pyyaml==6.0.3", "websockets==15.0.1", "numpy==2.5.3"]# ///-"""Makes the decision cards' silent illustration loops (unity/Assets/StreamingAssets/video/<file>) from the promo shots-listed in unity/Assets/Resources/EventVideos/event-videos.yaml (decision videos, owner ruling 2026-10-13; docs/event-videos.md).+"""Makes the decision cards' silent clips (unity/Assets/StreamingAssets/video/<file>) from the promo shots listed in+unity/Assets/Resources/EventVideos/event-videos.yaml (decision videos, owner ruling 2026-10-13; docs/event-videos.md):+the cards' illustration loops (<event>.mp4, the mapping's clips) and the End Turn outcome clips (<event>-outcome.mp4, its+outcomes, each cut to its recorded 3.5 s window).The promo shots are not in the repository. Each row names its source (a path under promo/ in the checkout given by--root, default this one; the shots are copied, never changed in place) and the source's@@ -16,7 +18,7 @@ pinned and is the only change besides the burned-in label:it is even when it is downloaded on its own (the card shows "AI-generated illustration" too).Every output is checked with ffprobe: one H.264 960x540 video stream, no audio, the moov box before mdat.- uv run tools/encode_event_videos.py [--root CHECKOUT_WITH_PROMO] [--only EVENT ...]+ uv run tools/encode_event_videos.py [--root CHECKOUT_WITH_PROMO] [--only EVENT | EVENT-outcome ...]uv run tools/encode_event_videos.py --make-bug # remakes tools/event_videos/ai-bug.png"""from __future__ import annotations@@ -45,22 +47,55 @@ LABEL_EN, LABEL_HE = "AI-generated", "נוצר בבינה מלאכותית"def load_rows(mapping: Path = MAPPING) -> list[dict]:- return yaml.safe_load(mapping.read_text(encoding="utf-8"))["clips"]+ """The card loops (clips) and the End Turn outcome clips (outcomes), in that order."""+ doc = yaml.safe_load(mapping.read_text(encoding="utf-8"))+ return doc["clips"] + doc.get("outcomes", [])def sha256(path: Path) -> str:return hashlib.sha256(path.read_bytes()).hexdigest()-def filter_graph() -> str:- """Scale the shot, then lay the label over its top left corner."""- return (f"[0:v]scale={WIDTH}:{HEIGHT}:force_original_aspect_ratio=increase:flags=lanczos,crop={WIDTH}:{HEIGHT},fps={FPS},setsar=1[v];"+def filter_graph(row: dict | None = None) -> str:+ """Scale the shot, then lay the label over its top left corner. An outcome row may also ask for:+ decimate: drop the repeated frames of a 60 fps Dreamina shot first, so its 24 unique frames a second play evenly;+ start_frame and frames: keep only that window, in frames at 24 fps (the steadiest 3.5 s, chosen by+ tools/encode_event_videos.py's steadiest(); the row records it so the cut reproduces)."""+ row = row or {}+ pre = "mpdecimate=hi=64:lo=32:frac=0.1,setpts=N/24/TB," if row.get("decimate") else ""+ cut = ""+ if "start_frame" in row:+ s, n = int(row["start_frame"]), int(row["frames"])+ cut = f",trim=start_frame={s}:end_frame={s + n},setpts=PTS-STARTPTS"+ return (f"[0:v]{pre}scale={WIDTH}:{HEIGHT}:force_original_aspect_ratio=increase:flags=lanczos,crop={WIDTH}:{HEIGHT},fps={FPS}{cut},setsar=1[v];"f"[v][1:v]overlay={SAFE_X}:{SAFE_Y}:format=auto[out]")-def encode_command(src: Path, dst: Path, bug: Path = BUG) -> list[str]:+def steadiest(src: Path, seconds: float = 3.5, decimate: bool = False) -> tuple[int, dict]:+ """The start frame (at 24 fps) of the steadiest window of the shot: the least frame-to-frame change and above all+ no sudden jump in it (a morph, a warp or a cut is a jump in the change), as score = mean change + 3 x largest jump ++ spread. Returns the frame and the window's numbers."""+ import numpy as np+ w, h = 192, 108+ pre = "mpdecimate=hi=64:lo=32:frac=0.1,setpts=N/24/TB," if decimate else ""+ raw = subprocess.run(["ffmpeg", "-v", "error", "-i", str(src), "-vf", f"{pre}fps={FPS},scale={w}:{h},format=gray",+ "-f", "rawvideo", "-"], capture_output=True, check=True).stdout+ fr = np.frombuffer(raw, np.uint8).reshape(-1, h, w).astype(np.float32)+ d = np.abs(np.diff(fr, axis=0)).mean(axis=(1, 2))+ jumps = np.abs(np.diff(d))+ n = int(round(seconds * FPS))+ best = None+ for s in range(0, len(fr) - n + 1):+ seg, j = d[s:s + n - 1], jumps[s:s + n - 2]+ score = float(seg.mean() + 3 * j.max() + seg.std())+ if best is None or score < best[0]:+ best = (score, s, float(seg.mean()), float(j.max()))+ return best[1], {"score": round(best[0], 2), "mean_change": round(best[2], 2), "max_jump": round(best[3], 2)}+++def encode_command(src: Path, dst: Path, bug: Path = BUG, row: dict | None = None) -> list[str]:return ["ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-i", str(src), "-i", str(bug),- "-filter_complex", filter_graph(), "-map", "[out]", *FFMPEG_VIDEO, str(dst)]+ "-filter_complex", filter_graph(row), "-map", "[out]", *FFMPEG_VIDEO, str(dst)]def probe(path: Path) -> dict:@@ -69,9 +104,18 @@ def probe(path: Path) -> dict:return json.loads(out)-def problems(path: Path) -> list[str]:- """What is wrong with an encoded clip: anything but one 960x540 H.264 stream and no audio, or moov after mdat."""+def frame_count(path: Path) -> int:+ out = subprocess.run(["ffprobe", "-v", "error", "-select_streams", "v:0", "-count_frames", "-show_entries",+ "stream=nb_read_frames", "-of", "csv=p=0", str(path)], capture_output=True, text=True, check=True).stdout+ return int(out.strip().split(",")[0])+++def problems(path: Path, frames: int | None = None) -> list[str]:+ """What is wrong with an encoded clip: anything but one 960x540 H.264 stream and no audio, moov after mdat, or (an+ outcome clip) a frame count other than its row's."""found = []+ if frames is not None and (n := frame_count(path)) != frames:+ found.append(f"{n} frames, not {frames}")streams = probe(path).get("streams", [])video = [s for s in streams if s.get("codec_type") == "video"]if any(s.get("codec_type") == "audio" for s in streams):@@ -127,16 +171,22 @@ def make_bug(out: Path = BUG) -> Path:def main(argv: list[str] | None = None) -> int:ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)- ap.add_argument("--only", action="append", default=[], help="event id (repeatable); default all rows")+ ap.add_argument("--only", action="append", default=[],+ help="a card loop's event id, or EVENT-outcome for an outcome clip (repeatable); default all rows")ap.add_argument("--make-bug", action="store_true", help="remake the burned-in label and stop")+ ap.add_argument("--steadiest", type=Path, help="print the steadiest 3.5 s window of this shot and stop")+ ap.add_argument("--decimate", action="store_true", help="with --steadiest: the shot is a 60 fps Dreamina file")ap.add_argument("--out", type=Path, default=OUT)ap.add_argument("--root", type=Path, default=REPO, help="the checkout whose promo/ holds the source shots")a = ap.parse_args(argv)if a.make_bug:print(make_bug()); return 0+ if a.steadiest:+ start, numbers = steadiest(a.steadiest, decimate=a.decimate)+ print(json.dumps({"start_frame": start, "start_s": round(start / FPS, 3), "frames": int(round(3.5 * FPS)), **numbers})); return 0if shutil.which("ffmpeg") is None or shutil.which("ffprobe") is None:print("ffmpeg and ffprobe are needed"); return 2- rows = [r for r in load_rows() if not a.only or r["event"] in a.only]+ rows = [r for r in load_rows() if not a.only or Path(r["file"]).stem in a.only]for r in rows: # check every source before writing anythingsrc = a.root / r["source"]if not src.is_file():@@ -149,8 +199,8 @@ def main(argv: list[str] | None = None) -> int:with tempfile.TemporaryDirectory() as tmp: # the promo shot is read from a copy, never in placesrc = Path(tmp) / "src.mp4"shutil.copyfile(a.root / r["source"], src)- subprocess.run(encode_command(src, dst), check=True)- bad = problems(dst)+ subprocess.run(encode_command(src, dst, row=r), check=True)+ bad = problems(dst, r.get("frames"))if bad:print(f"BAD {dst}: {'; '.join(bad)}"); return 1print(f"{r['file']} {dst.stat().st_size} bytes")diff --git a/tools/tests/test_encode_event_videos.py b/tools/tests/test_encode_event_videos.pyindex bcb069298..17ba1e6bf 100644--- a/tools/tests/test_encode_event_videos.py+++ b/tools/tests/test_encode_event_videos.py@@ -16,7 +16,9 @@ def test_every_row_names_a_promo_shot_by_sha256_and_is_marked_ai():assert len(rows) >= 10for r in rows:assert r["source"].startswith("promo/") and len(r["source_sha256"]) == 64- assert r["file"] == r["event"] + ".mp4" and r["ai_generated"] is True+ assert r["file"] == r["event"] + ("-outcome.mp4" if "option" in r else ".mp4") and r["ai_generated"] is True+ if "option" in r: # an outcome clip keeps a recorded 3.5 s window of its shot+ assert r["frames"] == 84 and r["start_frame"] >= 0assert (ev.OUT / r["file"]).is_file()@@ -47,7 +49,39 @@ def test_problems_refuses_audio_and_the_wrong_size(tmp_path):@needs_ffmpegdef test_every_shipped_clip_passes():for r in ev.load_rows():- assert ev.problems(ev.OUT / r["file"]) == [], r["file"]+ assert ev.problems(ev.OUT / r["file"], r.get("frames")) == [], r["file"]+++@needs_ffmpeg+def test_problems_refuses_an_outcome_clip_of_the_wrong_length(tmp_path):+ clip = tmp_path / "c.mp4"+ make(clip, audio=False) # 24 frames+ assert ev.problems(clip, 24) == []+ assert any("24 frames, not 84" in p for p in ev.problems(clip, 84))+++@needs_ffmpeg+def test_steadiest_skips_a_morph_at_the_start(tmp_path):+ """A shot whose first second churns (a morph) and then settles: the steadiest 1 s window starts after the churn."""+ import numpy as np+ w, h, rng = 192, 108, np.random.default_rng(7)+ frames = [rng.integers(0, 255, (h, w), dtype=np.uint8) for _ in range(30)]+ frames += [np.full((h, w), 100 + i // 8, np.uint8) for i in range(66)] # still, with a slow drift+ src = tmp_path / "shot.mp4"+ subprocess.run(["ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-f", "rawvideo", "-pix_fmt", "gray",+ "-s", f"{w}x{h}", "-r", "24", "-i", "-", "-c:v", "libx264", "-qp", "0", "-pix_fmt", "yuv420p", str(src)],+ input=b"".join(f.tobytes() for f in frames), check=True)+ start, numbers = ev.steadiest(src, seconds=1.0)+ assert start >= 30, (start, numbers)+++def test_only_selects_a_loop_or_an_outcome_by_its_file(monkeypatch, tmp_path, capsys):+ rows = [{"event": "e", "file": "e.mp4", "source": "promo/x.mp4", "source_sha256": "0" * 64},+ {"event": "e", "option": "o", "file": "e-outcome.mp4", "source": "promo/y.mp4", "source_sha256": "0" * 64}]+ monkeypatch.setattr(ev, "load_rows", lambda mapping=ev.MAPPING: rows)+ monkeypatch.setattr(ev.shutil, "which", lambda name: "/usr/bin/" + name)+ assert ev.main(["--root", str(tmp_path), "--only", "e-outcome"]) == 1+ assert "y.mp4" in capsys.readouterr().out, "only the outcome row is looked at"def test_a_source_with_the_wrong_sha256_is_refused(tmp_path, capsys, monkeypatch):@@ -61,3 +95,9 @@ def test_a_source_with_the_wrong_sha256_is_refused(tmp_path, capsys, monkeypatchassert ev.main(["--root", str(tmp_path), "--out", str(tmp_path / "out")]) == 1assert "SHA-256 MISMATCH" in capsys.readouterr().outassert not (tmp_path / "out").exists() or not any((tmp_path / "out").iterdir())+++def test_an_outcome_row_cuts_its_recorded_window_and_decimates_a_dreamina_shot():+ graph = ev.filter_graph({"start_frame": 5, "frames": 84, "decimate": True})+ assert graph.startswith("[0:v]mpdecimate") and "trim=start_frame=5:end_frame=89" in graph+ assert "trim" not in ev.filter_graph() and "mpdecimate" not in ev.filter_graph(), "the card loops are cut as before"diff --git a/unity/Assets/Editor/Build.cs b/unity/Assets/Editor/Build.csindex d7e963599..6ba2dfaf4 100644--- a/unity/Assets/Editor/Build.cs+++ b/unity/Assets/Editor/Build.cs@@ -112,6 +112,11 @@ namespace Statecraft.Game.EditorToolsIReadOnlyList<EventImageMapping.Row>? mapping = null, IReadOnlyList<EventVideoMapping.Row>? clips = null) =>Array.IndexOf(args, "-shareable") >= 0 ? ShareableRefusal(c, photos, catalogFileExists, mapping, clips) : null;+ /// <summary>The clips a shareable build is gated on, from the mapping's text: the card loops and the End Turn outcome+ /// clips.</summary>+ public static List<EventVideoMapping.Row> GatedClips(string yaml) =>+ EventVideoMapping.Parse(yaml).Concat(EventVideoMapping.ParseOutcomes(yaml)).ToList();+/// <summary>Logs "BUILD REFUSED ..." and exits 1 when the gate refuses this build; true if it did. The photographs/// checked are the catalog the build ships (Resources/EventImageCatalog.asset), cross-checked against the mapping.</summary>static bool RefuseUnlessShareable()@@ -123,7 +128,8 @@ namespace Statecraft.Game.EditorToolstry{var mapping = EventImageMapping.Parse(File.ReadAllText(EventImageMapping.Path));- var clips = EventVideoMapping.Parse(File.ReadAllText(EventVideoMapping.Path)); // fails closed: a missing file is a refusal+ var videos = File.ReadAllText(EventVideoMapping.Path); // fails closed: a missing file is a refusal+ var clips = GatedClips(videos);refusal = GateRefusal(args, Statecraft.Sim.ContentLoader.Load(Paths.Content), photos, File.Exists(EventImageImport.CatalogPath), mapping, clips);}catch (Exception e) when (e is IOException || e is InvalidOperationException || e is UnauthorizedAccessException)diff --git a/unity/Assets/Resources/EventVideos/event-videos.yaml b/unity/Assets/Resources/EventVideos/event-videos.yamlindex 39287a52e..36017b3bd 100644--- a/unity/Assets/Resources/EventVideos/event-videos.yaml+++ b/unity/Assets/Resources/EventVideos/event-videos.yaml@@ -133,3 +133,54 @@ clips:ai_generated: truesensitive: truesensitivity_reviewed: false+# Outcome clips (decision videos, phase 3; docs/event-videos.md): played at End Turn, once, when the player queued the+# event's historical option (historical: true in content) and the turn applied it. 3.5 s, silent, skippable (a click,+# Esc, Enter or Space; Esc skips them all), captioned as the order ("Your order: ..."), never for a counterfactual option,+# never for Deport. start_frame and frames are the steadiest window of the shot (tools/encode_event_videos.py+# --steadiest), in frames at 24 fps after decimate (which drops the repeated frames of the 60 fps Dreamina files).+# first_truce (A02) and law_of_return (K04b) were dropped in review on 2026-10-14 (docs/event-videos.md).+outcomes:+ - event: maabarot_policy+ option: maabarot+ file: maabarot_policy-outcome.mp4+ shot: A08+ source: promo/demo2/clips/A08.mp4+ source_sha256: 5f4a0d2f7280f3ca23deec059d59ef1e4ad21821ec76d719727f98fc0a5152ce+ generator: "Seedance 2.0 (Dreamina); the Dreamina AI badge is kept"+ generated: 2026-10-12+ decimate: true+ start_frame: 2+ frames: 84+ alt: "Illustration: a transit camp of tents and huts after rain, a water tanker, families walking."+ ai_generated: true+ sensitive: false+ sensitivity_reviewed: false+ - event: hula_drainage+ option: continue_works+ file: hula_drainage-outcome.mp4+ shot: W08+ source: promo/demo3/clips/W08.mp4+ source_sha256: 818de9680bfc193d3b13cd51cc24ab4a66e2ef5a3da3aae21e512faba8ea75a3+ generator: "Veo 3.1 Fast (ElevenLabs)"+ generated: 2026-10-12+ start_frame: 12+ frames: 84+ alt: "Illustration: the drained valley, a dragline at work, new fields and channels."+ ai_generated: true+ sensitive: false+ sensitivity_reviewed: false+ - event: operation_horev+ option: launch+ file: operation_horev-outcome.mp4+ shot: A05+ source: promo/demo2/clips/A05.mp4+ source_sha256: c0725105f17ae4b9a9f91417f83e5357ba725504a737d557da380573fc6e77d0+ generator: "Seedance 2.0 (Dreamina); the Dreamina AI badge is kept"+ generated: 2026-10-12+ decimate: true+ start_frame: 2+ frames: 84+ alt: "Illustration: jeeps and an armoured carrier crossing the Negev."+ ai_generated: true+ sensitive: true+ sensitivity_reviewed: falsediff --git a/unity/Assets/Scripts/UI/CardVideo.cs b/unity/Assets/Scripts/UI/CardVideo.csindex 7efa3b1db..f5bfef731 100644--- a/unity/Assets/Scripts/UI/CardVideo.cs+++ b/unity/Assets/Scripts/UI/CardVideo.cs@@ -6,11 +6,13 @@ using UnityEngine.Video;namespace Statecraft.Game.UI{- /// <summary>The decision card's silent illustration loop (decision videos, 2026-10-13): one VideoPlayer, made the first- /// time a clip is asked for (never at boot), playing a clip from StreamingAssets by URL (the only source the Web player- /// takes) into one reused 960x540 RenderTexture, which the media header shows as its background. Muted (the clips have- /// no audio track), looping. A clip that fails (errorReceived) or is not prepared within PrepareTimeoutMs is stopped and- /// reported once, and the card shows the photograph again. Presentation only.</summary>+ /// <summary>A silent clip player (decision videos, 2026-10-13): one VideoPlayer, made the first time a clip is asked for+ /// (never at boot), playing a clip from StreamingAssets by URL (the only source the Web player takes) into one reused+ /// 960x540 RenderTexture, which the target element shows as its background. The decision card has one, for its looping+ /// illustration; the End Turn outcome clips have their own (OutcomePresenter), which plays each clip once. No audio is+ /// output (the clips have no audio track). A clip that fails (errorReceived) or is not prepared within its timeout is+ /// stopped and reported once. The texture is cleared at each Play, so a new clip never opens on the last frame of the+ /// previous one. Presentation only.</summary>public sealed class CardVideo : IDisposable{public const int Width = 960, Height = 540;@@ -18,7 +20,7 @@ namespace Statecraft.Game.UIpublic const long PrepareTimeoutMs = 8000;GameObject? go; VideoPlayer? player; RenderTexture? rt;- VisualElement? target; Action<string>? onFail; IVisualElementScheduledItem? timeout;+ VisualElement? target; Action<string>? onFail; Action? onEnded; IVisualElementScheduledItem? timeout;/// <summary>Video is off in the automated runs (the smoke run, the golden check, the shot, frame and pixel-error/// profiles, the unit showcase and the border proof), so their captures and checks never depend on decoding: the@@ -44,15 +46,21 @@ namespace Statecraft.Game.UIpublic bool Showing { get; private set; }/// <summary>Plays <paramref name="url"/> into <paramref name="header"/>'s background; <paramref name="failed"/> is told- /// (once) if it fails or times out. The header keeps whatever it shows until the first frame is ready.</summary>- public void Play(string url, VisualElement header, Action<string> failed)+ /// (once) if it fails or times out. The header keeps whatever it shows until the first frame is ready. A card's+ /// illustration loops; an outcome clip (<paramref name="loop"/> false) plays once and then tells+ /// <paramref name="ended"/>.</summary>+ /// <param name="prepareTimeoutMs">How long it may take to be ready (default PrepareTimeoutMs).</param>+ public void Play(string url, VisualElement header, Action<string> failed, bool loop = true, Action? ended = null,+ long prepareTimeoutMs = PrepareTimeoutMs){Stop();Ensure();- target = header; onFail = failed; Current = url;- player!.url = url;+ var was = RenderTexture.active; RenderTexture.active = rt; GL.Clear(false, true, Color.black); RenderTexture.active = was;+ target = header; onFail = failed; onEnded = loop ? null : ended; Current = url;+ player!.isLooping = loop;+ player.url = url;player.Prepare();- timeout = header.schedule.Execute(() => { if (Current == url && !Showing) Fail("not ready after " + PrepareTimeoutMs + " ms"); }).StartingIn(PrepareTimeoutMs);+ timeout = header.schedule.Execute(() => { if (Current == url && !Showing) Fail("not ready after " + prepareTimeoutMs + " ms"); }).StartingIn(prepareTimeoutMs);}/// <summary>Puts the playing clip back on <paramref name="header"/>'s background (after the card reset it to the@@ -68,7 +76,7 @@ namespace Statecraft.Game.UI{timeout?.Pause(); timeout = null;if (player != null) { player.Stop(); player.url = ""; }- target = null; onFail = null; Current = null; Showing = false;+ target = null; onFail = null; onEnded = null; Current = null; Showing = false;}public void Dispose()@@ -96,6 +104,7 @@ namespace Statecraft.Game.UIplayer.skipOnDrop = true;player.waitForFirstFrame = true;player.prepareCompleted += OnPrepared;+ player.loopPointReached += _ => { var told = onEnded; if (told == null) return; Stop(); told(); }; // a once-only clip endedplayer.errorReceived += OnError;}diff --git a/unity/Assets/Scripts/UI/EventVideoMapping.cs b/unity/Assets/Scripts/UI/EventVideoMapping.csindex 7c5f19149..682ee9dc4 100644--- a/unity/Assets/Scripts/UI/EventVideoMapping.cs+++ b/unity/Assets/Scripts/UI/EventVideoMapping.cs@@ -32,22 +32,33 @@ namespace Statecraft.Game.UIpublic bool AiGenerated { get; set; }public bool Sensitive { get; set; }public bool SensitivityReviewed { get; set; }+ /// <summary>Outcome clips only (the `outcomes` list): the option whose order it shows, and the window of the shot+ /// the encoder keeps (tools/encode_event_videos.py).</summary>+ public string Option { get; set; } = "";+ public bool Decimate { get; set; }+ public int StartFrame { get; set; }+ public int Frames { get; set; }}sealed class Doc{public string Checked { get; set; } = "";public List<Row> Clips { get; set; } = new List<Row>();+ public List<Row> Outcomes { get; set; } = new List<Row>();}/// <summary>Parses the mapping. Throws InvalidOperationException naming the file on malformed YAML or unknown keys.</summary>- public static IReadOnlyList<Row> Parse(string yaml)+ public static IReadOnlyList<Row> Parse(string yaml) => ParseDoc(yaml).Clips;++ /// <summary>The End Turn outcome clips (decision videos, phase 3).</summary>+ public static IReadOnlyList<Row> ParseOutcomes(string yaml) => ParseDoc(yaml).Outcomes;++ static Doc ParseDoc(string yaml){try{- var doc = new DeserializerBuilder().WithNamingConvention(UnderscoredNamingConvention.Instance)- .WithDuplicateKeyChecking().Build().Deserialize<Doc>(yaml ?? "");- return doc?.Clips ?? new List<Row>();+ return new DeserializerBuilder().WithNamingConvention(UnderscoredNamingConvention.Instance)+ .WithDuplicateKeyChecking().Build().Deserialize<Doc>(yaml ?? "") ?? new Doc();}catch (YamlDotNet.Core.YamlException e) { throw new InvalidOperationException($"{Path}: {e.Message}", e); }}@@ -59,6 +70,49 @@ namespace Statecraft.Game.UIreturn asset == null ? Array.Empty<Row>() : Parse(asset.text);}+ /// <summary>The shipped outcome clips, or none when the mapping is missing.</summary>+ public static IReadOnlyList<Row> LoadOutcomes() => LoadBoth().outcomes;++ /// <summary>The shipped card loops and outcome clips from one read of the mapping (none when it is missing).</summary>+ public static (IReadOnlyList<Row> clips, IReadOnlyList<Row> outcomes) LoadBoth()+ {+ var asset = Resources.Load<TextAsset>(ResourcePath);+ if (asset == null) return (Array.Empty<Row>(), Array.Empty<Row>());+ var doc = ParseDoc(asset.text);+ return (doc.Clips, doc.Outcomes);+ }++ /// <summary>Every problem with the outcome rows: an unknown event or option, a repeated event, an option that is not+ /// the event's historical one (counterfactual orders get no clip), any deport option or event with one (Deport never+ /// gets any video), a file that is not <event>-outcome.mp4 or is missing, a window that is not 3 to 4 s at 24+ /// fps, and the same labelling, source and sensitivity rules as the card loops.</summary>+ public static List<string> OutcomeProblems(IReadOnlyList<Row> rows, Content content, Func<string, bool> fileExists)+ {+ var problems = new List<string>();+ var events = content.Events.ToDictionary(e => e.Id);+ var sensitiveEvents = new HashSet<string>(ReleaseGate.SensitiveEvents(content));+ foreach (var g in rows.GroupBy(r => r.Event).Where(g => g.Count() > 1)) problems.Add($"{g.Key}: more than one outcome");+ foreach (var r in rows)+ {+ if (!events.TryGetValue(r.Event, out var ev)) { problems.Add($"{r.Event}: no such event"); continue; }+ if (r.Option.IndexOf("deport", StringComparison.OrdinalIgnoreCase) >= 0 || ev.Options.Any(o => o.Id.IndexOf("deport", StringComparison.OrdinalIgnoreCase) >= 0))+ problems.Add($"{r.Event}: Deport never gets any video");+ var option = ev.Options.FirstOrDefault(o => o.Id == r.Option);+ if (option == null) problems.Add($"{r.Event}: no option '{r.Option}'");+ else if (!option.Historical) problems.Add($"{r.Event}: '{r.Option}' is not the historical option; counterfactual orders get no clip");+ if (r.File != r.Event + "-outcome.mp4") problems.Add($"{r.Event}: file must be {r.Event}-outcome.mp4 (got '{r.File}')");+ else if (!fileExists(r.File)) problems.Add($"{r.Event}: {ClipFolder}/{r.File} missing (run tools/encode_event_videos.py)");+ if (r.Frames < 72 || r.Frames > 96) problems.Add($"{r.Event}: {r.Frames} frames is not 3 to 4 s at 24 fps");+ if (!r.AiGenerated) problems.Add($"{r.Event}: ai_generated must be true");+ if (!r.Source.StartsWith("promo/", StringComparison.Ordinal) || r.SourceSha256.Length != 64) problems.Add($"{r.Event}: source and its sha256 needed");+ if (r.Generator.Trim() == "" || r.Generated.Trim() == "") problems.Add($"{r.Event}: generator or date missing");+ if (!r.Alt.StartsWith("Illustration: ", StringComparison.Ordinal) || r.Alt.Length < 30) problems.Add($"{r.Event}: alt text must start 'Illustration: ' and say what it shows");+ if (sensitiveEvents.Contains(ev.Id) && !r.Sensitive) problems.Add($"{r.Event}: the event has a sensitive tag, so its clip must be sensitive: true");+ if (r.SensitivityReviewed && !r.Sensitive) problems.Add($"{r.Event}: sensitivity_reviewed without sensitive");+ }+ return problems;+ }+/// <summary>Every problem with the rows (empty when the mapping is sound): an unknown or repeated event; an event/// with a deport option (Deport never gets any video: GDD owner ruling 1, CONTENT_POLICY section 4); an event with no/// archival photograph (a clip is never the only picture of a real event); a file that is not <event>.mp4 or is@@ -91,6 +145,6 @@ namespace Statecraft.Game.UI/// <summary>The events whose clip is sensitive and not yet sensitivity-reviewed, in id order.</summary>public static IReadOnlyList<string> SensitiveUnreviewed(IReadOnlyList<Row> rows) =>- rows.Where(r => r.Sensitive && !r.SensitivityReviewed).Select(r => r.Event).OrderBy(x => x, StringComparer.Ordinal).ToList();+ rows.Where(r => r.Sensitive && !r.SensitivityReviewed).Select(r => r.Event).Distinct().OrderBy(x => x, StringComparer.Ordinal).ToList();}}diff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.csindex b162452ed..685c842c1 100644--- a/unity/Assets/Scripts/UI/GameRoot.cs+++ b/unity/Assets/Scripts/UI/GameRoot.cs@@ -48,6 +48,7 @@ namespace Statecraft.Game.UIScreenNav? nav;StartScreenPresenter? start;EventCardPresenter? card;+ OutcomePresenter? outcomes;CameraRig? rig;List<(string, int, int, DateTime)>? drawn;@@ -147,9 +148,14 @@ namespace Statecraft.Game.UIif (DiagLog.Nav) Own(new NavEventLog(root)); // ?navlog: every UI pointer/submit event (playtest 2, P2-4)// The Illustration switch's silent loops (event-videos.yaml, Resources): none in the automated runs (CardVideo.ForcedOff).var video = CardVideo.ForcedOff() ? null : Own(new CardVideo());- var clips = video == null ? null : EventVideoMapping.Load().ToDictionary(r => r.Event);+ var mapping = video == null ? default : EventVideoMapping.LoadBoth();+ var clips = video == null ? null : mapping.clips.ToDictionary(r => r.Event);card = Own(new EventCardPresenter(root, bridge, text, portraits, EventImageCatalog.Load(), video,clips == null ? null : id => clips.TryGetValue(id, out var r) ? r : null)); // event photos: Resources, no scene field+ // The End Turn outcome clips (decision videos, phase 3): none in the automated runs (no video there). Their own+ // player, so the card's loop never takes it; an open screen closes when one starts.+ outcomes = video == null ? null : Own(new OutcomePresenter(root, bridge, text, Own(new CardVideo()), mapping.outcomes,+ () => card?.Render(), () => nav?.Close()));Own(new DefencePresenter(root, bridge, text, portraits));Own(new BudgetPresenter(root, bridge, text));Own(new WhyPresenter(root, bridge, text));@@ -199,7 +205,8 @@ namespace Statecraft.Game.UIOwn(GameStart.Autosave(bridge, store, text, toast.Append)); // appends: the turn's refusals stay visible}- Func<Vector2, bool> overUi = p => UiPointer.IsOverUi(root.panel, p, Screen.height);+ // An outcome clip holds the pointer while it shows and in the frame it closes (the skipping click selects no hex).+ Func<Vector2, bool> overUi = p => outcomes?.HoldsThePointer == true || UiPointer.IsOverUi(root.panel, p, Screen.height);var terrain = map.Terrain;var size = terrain.terrainData.size;var oldBounds = cameraController.Bounds;@@ -308,7 +315,7 @@ namespace Statecraft.Game.UIStopAllCoroutines();for (int i = owned.Count - 1; i >= 0; i--) owned[i].Dispose();owned.Clear();- minimap = null; labels = null; nav = null; start = null; card = null; rig = null; drawn = null; units = null; logCamera = false;+ minimap = null; labels = null; nav = null; start = null; card = null; outcomes = null; rig = null; drawn = null; units = null; logCamera = false;// A ?profile run cut short (a stopped coroutine never reaches its restore line) must not leave the terrain at the// profile's pixel error (Task 24 review M1). Nothing else changes it, so restoring is always right.if (map != null && map.Terrain != null) map.Terrain.heightmapPixelError = MapBuilder.TerrainPixelError;@@ -364,7 +371,7 @@ namespace Statecraft.Game.UI// Game request (StartScreenPresenter.Escape; idempotent too).// With nothing else to close, Escape on the open decision card is Hide (EventCardPresenter.Escape; the card itself// takes the Cancel event when it has the focus).- if (UnityEngine.InputSystem.Keyboard.current?.escapeKey.wasPressedThisFrame == true) { bool done = start?.Escape() == true; done |= nav?.Close() == true; if (!done && document.rootVisualElement.focusController?.focusedElement == null) card?.Escape(); }+ if (UnityEngine.InputSystem.Keyboard.current?.escapeKey.wasPressedThisFrame == true) { bool done = outcomes?.SkipAll() == true || outcomes?.ClosedThisFrame == true; done |= start?.Escape() == true; done |= nav?.Close() == true; if (!done && document.rootVisualElement.focusController?.focusedElement == null) card?.Escape(); }SyncMinimap();if (!logCamera || rig == null || (rig.Distance == loggedDistance && rig.Yaw == loggedYaw)) return;loggedDistance = rig.Distance; loggedYaw = rig.Yaw;diff --git a/unity/Assets/Scripts/UI/OutcomePresenter.cs b/unity/Assets/Scripts/UI/OutcomePresenter.csnew file mode 100644index 000000000..3b6a75a13--- /dev/null+++ b/unity/Assets/Scripts/UI/OutcomePresenter.cs@@ -0,0 +1,222 @@+#nullable enable+using System;+using System.Collections.Generic;+using System.Linq;+using Statecraft.Sim;+using UnityEngine.UIElements;++namespace Statecraft.Game.UI+{+ /// <summary>The End Turn outcome clips (decision videos, phase 3; docs/event-videos.md). When a turn has run, each event+ /// the player answered with its historical option, in an order the turn applied (not in the turn's rejections, and in+ /// GameState.ChosenOptions with that option), and that has an outcome clip, plays once: a 3.5 s silent clip in the+ /// middle of the screen, captioned as the order ("Your order: ..."), never as a result. A delegated answer, a+ /// counterfactual option and Deport get none (EventVideoMapping.OutcomeProblems refuses such rows). Several play one+ /// after the other.+ /// While one plays: a screen open at End Turn is closed (closeScreens), the layer is drawn over everything but the+ /// toast (Game.uxml order), and the top bar, the panels and the decision layer are disabled (ScreenNav.DisableCovered),+ /// so no order can be given under it. It has its own CardVideo, so the decision card's loop never touches it.+ /// The layer takes the keyboard focus (retried once styles resolve, as a hidden element cannot take it): Enter, Space+ /// or a gamepad's Submit skips one clip, Esc or Cancel skips them all, and a click skips one. When the last one closes+ /// the focus goes back where it was, unless the decision card takes it (ScreenNav.OnUncovered).+ /// Not made at all when video is off (CardVideo.ForcedOff: every automated run).</summary>+ public sealed class OutcomePresenter : IDisposable+ {+ /// <summary>On the "root" element while an outcome clip shows.</summary>+ public const string OpenClass = "outcome-open";+ /// <summary>How long a clip may take to be ready before it is skipped (the card's loop allows 8 s; an outcome holds+ /// the screen, so it gives up sooner).</summary>+ public const long PrepareTimeoutMs = 3000;+ /// <summary>How long past the clip's own length the overlay waits for its end before moving on (a stalled stream).</summary>+ public const long GraceMs = 2000;++ readonly VisualElement hudRoot, layer, media; readonly Label caption;+ readonly SimBridge bridge; readonly UiText text; readonly CardVideo video;+ readonly Dictionary<(string ev, string option), EventVideoMapping.Row> clips;+ readonly Action? closed, closeScreens;+ readonly Action<IReadOnlyList<Rejection>> onTurn;+ readonly EventCallback<PointerDownEvent> onPointer;+ readonly EventCallback<NavigationSubmitEvent> onSubmit;+ readonly EventCallback<NavigationCancelEvent> onCancel;+ readonly EventCallback<GeometryChangedEvent> onGeometry, onShown;+ readonly Queue<(EventVideoMapping.Row row, string order)> queue = new Queue<(EventVideoMapping.Row, string)>();+ IVisualElementScheduledItem? guard;+ Focusable? focusBefore;++ /// <summary>The clip on screen now, or null.</summary>+ public EventVideoMapping.Row? Showing { get; private set; }++ int closedAt = -100;+ /// <summary>True in the frame the overlay closed: GameRoot's Escape poll then leaves the card alone (the same Escape+ /// key already skipped the clips through the Cancel event).</summary>+ public bool ClosedThisFrame => closedAt == UnityEngine.Time.frameCount;++ /// <summary>True while a clip shows and in the frame after the overlay closed: the map ignores a press then, so the+ /// click that skips a clip never also selects the hex under it.</summary>+ public bool HoldsThePointer => Showing != null || UnityEngine.Time.frameCount - closedAt <= 1;++ /// <summary>The caption of the clip on screen ("Your order: ..."), or "".</summary>+ public string Caption => caption.text;++ /// <param name="video">The outcome clips' own player (not the decision card's).</param>+ /// <param name="closed">Told when the last clip of a turn is done (GameRoot re-renders the decision card).</param>+ /// <param name="closeScreens">Closes any open screen (ScreenNav.Close) when a clip starts.</param>+ public OutcomePresenter(VisualElement root, SimBridge bridge, UiText text, CardVideo video, IEnumerable<EventVideoMapping.Row> rows,+ Action? closed = null, Action? closeScreens = null)+ {+ this.bridge = bridge; this.text = text; this.video = video; this.closed = closed; this.closeScreens = closeScreens;+ clips = rows.ToDictionary(r => (r.Event, r.Option));+ hudRoot = root.Q("root") ?? root;+ layer = root.Q<VisualElement>("outcome-layer");+ media = layer.Q<VisualElement>("outcome-media");+ caption = layer.Q<Label>("outcome-caption");+ layer.Q<Label>("outcome-hint").text = text["outcome.skip"];+ layer.Q<Label>("outcome-label").text = text["event.ai_label"];+ layer.focusable = true; layer.tabIndex = 0;+ onTurn = rejected =>+ {+ // Guarded as a whole: nothing in the outcome code may throw out of TurnEnded, whose later handlers+ // include the turn's autosave (GameStart.Autosave subscribes after this presenter).+ try { Turn(rejected); }+ catch (Exception e)+ {+ UnityEngine.Debug.LogException(e);+ try { queue.Clear(); video.Stop(); Close(); } catch (Exception again) { UnityEngine.Debug.LogException(again); }+ }+ };+ onPointer = e => { Skip(); e.StopPropagation(); };+ onSubmit = e => { Skip(); e.StopPropagation(); };+ onCancel = e => { SkipAll(); e.StopPropagation(); };+ onGeometry = _ => // 16:9 of its width (USS has no aspect ratio)+ {+ var w = media.layout.width;+ if (w > 0 && UnityEngine.Mathf.Abs(media.layout.height - w / EventCardPresenter.MediaAspect) > 0.5f)+ media.style.height = UnityEngine.Mathf.Round(w / EventCardPresenter.MediaAspect);+ };+ media.RegisterCallback(onGeometry);+ // The layer cannot take the focus while it is still undisplayed: it takes it when it is laid out.+ onShown = _ => { if (Showing != null && layer.focusController?.focusedElement != layer) layer.Focus(); };+ layer.RegisterCallback(onShown);+ bridge.TurnEnded += onTurn;+ layer.RegisterCallback(onPointer);+ layer.RegisterCallback(onSubmit);+ layer.RegisterCallback(onCancel);+ }++ /// <summary>The turn just run: queue the clip of every historical order it applied, then play the first.</summary>+ /// <summary>Test seam: runs at the start of each turn's handling (a test throws from it).</summary>+ internal Action? BeforeTurn;++ void Turn(IReadOnlyList<Rejection> rejected)+ {+ BeforeTurn?.Invoke();+ var c = bridge.Content; var s = bridge.State;+ foreach (var order in bridge.LastBatch.OfType<ChooseEventOption>())+ {+ if (!clips.TryGetValue((order.EventId, order.OptionId), out var row)) continue;+ if (rejected.Any(x => ReferenceEquals(x.Command, order))) continue; // refused+ if (!s.ChosenOptions.TryGetValue(order.EventId, out var applied) || applied != order.OptionId) continue; // replaced+ var ev = c.Events.FirstOrDefault(e => e.Id == order.EventId);+ var option = ev?.Options.FirstOrDefault(o => o.Id == order.OptionId);+ if (ev == null || option == null || !option.Historical) continue; // the mapping refuses this too+ string words;+ try { words = Cabinet.Fill(c, s, option.Text, EventSystem.FillDate(ev, bridge.LastBatchDate)); } // the card's date+ catch (Exception e) // never let a caption break the turn's other TurnEnded work (the autosave)+ {+ UnityEngine.Debug.LogWarning($"VIDEO outcome caption for {order.EventId}/{order.OptionId}: {e.Message}");+ continue;+ }+ queue.Enqueue((row, text.Format("outcome.order", words)));+ }+ if (Showing == null && queue.Count > 0) Next();+ }++ void Next()+ {+ guard?.Pause(); guard = null;+ if (queue.Count == 0) { Close(); return; }+ var (row, order) = queue.Dequeue();+ if (Showing == null)+ {+ focusBefore = layer.focusController?.focusedElement;+ closeScreens?.Invoke();+ }+ Showing = row;+ UnityEngine.Debug.Log("OUTCOME showing " + row.Event);+ caption.text = order;+ media.tooltip = row.Alt;+ media.style.backgroundImage = StyleKeyword.None;+ hudRoot.AddToClassList(OpenClass);+ ScreenNav.DisableCovered(hudRoot);+ TakeFocus();+ var shown = row;+ video.Play(CardVideo.Url(row.File), media, _ => { if (Showing == shown) Next(); }, loop: false,+ ended: () => { if (Showing == shown) Next(); }, prepareTimeoutMs: PrepareTimeoutMs);+ guard = layer.schedule.Execute(() => { if (Showing == shown) Next(); }).StartingIn(row.Frames * 1000L / 24 + PrepareTimeoutMs + GraceMs);+ }++ /// <summary>The layer takes the focus now; if it is still undisplayed (the class has not resolved yet), it takes it+ /// when it is laid out (onShown), and a scheduled retry covers a layout that does not change.</summary>+ void TakeFocus()+ {+ layer.Focus();+ layer.schedule.Execute(() => { if (Showing != null && layer.focusController?.focusedElement != layer) layer.Focus(); })+ .Every(50).ForDuration(1000);+ }++ /// <summary>Skips the clip on screen (a click, Enter, Space, Submit).</summary>+ public void Skip() { if (Showing != null) { UnityEngine.Debug.Log("OUTCOME skipped " + Showing.Event); video.Stop(); Next(); } }++ /// <summary>Skips every clip of this turn (Esc, Cancel). True when one was showing.</summary>+ public bool SkipAll()+ {+ if (Showing == null) return false;+ UnityEngine.Debug.Log("OUTCOME skipped all at " + Showing.Event);+ queue.Clear();+ video.Stop();+ Close();+ return true;+ }++ void Close()+ {+ guard?.Pause(); guard = null;+ var was = Showing != null;+ Showing = null; caption.text = "";+ media.tooltip = "";+ media.style.backgroundImage = StyleKeyword.None;+ hudRoot.RemoveFromClassList(OpenClass);+ if (!was) { ScreenNav.DisableCovered(hudRoot); return; }+ closedAt = UnityEngine.Time.frameCount;+ UnityEngine.Debug.Log("OUTCOME closed");+ var back = focusBefore; focusBefore = null;+ layer.Blur();+ ScreenNav.DisableCovered(hudRoot); // the decision layer comes back: an open card takes the focus (OnUncovered)+ Restore(back);+ layer.schedule.Execute(() => Restore(back));+ closed?.Invoke();+ }++ /// <summary>Puts the focus back where it was before the clips, unless something (the decision card) has it.</summary>+ void Restore(Focusable? back)+ {+ if (Showing != null || back is not VisualElement e || e.panel == null || !e.enabledInHierarchy || !e.canGrabFocus) return;+ var now = layer.focusController?.focusedElement;+ if (now == null || now == layer) e.Focus();+ }++ public void Dispose()+ {+ bridge.TurnEnded -= onTurn;+ layer.UnregisterCallback(onPointer);+ layer.UnregisterCallback(onSubmit);+ layer.UnregisterCallback(onCancel);+ media.UnregisterCallback(onGeometry);+ layer.UnregisterCallback(onShown);+ queue.Clear();+ if (Showing != null) video.Stop();+ focusBefore = null;+ Close();+ }+ }+}diff --git a/unity/Assets/Scripts/UI/OutcomePresenter.cs.meta b/unity/Assets/Scripts/UI/OutcomePresenter.cs.metanew file mode 100644index 000000000..1cfd0a8ae--- /dev/null+++ b/unity/Assets/Scripts/UI/OutcomePresenter.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 6e50a8b7615734d3ab19aaedd3465243\ No newline at end of filediff --git a/unity/Assets/Scripts/UI/ScreenNav.cs b/unity/Assets/Scripts/UI/ScreenNav.csindex 1663a7b4d..1755e097b 100644--- a/unity/Assets/Scripts/UI/ScreenNav.cs+++ b/unity/Assets/Scripts/UI/ScreenNav.cs@@ -27,30 +27,33 @@ namespace Statecraft.Game.UI/// open screen covers the decision layer (it sits where the card does), and in the two-row HUD also the minimap/// column and the info panel; a wide screen covers the info panel; the open decision card's backdrop/// (EventCardPresenter.OpenClass, with no start screen or screen over it: ModalClass, set here) covers the minimap- /// column and the info panel. Called wherever one of those classes changes (StartScreenPresenter, Open,- /// HudPresenter's tier, EventCardPresenter), so no caller re-enables a panel another still covers.</summary>+ /// column and the info panel; an End Turn outcome clip (OutcomePresenter.OpenClass) covers the top bar, the minimap+ /// column, the info panel and the decision layer. Called wherever one of those classes changes (StartScreenPresenter,+ /// Open, HudPresenter's tier, EventCardPresenter, OutcomePresenter), so no caller re-enables a panel another still+ /// covers.</summary>public static void DisableCovered(VisualElement root){var r = root.Q("root") ?? root;bool start = r.ClassListContains(StartScreenPresenter.OpenClass);bool screen = r.ClassListContains(ScreenOpenClass);bool full = screen && r.ClassListContains(HudPresenter.TwoRowClass);- bool modal = r.ClassListContains(EventCardPresenter.OpenClass) && !start && !screen;+ bool outcome = r.ClassListContains(OutcomePresenter.OpenClass); // an End Turn outcome clip covers all but itself+ bool modal = r.ClassListContains(EventCardPresenter.OpenClass) && !start && !screen && !outcome;r.EnableInClassList(EventCardPresenter.ModalClass, modal);- r.Q("top-bar")?.SetEnabled(!start);- r.Q("right-column")?.SetEnabled(!(start || full || modal));- r.Q("info-panel")?.SetEnabled(!(start || full || modal || r.ClassListContains(WideOpenClass)));+ r.Q("top-bar")?.SetEnabled(!(start || outcome));+ r.Q("right-column")?.SetEnabled(!(start || full || modal || outcome));+ r.Q("info-panel")?.SetEnabled(!(start || full || modal || outcome || r.ClassListContains(WideOpenClass)));var layer = r.Q("event-layer");if (layer != null){- bool was = layer.enabledSelf, now = !(start || screen);+ bool was = layer.enabledSelf, now = !(start || screen || outcome);layer.SetEnabled(now);if (!was && now) (layer.userData as System.Action)?.Invoke(); // EventCardPresenter: the open card takes the focus}}- /// <summary>Asks to be told, synchronously, whenever the decision layer comes out from under the start screen or a- /// screen (DisableCovered enables it again); null stops it.</summary>+ /// <summary>Asks to be told, synchronously, whenever the decision layer comes out from under the start screen, a+ /// screen or an outcome clip (DisableCovered enables it again); null stops it.</summary>public static void OnUncovered(VisualElement layer, System.Action? action) => layer.userData = action;/// <summary>Asks to be told, synchronously, whenever <paramref name="screen"/> is opened (a presenter that skipsdiff --git a/unity/Assets/Scripts/UI/SimBridge.cs b/unity/Assets/Scripts/UI/SimBridge.csindex ea823e889..fc7e1619b 100644--- a/unity/Assets/Scripts/UI/SimBridge.cs+++ b/unity/Assets/Scripts/UI/SimBridge.cs@@ -18,6 +18,11 @@ namespace Statecraft.Game.UIpublic Content Content => Session.Content;public GameState State => Session.State;public IReadOnlyList<Command> Queued => queue;+ /// <summary>The orders the last turn ran with (empty until a turn has run, and after a refused batch): what the player+ /// chose, as against what the turn delegated (OutcomePresenter plays a clip only for a choice).</summary>+ public IReadOnlyList<Command> LastBatch { get; private set; } = Array.Empty<Command>();+ /// <summary>The game date when the last turn's orders were given (the date before that turn ran).</summary>+ public DateTime LastBatchDate { get; private set; }/// <summary>The step before Session.Last (null until two turns have run), for "change since last turn".</summary>public StepResult? BeforeLast { get; private set; }/// <summary>Raised after every change the screens show: an order queued or withdrawn, a turn, a load.</summary>@@ -114,6 +119,7 @@ namespace Statecraft.Game.UIStepResult r;var before = Session.Last;var batch = queue.ToList();+ var date = State.Date;try { r = step(Session, batch); }catch (Exception e) // any exception (M3 final review M7): never leave a queue that fails on every End Turn{@@ -121,6 +127,7 @@ namespace Statecraft.Game.UIif (e is ArgumentException) UnityEngine.Debug.LogWarning("End Turn refused: " + e.Message);else UnityEngine.Debug.LogException(e);queue.Clear();+ LastBatch = Array.Empty<Command>();var reason = text.Format("order.failed", e.Message);var failed = new StepResult(State, new Cause[0], batch.Select(x => new Rejection(x, reason)).ToList());Changed?.Invoke();@@ -128,6 +135,7 @@ namespace Statecraft.Game.UIreturn failed;}BeforeLast = before;+ LastBatch = batch; LastBatchDate = date;queue.Clear();Changed?.Invoke();TurnEnded?.Invoke(r.Rejected);@@ -138,7 +146,7 @@ namespace Statecraft.Game.UIpublic void Replace(GameSession session){Session = session ?? throw new ArgumentNullException(nameof(session));- BeforeLast = null;+ BeforeLast = null; LastBatch = Array.Empty<Command>();queue.Clear();Changed?.Invoke();}diff --git a/unity/Assets/StreamingAssets/video/hula_drainage-outcome.mp4 b/unity/Assets/StreamingAssets/video/hula_drainage-outcome.mp4new file mode 100644index 000000000..2701c9bb9Binary files /dev/null and b/unity/Assets/StreamingAssets/video/hula_drainage-outcome.mp4 differdiff --git a/unity/Assets/StreamingAssets/video/hula_drainage-outcome.mp4.meta b/unity/Assets/StreamingAssets/video/hula_drainage-outcome.mp4.metanew file mode 100644index 000000000..23b0f35c8--- /dev/null+++ b/unity/Assets/StreamingAssets/video/hula_drainage-outcome.mp4.meta@@ -0,0 +1,7 @@+fileFormatVersion: 2+guid: 26957ff4be25d407a81cbc36739fa34f+DefaultImporter:+ externalObjects: {}+ userData:+ assetBundleName:+ assetBundleVariant:diff --git a/unity/Assets/StreamingAssets/video/maabarot_policy-outcome.mp4 b/unity/Assets/StreamingAssets/video/maabarot_policy-outcome.mp4new file mode 100644index 000000000..ac4350d15Binary files /dev/null and b/unity/Assets/StreamingAssets/video/maabarot_policy-outcome.mp4 differdiff --git a/unity/Assets/StreamingAssets/video/maabarot_policy-outcome.mp4.meta b/unity/Assets/StreamingAssets/video/maabarot_policy-outcome.mp4.metanew file mode 100644index 000000000..d9a115b30--- /dev/null+++ b/unity/Assets/StreamingAssets/video/maabarot_policy-outcome.mp4.meta@@ -0,0 +1,7 @@+fileFormatVersion: 2+guid: 71fe0c4daa8214977b01e088143e0744+DefaultImporter:+ externalObjects: {}+ userData:+ assetBundleName:+ assetBundleVariant:diff --git a/unity/Assets/StreamingAssets/video/operation_horev-outcome.mp4 b/unity/Assets/StreamingAssets/video/operation_horev-outcome.mp4new file mode 100644index 000000000..b700b000aBinary files /dev/null and b/unity/Assets/StreamingAssets/video/operation_horev-outcome.mp4 differdiff --git a/unity/Assets/StreamingAssets/video/operation_horev-outcome.mp4.meta b/unity/Assets/StreamingAssets/video/operation_horev-outcome.mp4.metanew file mode 100644index 000000000..b8761eeff--- /dev/null+++ b/unity/Assets/StreamingAssets/video/operation_horev-outcome.mp4.meta@@ -0,0 +1,7 @@+fileFormatVersion: 2+guid: 05e9053cb3b0d46dea20c4024bb935b9+DefaultImporter:+ externalObjects: {}+ userData:+ assetBundleName:+ assetBundleVariant:diff --git a/unity/Assets/Tests/EditMode/EventVideoTests.cs b/unity/Assets/Tests/EditMode/EventVideoTests.csindex 0f85c4045..ff95295c4 100644--- a/unity/Assets/Tests/EditMode/EventVideoTests.cs+++ b/unity/Assets/Tests/EditMode/EventVideoTests.cs@@ -36,7 +36,8 @@ public class EventVideoTestsAssert.IsNotEmpty(EventVideoMapping.Load(), "the game finds the mapping in Resources");// Every file in the folder has a row (no stray clip ships).var files = Directory.GetFiles(EventVideoMapping.ClipFolder, "*.mp4").Select(Path.GetFileName).OrderBy(x => x).ToArray();- CollectionAssert.AreEqual(rows.Select(r => r.File).OrderBy(x => x).ToArray(), files);+ var outcomes = EventVideoMapping.ParseOutcomes(File.ReadAllText(EventVideoMapping.Path)); // the End Turn clips (OutcomeClipTests)+ CollectionAssert.AreEqual(rows.Concat(outcomes).Select(r => r.File).OrderBy(x => x).ToArray(), files);}[Test]diff --git a/unity/Assets/Tests/EditMode/GameSceneTests.cs b/unity/Assets/Tests/EditMode/GameSceneTests.csindex c4e6d5a08..102f362c8 100644--- a/unity/Assets/Tests/EditMode/GameSceneTests.cs+++ b/unity/Assets/Tests/EditMode/GameSceneTests.cs@@ -89,6 +89,21 @@ public class GameSceneTestsAssert.AreEqual(StyleKeyword.Null, Ui.Q("start-caption").style.display.keyword);}+ /// <summary>The booted game (video on in an edit-mode run): the End Turn outcome clips have their own player, so the+ /// decision card's Render can never stop or replace one (review of #466, finding 1).</summary>+ [Test]+ public void TheOutcomeClipsHaveTheirOwnPlayer()+ {+ var root = Boot();+ Assert.IsFalse(CardVideo.ForcedOff(), "precondition: an edit-mode run has video");+ object? Field(object o, string name) => o.GetType().GetField(name, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)!.GetValue(o);+ var outcomes = Field(root, "outcomes"); var card = Field(root, "card");+ Assert.IsNotNull(outcomes); Assert.IsNotNull(card);+ var outcomePlayer = Field(outcomes!, "video"); var cardPlayer = Field(card!, "video");+ Assert.IsNotNull(outcomePlayer); Assert.IsNotNull(cardPlayer);+ Assert.AreNotSame(cardPlayer, outcomePlayer);+ }+[Test]public void TheGameStartsInTheSceneOnceTheInputsAreLoaded(){diff --git a/unity/Assets/Tests/EditMode/OutcomeClipTests.cs b/unity/Assets/Tests/EditMode/OutcomeClipTests.csnew file mode 100644index 000000000..d4cdbc2df--- /dev/null+++ b/unity/Assets/Tests/EditMode/OutcomeClipTests.cs@@ -0,0 +1,266 @@+#nullable enable+using System;+using System.Collections;+using System.Collections.Generic;+using System.IO;+using System.Linq;+using System.Reflection;+using NUnit.Framework;+using Statecraft.Game;+using Statecraft.Game.UI;+using Statecraft.Sim;+using UnityEditor;+using UnityEngine;+using UnityEngine.TestTools;+using UnityEngine.UIElements;+using Object = UnityEngine.Object;++/// <summary>Decision videos, phase 3 (docs/event-videos.md): an outcome clip plays at End Turn only for the historical option+/// the player ordered and the turn applied, captioned as the order; never for a counterfactual option, a delegated answer,+/// a refused order or Deport. It is drawn over the screens, closes an open one, and has its own player, so the decision+/// card cannot take it. The layer takes the keyboard focus: Enter or Space skips one clip, Esc skips them all, a click+/// skips one; the focus then goes back. A sensitive one waits for the owner's review before a shareable build.</summary>+public class OutcomeClipTests+{+ static readonly Content C = ContentLoader.Load(Paths.Content);+ static UiText Text => UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.Strings).text);+ static string Yaml => File.ReadAllText(EventVideoMapping.Path);++ [Test]+ public void EveryOutcomeIsAHistoricalOrderWithItsClipAndNoDeport()+ {+ var rows = EventVideoMapping.ParseOutcomes(Yaml);+ CollectionAssert.AreEquivalent(new[] { "maabarot_policy", "hula_drainage", "operation_horev" }, rows.Select(r => r.Event));+ var problems = EventVideoMapping.OutcomeProblems(rows, C, f => File.Exists(Path.Combine(EventVideoMapping.ClipFolder, f)));+ Assert.IsEmpty(problems, string.Join("\n", problems));+ Assert.AreEqual(3, EventVideoMapping.LoadOutcomes().Count, "the game finds them in Resources");+ }++ [Test]+ public void TheMappingRefusesACounterfactualOrderAndDeport()+ {+ var row = EventVideoMapping.ParseOutcomes(Yaml).First(r => r.Event == "maabarot_policy");+ var other = C.Events.First(e => e.Id == "maabarot_policy").Options.First(o => !o.Historical);+ var counter = new EventVideoMapping.Row { Event = row.Event, Option = other.Id, File = row.File, Frames = 84, Source = row.Source, SourceSha256 = row.SourceSha256, Generator = "x", Generated = "x", Alt = row.Alt, AiGenerated = true };+ Assert.IsTrue(EventVideoMapping.OutcomeProblems(new[] { counter }, C, _ => true).Any(p => p.Contains("not the historical option")));+ var c = ContentLoader.Load(Paths.Content);+ c.Events.First(e => e.Id == "maabarot_policy").Options.Add(new EventOption { Id = "deport", Text = "x" });+ Assert.IsTrue(EventVideoMapping.OutcomeProblems(new[] { row }, c, _ => true).Any(p => p.Contains("Deport never gets any video")));+ }++ /// <summary>The game's parts that meet an outcome clip, on a rendered panel: the HUD, the screens (ScreenNav), the+ /// decision card with its own player, and the outcome clips with theirs.</summary>+ sealed class Rig : IDisposable+ {+ public readonly VisualElement Root; public readonly SimBridge Bridge; public readonly ScreenNav Nav;+ public readonly EventCardPresenter Card; public readonly OutcomePresenter Outcomes;+ public readonly CardVideo CardPlayer = new CardVideo(), OutcomePlayer = new CardVideo();+ public int Closed;+ readonly GameObject go; readonly PanelSettings ps; readonly RenderTexture rt; readonly List<IDisposable> owned = new List<IDisposable>();++ public Rig(string[] events, Func<GameSession, IReadOnlyList<Command>, StepResult>? step = null)+ {+ rt = new RenderTexture(1920, 1080, 0);+ ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));+ ps.targetTexture = rt;+ go = new GameObject("OutcomeTest");+ go.SetActive(false);+ var doc = go.AddComponent<UIDocument>();+ doc.panelSettings = ps;+ doc.visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UiPaths.GameUxml);+ go.SetActive(true);+ Root = doc.rootVisualElement;+ Root.Q("root").RemoveFromClassList("loading");+ var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical);+ g.State.Date = C.Events.First(e => e.Id == events[0]).From;+ g.State.PendingEvents.Clear(); g.State.PendingEvents.AddRange(events);+ Bridge = new SimBridge(g, Text, step);+ owned.Add(new HudPresenter(Root, Bridge, Text));+ Nav = new ScreenNav(Root); owned.Add(Nav);+ Card = new EventCardPresenter(Root, Bridge, Text, null, null, CardPlayer, _ => null); owned.Add(Card);+ Outcomes = new OutcomePresenter(Root, Bridge, Text, OutcomePlayer, EventVideoMapping.ParseOutcomes(Yaml), () => Closed++, () => Nav.Close());+ owned.Add(Outcomes);+ owned.Add(CardPlayer); owned.Add(OutcomePlayer);+ }++ public void Order(string ev, string option) => Assert.IsNull(Bridge.Queue(new ChooseEventOption(ev, option)), $"{ev}/{option} is taken");+ public bool Open => Root.Q("root").ClassListContains(OutcomePresenter.OpenClass);+ public VisualElement Layer => Root.Q("outcome-layer");+ public Focusable? Focused => Root.panel.focusController.focusedElement;+ public void Send(EventBase e, VisualElement target) { e.target = target; target.SendEvent(e); }+ public void Dispose()+ {+ for (int i = owned.Count - 1; i >= 0; i--) owned[i].Dispose();+ Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt);+ }+ }++ static IEnumerator Frames(int n) { for (int i = 0; i < n; i++) yield return null; }++ [Test]+ public void TheHistoricalOrderPlaysItsClipAtEndTurnCaptionedAsTheOrder()+ {+ LogAssert.ignoreFailingMessages = true; // the edit-mode VideoPlayer may log+ using var r = new Rig(new[] { "maabarot_policy" });+ r.Order("maabarot_policy", "maabarot");+ Assert.IsFalse(r.Open, "nothing at the click: the order takes effect at End Turn");+ Assert.IsNull(r.OutcomePlayer.Current);+ r.Bridge.EndTurn();+ Assert.AreEqual("maabarot_policy", r.Outcomes.Showing?.Event);+ StringAssert.EndsWith("/video/maabarot_policy-outcome.mp4", r.OutcomePlayer.Current, "its clip is asked of its own player");+ var option = C.Events.First(e => e.Id == "maabarot_policy").Options.First(o => o.Id == "maabarot");+ Assert.AreEqual("Your order: " + option.Text, r.Outcomes.Caption);+ Assert.IsTrue(r.Open);+ Assert.IsFalse(r.Root.Q("top-bar").enabledSelf, "the bar waits while it plays");+ Assert.IsFalse(r.Root.Q("info-panel").enabledSelf);+ Assert.IsFalse(r.Root.Q("event-layer").enabledSelf);+ Assert.AreEqual("AI-generated illustration", r.Root.Q<Label>("outcome-label").text);+ }++ /// <summary>Scenario A of the review: a screen is open at End Turn. The clip closes it and is drawn over the screens+ /// (it comes after them in the tree). Scenario B: something changes under it (bridge.Changed); the card re-renders,+ /// but it has its own player, so the outcome clip plays on.</summary>+ [Test]+ public void AnOpenScreenClosesAndTheCardCannotTakeThePlayer()+ {+ LogAssert.ignoreFailingMessages = true;+ using var r = new Rig(new[] { "maabarot_policy", "hula_drainage" });+ r.Order("maabarot_policy", "maabarot");+ UiTestKit.Press(r.Root.Q<Button>("nav-budget"));+ Assert.AreEqual("budget", r.Nav.Current, "precondition: Budget is open");+ r.Bridge.EndTurn();+ Assert.IsNotNull(r.Outcomes.Showing);+ Assert.IsNull(r.Nav.Current, "the open screen closed when the clip started");+ var parent = r.Layer.parent;+ foreach (var s in ScreenNav.Screens)+ Assert.Greater(parent.IndexOf(r.Layer), parent.IndexOf(r.Root.Q("screen-" + s)), $"the clip is drawn over screen-{s}");+ var playing = r.OutcomePlayer.Current;+ r.Bridge.Queue(new ChooseEventOption("hula_drainage", "continue_works")); // a change while it plays: the card re-renders+ r.Card.Render();+ Assert.AreEqual(playing, r.OutcomePlayer.Current, "the card never stops or replaces the outcome clip");+ Assert.IsNotNull(r.Outcomes.Showing);+ }++ [UnityTest]+ public IEnumerator TheLayerTakesTheFocusEnterSkipsAndTheFocusGoesBack()+ {+ LogAssert.ignoreFailingMessages = true;+ using var r = new Rig(new[] { "maabarot_policy" });+ yield return Frames(3);+ r.Order("maabarot_policy", "maabarot");+ yield return Frames(2);+ var endTurn = r.Root.Q<Button>("end-turn");+ endTurn.Focus();+ Assert.AreSame(endTurn, r.Focused, "precondition: the keyboard is on End Turn");+ r.Bridge.EndTurn();+ for (var until = Time.realtimeSinceStartup + 2f; r.Focused != r.Layer && Time.realtimeSinceStartup < until;) yield return null;+ Assert.IsNotNull(r.Outcomes.Showing);+ Assert.AreSame(r.Layer, r.Focused, $"the clip has the keyboard focus once styles resolve (layer display {r.Layer.resolvedStyle.display}, enabled {r.Layer.enabledInHierarchy}, canGrabFocus {r.Layer.canGrabFocus})");+ using (var e = NavigationSubmitEvent.GetPooled()) r.Send(e, (VisualElement)r.Focused!); // Enter / Space / Submit, to whatever has the focus+ Assert.IsNull(r.Outcomes.Showing, "Enter skipped it");+ for (var until = Time.realtimeSinceStartup + 1f; Time.realtimeSinceStartup < until;) yield return null;+ if (r.Card.Shown == null) Assert.AreSame(endTurn, r.Focused, "no card is waiting: the focus is back on End Turn");+ else Assert.AreSame(r.Root.Q("event-card"), r.Focused, $"a new card ({r.Card.Shown.Id}) is waiting: it has the focus");+ }++ /// <summary>Two clips in one turn: a click (through the layer's own pointer handler) skips one and the next plays; Esc+ /// skips the rest.</summary>+ [Test]+ public void AClickSkipsOneAndEscapeSkipsThemAll()+ {+ LogAssert.ignoreFailingMessages = true;+ using (var r = new Rig(new[] { "maabarot_policy", "hula_drainage" }))+ {+ r.Order("maabarot_policy", "maabarot");+ r.Order("hula_drainage", "continue_works");+ r.Bridge.EndTurn();+ var first = r.Outcomes.Showing?.Event;+ Assert.IsNotNull(first);+ using (var e = PointerDownEvent.GetPooled()) r.Send(e, r.Layer);+ Assert.IsNotNull(r.Outcomes.Showing, "a click skips one: the second plays");+ Assert.AreNotEqual(first, r.Outcomes.Showing!.Event);+ Assert.IsTrue(r.Outcomes.HoldsThePointer, "the map ignores the pointer meanwhile");+ Assert.AreEqual(0, r.Closed);+ }+ using (var r = new Rig(new[] { "maabarot_policy", "hula_drainage" }))+ {+ r.Order("maabarot_policy", "maabarot");+ r.Order("hula_drainage", "continue_works");+ r.Bridge.EndTurn();+ Assert.IsNotNull(r.Outcomes.Showing);+ using (var e = NavigationCancelEvent.GetPooled()) r.Send(e, r.Layer);+ Assert.IsNull(r.Outcomes.Showing, "Esc skips them all, not just the one on screen");+ Assert.IsFalse(r.Open);+ Assert.AreEqual(1, r.Closed, "the card is told once");+ Assert.IsTrue(r.Root.Q("top-bar").enabledSelf, "the bar is back");+ Assert.IsNull(r.OutcomePlayer.Current);+ }+ }++ [Test]+ public void ACounterfactualADelegatedOrARefusedOrderGetsNoClip()+ {+ using (var r = new Rig(new[] { "maabarot_policy" }))+ {+ var other = C.Events.First(e => e.Id == "maabarot_policy").Options.First(o => !o.Historical);+ r.Order("maabarot_policy", other.Id);+ r.Bridge.EndTurn();+ Assert.IsNull(r.Outcomes.Showing, "counterfactual: no clip");+ Assert.IsFalse(r.Open);+ }+ using (var r = new Rig(new[] { "maabarot_policy" }))+ {+ r.Bridge.EndTurn(); // unanswered: the minister decides; the player gave no order+ Assert.IsTrue(r.Bridge.State.ChosenOptions.ContainsKey("maabarot_policy"), "precondition: it was delegated");+ Assert.IsNull(r.Outcomes.Showing, "delegated: no clip");+ }+ // The turn ran, the option stands in ChosenOptions (as a hard anchor resolves it), but the order is in the+ // rejections: no "Your order" for an order that was refused.+ using (var r = new Rig(new[] { "maabarot_policy" }, (s, cmds) =>+ {+ var done = s.Step(cmds);+ return new StepResult(done.State, done.Why, cmds.Select(c => new Rejection(c, "refused")).ToList());+ }))+ {+ r.Order("maabarot_policy", "maabarot");+ r.Bridge.EndTurn();+ Assert.AreEqual("maabarot", r.Bridge.State.ChosenOptions["maabarot_policy"], "precondition: the option stands");+ Assert.IsNull(r.Outcomes.Showing, "refused: no clip");+ }+ }++ /// <summary>The outcome code subscribes to TurnEnded before the autosave (as in GameRoot). A throw anywhere in it is+ /// caught there, so the turn is still saved.</summary>+ [Test]+ public void AThrowInTheOutcomeCodeNeverSkipsTheAutosave()+ {+ var dir = Path.Combine(Path.GetTempPath(), "statecraft-outcome-" + Guid.NewGuid().ToString("N"));+ try+ {+ var store = new SaveStore(dir);+ using var r = new Rig(new[] { "maabarot_policy" });+ using var save = GameStart.Autosave(r.Bridge, store, Text);+ r.Outcomes.BeforeTurn = () => throw new InvalidOperationException("outcome failure");+ r.Order("maabarot_policy", "maabarot");+ LogAssert.Expect(LogType.Exception, new System.Text.RegularExpressions.Regex("outcome failure"));+ r.Bridge.EndTurn();+ Assert.IsTrue(File.Exists(store.AutosavePath), "the turn was saved");+ Assert.IsNotEmpty(File.ReadAllText(store.AutosavePath));+ Assert.IsNull(r.Outcomes.Showing);+ Assert.IsFalse(r.Open, "nothing is left half open");+ }+ finally { if (Directory.Exists(dir)) Directory.Delete(dir, true); }+ }++ /// <summary>The build gate reads the outcome clips from the mapping (Build.GatedClips, used by RefuseUnlessShareable):+ /// the sensitive, unreviewed Horev clip refuses a shareable build.</summary>+ [Test]+ public void TheSensitiveHorevClipWaitsForTheOwnersReview()+ {+ var build = Type.GetType("Statecraft.Game.EditorTools.Build, Assembly-CSharp-Editor")!;+ var gated = (IReadOnlyList<EventVideoMapping.Row>)build.GetMethod("GatedClips", BindingFlags.Public | BindingFlags.Static)!.Invoke(null, new object[] { Yaml })!;+ var gate = build.GetMethod("GateRefusal", BindingFlags.Public | BindingFlags.Static)!;+ var refusal = (string?)gate.Invoke(null, new object?[] { new[] { "Unity", "-shareable" }, C, null, false, null, gated });+ StringAssert.Contains("illustration clips: operation_horev, operation_yoav, ten_days", refusal ?? "");+ }+}diff --git a/unity/Assets/Tests/EditMode/OutcomeClipTests.cs.meta b/unity/Assets/Tests/EditMode/OutcomeClipTests.cs.metanew file mode 100644index 000000000..218e37816--- /dev/null+++ b/unity/Assets/Tests/EditMode/OutcomeClipTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 9b40085fcc0a2493ba01b3023e245172\ No newline at end of filediff --git a/unity/Assets/UI/Game.uxml b/unity/Assets/UI/Game.uxmlindex a9f055814..5388f5a65 100644--- a/unity/Assets/UI/Game.uxml+++ b/unity/Assets/UI/Game.uxml@@ -256,6 +256,18 @@<ui:ScrollView name="why-rows" class="grow" /><Statecraft.Game.UI.UiFrame /></ui:VisualElement>+ <!-- The End Turn outcome clip (OutcomePresenter): the historical order the player gave, as a 3.5 s silent clip in the+ middle, captioned as the order; a click, Enter or Space skips it, Esc skips them all. After the screens, so it+ is drawn over them (an open screen is also closed when a clip starts); only the start screen and the toast come+ later. -->+ <ui:VisualElement name="outcome-layer" class="outcome-layer">+ <ui:VisualElement name="outcome-frame" class="panel outcome-frame" picking-mode="Ignore">+ <ui:VisualElement name="outcome-media" class="outcome-media" picking-mode="Ignore"><ui:Label name="outcome-label" class="outcome-label" picking-mode="Ignore" /></ui:VisualElement>+ <ui:Label name="outcome-caption" class="title outcome-caption" picking-mode="Ignore" />+ <ui:Label name="outcome-hint" class="muted outcome-hint" picking-mode="Ignore" />+ <Statecraft.Game.UI.UiFrame filigree="true" />+ </ui:VisualElement>+ </ui:VisualElement><!-- The start screen (StartScreenPresenter): shown over the started game before its first turn (never in automatedruns). The painting is AI-generated concept art (ASSETS.yaml), with no identifiable person. The two quotationsare the Declaration of the Establishment of the State of Israel, word for word: the official Hebrew (Itondiff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex 90f8642a5..203844085 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -213,6 +213,17 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);display: none; height: 540px; min-height: 0; flex-shrink: 1000; margin-bottom: 4px; overflow: hidden;justify-content: flex-end; background-size: cover; background-color: var(--navy-deep); border-width: 1px; border-color: var(--gold);}+/* The End Turn outcome clip (decision videos, phase 3; OutcomePresenter): over everything but the toast while it plays,+ a dim backdrop that takes the pointer (a click skips) and the clip in a 16:9 frame in the middle (OutcomePresenter sizes+ it from its width), its order under it. */+.outcome-layer { display: none; position: absolute; left: 0; top: 0; right: 0; bottom: 0; justify-content: center; align-items: center; background-color: rgba(5, 9, 18, 0.72); padding: 16px; }+.outcome-open .outcome-layer { display: flex; }+.outcome-open .event-layer { display: none; }+.outcome-frame { width: 1000px; max-width: 100%; padding: 16px 20px 12px 20px; align-items: stretch; }+.outcome-media { width: 100%; height: 540px; justify-content: flex-end; background-color: var(--navy-deep); background-size: cover; border-width: 1px; border-color: var(--gold); }+.outcome-label { font-size: 13px; -unity-font-style: italic; -unity-text-align: middle-center; margin: 0; padding: 2px 8px 3px 8px; color: var(--ink); background-color: rgba(5, 9, 18, 0.92); }+.outcome-caption { font-size: 26px; white-space: normal; -unity-text-align: middle-center; margin: 10px 0 2px 0; color: var(--gold-light); }+.outcome-hint { font-size: 15px; -unity-text-align: middle-center; margin: 0; }/* The Illustration switch (decision videos): over the media header's top right corner (the card's padding plus 8 px; itis the card's last child, for the focus order); hidden unless the event has a clip (EventCardPresenter.ApplyIllustration). */.hud-two-row .event-illustration { right: 24px; }diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex 22656cda7..43e8f9abc 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -21,6 +21,8 @@ start.listen: "Play the recording"start.stop: "Stop the recording"start.loading: "Loading the recording…"start.recording_failed: "The recording could not be played."+outcome.order: "Your order: {0}"+outcome.skip: "Click, Enter or Space to skip · Esc skips all"order.game_over: "The game is over"order.no_attention: "Not enough attention (need {0:0.0}, have {1:0.0})"order.unknown: "Unknown {0} '{1}'"diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex 608a82db5..dd69b796e 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -20,6 +20,8 @@ start.listen: "השמעת ההקלטה"start.stop: "עצירת ההקלטה"start.loading: "טוען את ההקלטה…"start.recording_failed: "לא ניתן היה להשמיע את ההקלטה."+outcome.order: "הפקודה שלך: {0}"+outcome.skip: "לחיצה, Enter או רווח לדילוג · Esc מדלג על הכול"order.game_over: "המשחק הסתיים"order.no_attention: "אין מספיק תשומת לב (נדרש {0:0.0}, יש {1:0.0})"order.unknown: "{0} לא מוכר: '{1}'"