# End screen, recap and credits (ui.endscreen) Part of the [menus and screens guide](guide:ui-screens). ## What it is for `ui.endscreen` ends a game without any interface of your own. It opens on the events you list (victory, defeat, missions, the death of the player, the `finished` phase, the end of the game flow of `game.engine`), shows the result, a recap (play time, stats read from variables, places and quests of `game.engine`, lines from other kits) and its buttons, then the credits. It builds one model; every engine draws it (the web player draws it as a `ui.webui` fragment). The kit needs `ui.menu` and `game.engine`: Play again and Main menu go through the menu. ## Turn it on ```text gripforge_gamekit_install { project_id: "gkp_…", id: "ui.endscreen" } gripforge_gamekit_configure { project_id: "gkp_…", id: "ui.endscreen", config: { "onDeath": true, "buttons": ["retry", "menu", "credits", "quit"] } } ``` With the defaults, emitting `game.won` opens the victory screen and `game.lost` the defeat screen. ## First example A game emits `game.lost`. The view then has the result `defeat`, the title "Defeat" (in French "Défaite"), a recap that starts with the play time and then the score. The game keeps playing until an interface says it draws the screen (`attach`); then it is paused, and `hide` resumes it. ```json { "op": "call", "service": "ui.endscreen", "method": "view", "args": ["fr"] } ``` ## Settings and defaults | Setting | Type | Default | Meaning | |---|---|---|---| | `template` | text | `classic` | web look: `classic`, `gothic`, `cinematic`, `tactical`, `arcade` | | `victoryEvents` | list | `["game.won"]` | events that end the game with a victory (patterns allowed: `*`, `boss.*`) | | `defeatEvents` | list | `["game.lost"]` | events that end the game with a defeat | | `missions` | list | `[]` | missions whose completion is a victory and failure a defeat (`*` and prefix patterns) | | `onFinished` | boolean | `true` | open when the game enters the `finished` phase (result read from `run.result`, `course.result`, `mission.status`) | | `onDeath` | boolean | `false` | `player.died` is a defeat | | `showTime` | boolean | `true` | show the play time in the recap | | `stats` | list | score, money, room reached | recap lines `{ id, var, label: { en, fr }, format }`, read from state variables when the screen opens; a line whose variable does not exist is not shown | | `buttons` | list | `["retry", "menu", "credits"]` | buttons in order, among `retry`, `menu`, `credits`, `quit` | | `victoryTitle`, `defeatTitle` | text `{ en, fr }` | empty | heading; empty = the built-in text | | `victoryText`, `defeatText` | text `{ en, fr }` | empty | message under the heading | | `creditsTitle` | text | empty | heading of the credits; empty = the project name | | `credits` | list | `[]` | sections `{ title, names[] }`, scrolled in this order | | `creditsSpeed` | number | `1.5` | credits speed in lines per second (0.2 to 10) | | `poweredBy` | boolean | `true` | end the credits with a "Made with" line | | `pauseGame` | boolean | `true` | pause the game while the screen is open | | `loadingLine` | text | `next` | loading of `asset.preload` shown by the buttons: `next`, `all` or `off` | Stat formats: `int`, `number`, `time`, `money`, `percent`, `text`. ## Services, events, variables - `ui.endscreen` (service): `show(result, stats?)` with `victory`, `defeat` or anything else for a plain end (false if a screen is already open or a hook cancelled it), `hide()`, `credits()`, `back()`, `view(lang)` (everything a presenter draws), `press(control)` (keyboard or gamepad control; answers `navigate`, `back`, `activate: