Log inGet started
Package

HorseRaceUI.module

Newest version

README.md

HorseRaceUI

The three ターフヴィクトリー screens — start, in-play HUD, result — as plain ui.registerScreen-ready widget trees. RaceDirector is the only caller: it registers HorseRaceUI.SCREEN once and calls ui.updateScreen(SCREEN, tree) whenever its state changes.

The module holds no engine state and no scene code. Each builder is a pure state -> widget tree function, so a tree can also be built from a test with a hand-written state.

local HorseRaceUI = require("HorseRaceUI")

ui.registerScreen(HorseRaceUI.SCREEN, HorseRaceUI.buildStart(state), HorseRaceUI.LAYER)
ui.showScreen(HorseRaceUI.SCREEN)
ui.updateScreen(HorseRaceUI.SCREEN, HorseRaceUI.buildHud(state))   -- on state change

API

MemberWhat it is
HorseRaceUI.SCREEN"horserace" — the screen name the director registers under
HorseRaceUI.LAYER40 — the layer the director registers it on
HorseRaceUI.buildStart(state)title lockup, horse-data card, the four 作戦 cards, START RACE
HorseRaceUI.buildHud(state)rank strip, race clock, camera buttons, stamina, commentary, PLAYER tag
HorseRaceUI.buildResult(state)gold heading, winning time, eight ranked rows, prize, career, run-again

Each returns { type, style, props, children } sized to fill the viewport, with position = "absolute" where the reference places a block. Everything lays out from percentages and flex, so it follows the canvas (ui.canvas()) without relayout code.

Callback ids

The ids are strings on a node's props, delivered to RaceDirector:onCallback(id, data):

idwho emits it
plan:nige plan:senko plan:sashi plan:oikomithe four 作戦 cards on the start screen
startthe crimson START RACE / レースを開始する button
cam:broadcast cam:chase cam:overheadthe 固定 / 追従 / 俯瞰 buttons on the HUD
againthe もう一度レースする button on the result screen

State it reads

buildStart reads plan (which card is lit) and result.career (the career line, when a previous race left one). buildHud reads rows, clock, camera, commentary, stamina, marker, and phase / countdown for the gates-hold numeral. buildResult reads result and tolerates it being nil (the panel then draws its empty state with the run-again button live).

result: { rows, winTime, prize, career = { runs, wins, earnings, best }, won }. rows: eight { place, number, name, colour, gap, time, isPlayer }, leader first. marker: { x, y, on } in screen pixels — the PLAYER tag is placed at it and disappears when on is false.

Look

Deep-navy translucent panels (#0d1b2e family) over the live scene, thin gold rules (#c9a227), cream text (#f4ead7), crimson (#b31528) as the single accent: the selected 作戦, the active camera mode, the winner's row and every primary button. Gold headings and the START RACE lockup are serif (tinos); numerals — the clock, placings and times — are condensed (anton); body text and Japanese are arimo. Japanese glyphs fall back to the engine's CJK face.

The galloping-horse silhouettes, the crown, the camera triangles and the PLAYER tag's triangle are inline svg nodes painted in currentColor.