Log inGet started
Package

screens.module

README.md

screens (productionKit)

The kit's full-screen UI. Welcome-back summaries in five styles, all fed the same summary and closed through the same onClose:

  • card: a centred card with "Welcome back!", time away, the big coin total, a grid of goods made and a Collect button.
  • ledger: a parchment steward's report, one line per building, closed by pressing a wax seal.
  • toast: a slim top banner with the coin total and top three goods that hides itself after six seconds.
  • chest: a treasure chest lands, shakes and bursts open in a gold flash with turning rays, sparkles and coins fountaining out; the coins earned rise out of it as a big number (+1.2M), the goods made are laid out below as tiles, time away above, and a pulsing Collect button. Side by side on short screens (phones held sideways).
  • report: a school report card: a letterhead with the town's name (summary.townName, else the readable name productionKit.text gives summary.town, never the id) and time away, one row per building with what it made, how busy it was and a hand-circled grade (A >= 85% busy, B >= 60%, C >= 30%, else D; - when a building has no busy), then an overall grade stamped in red, the teacher's comment and the coins earned.

summary = { town, away, counted, capped, cap, efficiency, made = {res=n}, paid = {res=n}, used = {res=n}, buildings = { { id, name, kind, made = {res=n}, busy = 0..1 or nil } } }.

Production queue panels in three styles, all fed the same view and raising cb.queue(jobId), cb.cancel(uid), cb.close():

  • list: a side panel with job buttons showing cost and time, queue rows with progress bars and a cancel per row, units trained so far.
  • slots: an RTS command bar along the bottom with job buttons and square queue slots; click a slot to cancel.
  • timeline: a strip across the top of the screen; each queued job is a block as wide as its time (never narrower than its label), the running one filling as it trains, each showing when it finishes from now; free slots trail as dashed cells; job buttons under it with cost and time, dimmed with the reason when they cannot be queued; click a block to cancel it. The running block animates its own fill, so the strip only redraws on whole seconds or when the queue changes.

Also a town stock bar (showHud: resource chips with amount, cap, a fill hairline and the net rate in green or red, top or bottom) and a small keycap hint (prompt("[E] Training queue")).

Every word a player reads goes through the engine's translation support: the keys live in locales/en/productionkit_ui.json (sections common, time, welcome, ledger, toast, chest, report, queue, timeline, hud), and a world translates or rewords them by adding the same keys to its own locales/<language>/productionkit_ui.json. What is showing redraws when the player's language changes. Style ids and INFO stay English: they are for the game's author, not its players.

Each family is its own screen (productionKit_welcome, productionKit_queue, productionKit_hud, productionKit_prompt); the HUD, toast, prompt and queue roots take no clicks outside their panels. Clicks arrive through ui.registerCallbackEnv and, on touch screens, through the kit's own tap reading; Screens.handle(id) lets a game route pk: callback ids itself. Called by productionKit's host on the local player's machine.