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

Constructors

  • 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.

Methods

  • Parameters

    • sceneName: string

    Returns boolean

    true when all the resources of the given scene are loaded (but maybe not parsed).

  • Parameters

    • sceneName: string

    Returns boolean

    true when all the resources of the given scene are loaded and parsed.

  • Return true if the specified URL must be loaded with cookies ("credentials") sent to grant access to them.

    Parameters

    • url: string

    Returns boolean

  • 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

  • Parameters

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

          • loadingCount: number
          • totalCount: number

          Returns void

    Returns Promise<void>

  • Load each scene in order.

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

    Returns 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, total) => Promise<void>)
        • (count, total): Promise<void>
        • Parameters

          • count: number
          • total: number

          Returns Promise<void>

    Returns Promise<void>

  • Load the resources that are needed to launch the first scene.

    Parameters

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

          • count: number
          • total: number

          Returns void

    Returns 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, total) => void)
        • (count, total): void
        • Parameters

          • count: number
          • total: number

          Returns void

    Returns Promise<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