Options
All
  • Public
  • Public/Protected
  • All
Menu

Pre-load resources of any kind needed for a game or a scene.

Hierarchy

  • ResourceLoader

Index

Methods

  • areSceneAssetsLoaded(sceneName: string): boolean
  • areSceneAssetsReady(sceneName: string): boolean
  • checkIfCredentialsRequired(url: string): boolean
  • Return true if the specified URL must be loaded with cookies ("credentials") sent to grant access to them.

    Parameters

    • url: string

    Returns boolean

  • dispose(): void
  • getFullUrl(url: string): string
  • Complete the given URL with any specific parameter required to access the resource (this can be for example a token needed to access the resource).

    Parameters

    • url: string

    Returns string

  • getResource(resourceName: string): null | ResourceData
  • getSceneLoadingProgress(sceneName: string): number
  • loadAllResources(onProgress: (loadingCount: number, totalCount: number) => void): Promise<void>
  • Parameters

    • onProgress: (loadingCount: number, totalCount: number) => void
        • (loadingCount: number, totalCount: number): void
        • Parameters

          • loadingCount: number
          • totalCount: number

          Returns void

    Returns Promise<void>

  • loadAllSceneInBackground(): Promise<void>
  • Load each scene in order.

    This is done in background to try to avoid loading screens when changing scenes.

    Returns Promise<void>

  • loadAndProcessSceneResources(sceneName: string, onProgress?: (count: number, total: number) => Promise<void>): Promise<void>
  • Load and process a scene that is needed right away.

    The renderer will show a loading screen while its done.

    Parameters

    • sceneName: string
    • Optional onProgress: (count: number, total: number) => Promise<void>
        • (count: number, total: number): Promise<void>
        • Parameters

          • count: number
          • total: number

          Returns Promise<void>

    Returns Promise<void>

  • loadGlobalAndFirstSceneResources(firstSceneName: string, onProgress: (count: number, total: number) => void): Promise<void>
  • Load the resources that are needed to launch the first scene.

    Parameters

    • firstSceneName: string
    • onProgress: (count: number, total: number) => void
        • (count: number, total: number): void
        • Parameters

          • count: number
          • total: number

          Returns void

    Returns Promise<void>

  • loadSceneResources(sceneName: string, onProgress?: (count: number, total: number) => void): Promise<void>
  • Load a scene resources without parsing them.

    When another scene resources are loading in background, it waits for all its resources to be loaded before loading resources of the given scene.

    Parameters

    • sceneName: string
    • Optional onProgress: (count: number, total: number) => void
        • (count: number, total: number): void
        • Parameters

          • count: number
          • total: number

          Returns void

    Returns Promise<void>

  • setResources(resourceDataArray: ResourceData[], globalResources: string[], layoutDataArray: LayoutData[]): void
  • Update the resources data of the game. Useful for hot-reloading, should not be used otherwise.

    Parameters

    • resourceDataArray: ResourceData[]
    • globalResources: string[]
    • layoutDataArray: LayoutData[]

    Returns void

Constructors

  • new ResourceLoader(runtimeGame: RuntimeGame, resourceDataArray: ResourceData[], globalResources: string[], layoutDataArray: LayoutData[]): ResourceLoader
  • Parameters

    • runtimeGame: RuntimeGame

      The game.

    • resourceDataArray: ResourceData[]

      The resources data of the game.

    • globalResources: string[]

      The resources needed for any layer.

    • layoutDataArray: LayoutData[]

      The resources used by each layer.

    Returns ResourceLoader

Properties

currentLoadingSceneName: string = ''

Only used by events.

currentSceneLoadingProgress: number = 0

Only used by events.

Generated using TypeDoc