Options
All
  • Public
  • Public/Protected
  • All
Menu

A Tour that shows a series of guided steps.

param config

The configuration of the Tour

tutorial

tours

Hierarchy

Index

Constructors

  • new Tour(config: any, __namedParameters?: { id: any; namespace: any }): Tour
  • Parameters

    • config: any
    • __namedParameters: { id: any; namespace: any } = {}
      • id: any
      • namespace: any

    Returns Tour

Properties

config: TourConfig
targetElement: HTMLElement

The HTMLElement which is the focus of the current tour step.

fadeElement: HTMLElement

The HTMLElement that fades out the rest of the screen

overlayElement: any

The HTMLElement that blocks input while a Tour is active

#id: any
#namespace: any
#stepIndex: number = -1
STATUS: { UNSTARTED: string; IN_PROGRESS: string; COMPLETED: string } = ...

Type declaration

  • UNSTARTED: string
  • IN_PROGRESS: string
  • COMPLETED: string
HIGHLIGHT_PADDING: number = 10

Padding around a Highlighted Element

#activeTour: Tour = null

A singleton reference which tracks the currently active Tour.

Accessors

  • get id(): string
  • set id(value: string): void
  • The unique identifier of the tour.

    Returns string

  • The unique identifier of the tour.

    Parameters

    • value: string

    Returns void

  • get title(): string
  • The human-readable title for the tour.

    Returns string

  • get description(): string
  • The human-readable description of the tour.

    Returns string

  • get namespace(): string
  • set namespace(value: string): void
  • The package namespace for the tour.

    Returns string

  • The package namespace for the tour.

    Parameters

    • value: string

    Returns void

  • get key(): string
  • The key the Tour is stored under in game.tours, of the form ${namespace}.${id}

    Returns string

  • The configuration of tour steps

    Returns TourStep[]

  • Return the current Step, or null if the tour has not yet started.

    Returns TourStep

  • get stepIndex(): number
  • The index of the current step; -1 if the tour has not yet started, or null if the tour is finished.

    Returns number

  • get hasNext(): boolean
  • Returns True if there is a next TourStep

    Returns boolean

  • get hasPrevious(): boolean
  • Returns True if there is a previous TourStep

    Returns boolean

  • get canStart(): boolean
  • Return whether this Tour is currently eligible to be started? This is useful for tours which can only be used in certain circumstances, like if the canvas is active.

    Returns boolean

  • get status(): string
  • The current status of the Tour

    Returns string

  • get tourInProgress(): boolean
  • Indicates if a Tour is currently in progress.

    Returns boolean

  • get activeTour(): Tour
  • Returns the active Tour, if any

    Returns Tour

Methods

  • complete(): Promise<any>
  • Advance the tour to a completed state.

    Returns Promise<any>

  • exit(): void
  • Exit the tour at the current step.

    Returns void

  • reset(): Promise<any>
  • Reset the Tour to an un-started state.

    Returns Promise<any>

  • start(): Promise<any>
  • Start the Tour at its current step, or at the beginning if the tour has not yet been started.

    Returns Promise<any>

  • next(): Promise<any>
  • Progress the Tour to the next step.

    Returns Promise<any>

  • previous(): Promise<any>
  • Rewind the Tour to the previous step.

    Returns Promise<any>

  • progress(stepIndex: number): Promise<any>
  • Progresses to a given Step

    Parameters

    • stepIndex: number

      The step to progress to

    Returns Promise<any>

  • _reloadProgress(): void
  • Reloads the Tour's current step from the saved progress

    internal

    Returns void

  • _getTargetElement(selector: string): Element
  • Query the DOM for the target element using the provided selector

    Parameters

    • selector: string

      A CSS selector

    Returns Element

    The target element, or null if not found

  • _preStep(): Promise<void>
  • Set-up operations performed before a step is shown.

    abstract

    Returns Promise<void>

  • _postStep(): Promise<void>
  • Clean-up operations performed after a step is completed.

    abstract

    Returns Promise<void>

  • _renderStep(): Promise<void>
  • Renders the current Step of the Tour

    Returns Promise<void>

  • _onButtonClick(event: Event, buttons: HTMLElement[]): void | Promise<any>
  • Handle Tour Button clicks

    Parameters

    • event: Event

      A click event

    • buttons: HTMLElement[]

      The step buttons

    Returns void | Promise<any>

  • _saveProgress(): void
  • Saves the current progress of the Tour to a world setting

    Returns void

  • _loadProgress(): number
  • Returns the User's current progress of this Tour

    Returns number

  • onMovementAction(movementDirections: string[]): boolean
  • Handle a movement action to either progress or regress the Tour.

    Parameters

    • movementDirections: string[]

    Returns boolean

  • fromJSON(filepath: string): Promise<Tour>
  • Creates and returns a Tour by loading a JSON file

    Parameters

    • filepath: string

      The path to the JSON file

    Returns Promise<Tour>