JoinScreen
Since 0.7
The join screen's controller: owns the readiness, choices and start of one lobby over ctx.players.
joinScreenBehavior is this on an entity.
Signature
export class JoinScreen {
constructor(ctx: Ctx<any, any>, options: JoinScreenOptions = {})
get started(): boolean
get countdown(): number | null
start(): void
slots(): SlotView[]
isReady(number: number): boolean
choiceOf(number: number): string | null
setReady(number: number, ready: boolean): boolean
stepChoice(number: number, step: number): boolean
reset(): void
handle(ev: GameEvent): void
update(dt: number): void
}
Import: import { JoinScreen } from "@argus/gameplay"
Members
| Member | Signature | Description |
|---|---|---|
constructor | constructor(ctx: Ctx<any, any>, options: JoinScreenOptions = {}) | Reads the saved flags from ctx.state; call {@link JoinScreen.start} to put the screen up. |
started | get started(): boolean | True once join-start has been raised; readiness and leaving are ignored from then on. |
countdown | get countdown(): number | null | Seconds left before the start, or null when it is not counting down. |
start | start(): void | Register the screen and put it up. |
slots | slots(): SlotView[] | The seats as the screen shows them, one per slot. |
isReady | isReady(number: number): boolean | Whether player number is marked ready. |
choiceOf | choiceOf(number: number): string | null | The choice player number holds, or null with no choices or no seat. |
setReady | setReady(number: number, ready: boolean): boolean | Mark a seated, connected player ready or not. False when nothing changed. |
stepChoice | stepChoice(number: number, step: number): boolean | Move a player's choice one step round the list (+1/-1); a held choice ignores it while ready. |
reset | reset(): void | Reopen: forget readiness and the start, so the screen can run again. Seats are untouched. |
handle | handle(ev: GameEvent): void | Handle one bus event. |
update | update(dt: number): void | One tick: agree with the seat table, advance the start countdown, write the slots. |