Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DependUtil

Control asset's dependency list, it is a singleton. All member can be accessed with cc.assetManager.dependUtil

Hierarchy

  • DependUtil

Index

Properties

_depends

_depends: Cache<IDependencies> = new Cache<IDependencies>()

Methods

Private descend

  • descend(uuid: string, exclude: Record<string, any>, depends: string[]): void

Private parseDepsFromAsset

Private parseDepsFromJson

  • parseDepsFromJson(json: any[]): string[]

getDeps

  • getDeps(uuid: string): string[]
  • Get asset's direct referencing non-native dependency list. For example, Material's non-native dependencies are Texture.

    example

    var deps = dependUtil.getDeps('fcmR3XADNLgJ1ByKhqcC5Z');

    Parameters

    • uuid: string

      asset's uuid

    Returns string[]

    direct referencing non-native dependency list

getDepsRecursively

  • getDepsRecursively(uuid: string): string[]
  • Get non-native dependency list of the loaded asset, include indirect reference. The returned array stores the dependencies with their uuid, after retrieve dependencies,

    example

    var deps = dependUtil.getDepsRecursively('fcmR3XADNLgJ1ByKhqcC5Z');

    Parameters

    • uuid: string

      The asset's uuid

    Returns string[]

    non-native dependency list

getNativeDep

  • getNativeDep(uuid: string): Record<string, any> | null
  • Get asset's native dependency. For example, Texture's native dependency is image.

    example

    var dep = dependUtil.getNativeDep('fcmR3XADNLgJ1ByKhqcC5Z');

    Parameters

    • uuid: string

      asset's uuid

    Returns Record<string, any> | null

    native dependency

init

  • init(): void

parse

  • Extract dependency list from serialized data or asset and then store in cache.

    example

    downloader.downloadFile('test.json', { xhrResponseType: 'json'}, null, (err, file) => { var dependencies = parse('fcmR3XADNLgJ1ByKhqcC5Z', file); });

    Parameters

    • uuid: string

      The uuid of serialized data or asset

    • json: any

      Serialized data or asset

    Returns IDependencies

    dependency list, include non-native and native dependency

remove

  • remove(uuid: string): void

Generated using TypeDoc