Merge branch 'feat/realm-play'
All checks were successful
CI / test (push) Successful in 23s

This commit is contained in:
Lukas Müllner 2026-11-13 22:16:32 +01:00
commit 905178c625
4 changed files with 23 additions and 5 deletions

View file

@ -307,3 +307,11 @@ Abgabe: **9. Dezember 2026, 03:00 MEZ**. Eingereicht wird in „Best Daily Game
Bedingungen aus `look.ts` – stimmen also nach Regeländerungen. Seite 540 × 675 mit Faktor 2 aufgenommen, Pixel scharf.
- Das Skript meldet, wenn der Inhalt höher als das Bild ist („… px zu hoch“).
- Texte der drei Posts: `docs/community-posts.md`.
### 2026-11-13 – Realm: „Play“ direkt ins Spiel (Rückmeldung Besitzer)
- Realm im Vollbild klappt am Handy. Aber „Done“ führte zurück in den Post, und für „Play“ ging es wieder ins Vollbild –
umständlich. Jetzt steht neben „Done“ ein „Play“ (bzw. „Play again“), das mit `requestExpandedMode(ev, 'game')`
direkt ins Spiel wechselt; laut Doku geht das auch aus einer Vollbild-Ansicht heraus. „Done“ bleibt der Weg zurück.
- Besitzer bestätigt im Test-Subreddit: Ergebnis als Kommentar funktioniert. Video-Posts sind in r/Ninelands aus
(gewollt) → Go-live-Post mit Cover-Bild und Vimeo-Link.

View file

@ -46,7 +46,10 @@ Your realm, your look. Tap 🎨 Realm on the daily post:
Same rules for all – it's just about looking good while you win. Which people are you playing?
```
## 3 – Go-live (Videopost: `trailer.mp4`, sonst `vimeo-cover.png`)
## 3 – Go-live (Bildpost: `vimeo-cover.png`, Video als Link)
In r/Ninelands sind Video-Posts aus (so gewollt). Deshalb das Cover als Bild und den Vimeo-Link zum Trailer in den Text
(oder `fallback.gif` aus `npm run capture` als bewegtes Bild).
Titel: `Ninelands is live – a new 9×9 map every day`
@ -60,6 +63,7 @@ Today's map is #1 – good luck, rulers!
New here? Read "How to play" (pinned). Bugs, ideas or feedback: comment below.
Trailer: <Vimeo-Link>
Original game: ninelands.stackteam.at
Music: "Dreamscape (part I)" by Vee Ray (CC BY-SA 4.0) · Sprites: "Mini World Sprites" by Shade & octoshrimpy (CC0)
```

View file

@ -1,6 +1,7 @@
// „🎨 Realm“ im Vollbild (Einstiegspunkt „realm“): Aussehen wählen, „Done“ führt zurück in den Post.
// „🎨 Realm“ im Vollbild (Einstiegspunkt „realm“): Aussehen wählen. „Done“ führt zurück in den Post, „Play“ wechselt
// direkt ins Spiel und bleibt dabei im Vollbild (requestExpandedMode geht laut Doku auch aus dem Vollbild heraus).
import './style.css'
import {exitExpandedMode} from '@devvit/web/client'
import {exitExpandedMode, requestExpandedMode} from '@devvit/web/client'
import {dailyMap} from '../shared/daily.ts'
import {fetchDay} from './api.ts'
import {byId, h} from './dom.ts'
@ -14,6 +15,8 @@ async function main(): Promise<void> {
const day = await fetchDay()
app.replaceChildren()
applyLook(day.look)
const play = h('button.primary', day.mine ? 'Play again' : 'Play')
play.addEventListener('click', ev => requestExpandedMode(ev, 'game'))
openRealm({
look: day.look,
progress: {
@ -24,6 +27,7 @@ async function main(): Promise<void> {
loggedIn: day.loggedIn,
onChange: look => applyLook(look),
onClose: ev => exitExpandedMode(ev),
actions: [play],
})
} catch (err) {
app.replaceChildren(

View file

@ -77,10 +77,12 @@ export function openRealm(opts: {
onChange: (look: Look) => void
/** Statt nur das Fenster zu schließen (Vollbild-Seite: zurück in den Post) */
onClose?: (ev: MouseEvent) => void
/** Weitere Knöpfe links neben „Done“ (Vollbild-Seite: direkt ins Spiel) */
actions?: HTMLButtonElement[]
}): void {
let look = opts.look
const body = h('div.realm-rows')
const close = h('button.primary', 'Done')
const close = h(opts.actions?.length ? 'button' : 'button.primary', 'Done')
const overlay = h(
'div.overlay',
h(
@ -93,7 +95,7 @@ export function openRealm(opts: {
: 'Log in to customise your realm and keep your unlocks.',
),
body,
h('div.row.end', close),
h('div.row.end', ...(opts.actions ?? []), close),
),
)
close.addEventListener('click', ev =>