Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DependUtil

控制资源的依赖列表,这是一个单例, 所有成员能通过 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[]
  • 获取资源直接引用的非原生依赖列表,例如,材质的非原生依赖是 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[]
  • 获取某个已经加载好的资源的所有非原生依赖资源列表,包括间接引用的资源,并保存在数组中返回。 返回的数组将仅保存依赖资源的 uuid。

    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
  • 获取资源的原生依赖,例如 Texture 的原生依赖是图片

    example

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

    Parameters

    • uuid: string

      asset's uuid

    Returns Record<string, any> | null

    native dependency

init

  • init(): void

parse

  • 从序列化数据或资源中提取出依赖列表,并且存储在缓存中。

    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