Talos docs

JoinScreen

Since 0.7

The join screen's controller: owns the readiness, choices and start of one lobby over ctx.players.

Plain text

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

MemberSignatureDescription
constructorconstructor(ctx: Ctx<any, any>, options: JoinScreenOptions = {})Reads the saved flags from ctx.state; call {@link JoinScreen.start} to put the screen up.
startedget started(): booleanTrue once join-start has been raised; readiness and leaving are ignored from then on.
countdownget countdown(): number | nullSeconds left before the start, or null when it is not counting down.
startstart(): voidRegister the screen and put it up.
slotsslots(): SlotView[]The seats as the screen shows them, one per slot.
isReadyisReady(number: number): booleanWhether player number is marked ready.
choiceOfchoiceOf(number: number): string | nullThe choice player number holds, or null with no choices or no seat.
setReadysetReady(number: number, ready: boolean): booleanMark a seated, connected player ready or not. False when nothing changed.
stepChoicestepChoice(number: number, step: number): booleanMove a player's choice one step round the list (+1/-1); a held choice ignores it while ready.
resetreset(): voidReopen: forget readiness and the start, so the screen can run again. Seats are untouched.
handlehandle(ev: GameEvent): voidHandle one bus event.
updateupdate(dt: number): voidOne tick: agree with the seat table, advance the start countdown, write the slots.