Files
esengine/source/lib/assetsmanager.d.ts

1523 lines
54 KiB
TypeScript
Raw Normal View History

2020-06-08 11:49:45 +08:00
declare namespace RES {
/**
* Version control loading interface
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/version/VersionControl.ts
* @language en_US
*/
/**
*
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/version/VersionControl.ts
* @language zh_CN
*/
interface IVersionController {
/**
* Get the version information data.<br/>
* Before calling this method requires the application of any resource load, we recommend starting at the application entry class (Main) The first call processing. This method is only responsible for acquiring version information, is not responsible for downloaded resources.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* <br/>
* Main
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
init(): Promise<any>;
/**
* Get the actual URL of the resource file.<br/>
* Because this method needs to be called to control the actual version of the URL have the original resource files were changed, so would like to get the specified resource file the actual URL.<br/>
* In the development and debugging phase, this method will directly return value passed.
* @param url Url used in the game
* @returns Actual loaded url
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* URL地址<br/>
* URL进行了改变URL时需要调用此方法<br/>
*
* @param url 使url
* @returns url
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
getVirtualUrl(url: string): string;
}
/**
* Manage version control class
* @version Egret 2.4
* @platform Web,Native
* @event egret.Event.COMPLETE Version control loading is complete when thrown
* @event egret.IOErrorEvent.IO_ERROR Version control failed to load when thrown
* @includeExample extension/version/VersionControl.ts
* @language en_US
*/
/**
*
* @version Egret 2.4
* @platform Web,Native
* @event egret.Event.COMPLETE
* @event egret.IOErrorEvent.IO_ERROR
* @includeExample extension/version/VersionControl.ts
* @language zh_CN
*/
interface VersionController extends IVersionController {
}
/**
* @version Egret 2.4
* @platform Web,Native
*/
let VersionController: {
/**
* Constructor initialization
* @language en_US
*/
/**
*
* @language zh_CN
*/
new (): VersionController;
};
}
declare type ResourceRootSelector<T extends string> = () => T;
declare type ResourceNameSelector = (file: string) => string;
declare type ResourceMergerSelector = (file: string) => {
path: string;
alias: string;
};
declare module RES {
/**
* Get resource information through file path
* @param path file path
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param path
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function getResourceInfo(path: string): File | null;
/**
* @private
*/
interface ResourceInfo {
url: string;
type: string;
root: string;
crc32?: string;
size?: number;
extra?: 1 | undefined;
name: string;
soundType?: string;
scale9grid?: string;
groupNames?: string[];
promise?: Promise<any>;
}
/**
* @private
*/
interface Data {
resourceRoot: string;
mergeSelector: ResourceMergerSelector | null;
fileSystem: FileSystem;
groups: {
[groupName: string]: string[];
};
alias: {
[aliasName: string]: string;
};
loadGroup: string[];
}
/**
* @class RES.ResourceConfig
* @classdesc
* @private
*/
class ResourceConfig {
config: Data;
constructor();
init(): Promise<any>;
/**
*
* @method RES.ResourceConfig#getGroupByName
* @param name {string}
* @returns {Array<egret.ResourceItem>}
*/
getGroupByName(name: string): ResourceInfo[];
__temp__get__type__via__url(url_or_alias: string): string;
getResourceWithSubkey(key: string): {
r: ResourceInfo;
key: string;
subkey: string;
} | null;
getKeyByAlias(aliasName: string): string;
getResource(path_or_alias: string): ResourceInfo | null;
/**
* ,
* ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成
* @method RES.ResourceConfig#createGroup
* @param name {string}
* @param keys {egret.Array<string>} key对应配置文件里的name属性或sbuKeys属性的一项或一个资源组名
* @param override {boolean} ,false
* @returns {boolean}
*/
createGroup(name: string, keys: Array<string>, override?: boolean): boolean;
/**
*
* @method RES.ResourceConfig#addSubkey
* @param subkey {string}
* @param name {string} name属性
*/
addSubkey(subkey: string, name: string): void;
addAlias(alias: any, key: any): void;
addResourceData(data: {
name: string;
type: string;
url: string;
root?: string;
extra?: 1 | undefined;
}): void;
removeResourceData(data: {
name: string;
type?: string;
url: string;
root?: string;
extra?: 1 | undefined;
}): void;
}
}
declare module RES {
/**
* @class RES.ResourceLoader
* @classdesc
* @private
*/
class ResourceLoader {
/**
* ,key为groupName
*/
private groupTotalDic;
/**
* ,key为groupName
*/
private numLoadedDic;
/**
* ,key为groupName
*/
private groupErrorDic;
private retryTimesDic;
maxRetryTimes: number;
private reporterDic;
private dispatcherDic;
private failedList;
private loadItemErrorDic;
private errorDic;
/**
* key为资源value为优先级
*/
private itemListPriorityDic;
/**
*
*/
private itemLoadDic;
private promiseHash;
/**
* ,getResByUrl ,getResAsync等方法存储队列
*/
private lazyLoadList;
pushResItem(resInfo: ResourceInfo): Promise<any>;
/**
* ,
*/
pushResGroup(list: ResourceInfo[], groupName: string, priority: number, reporter?: PromiseTaskReporter): Promise<any>;
/**
*
* @param list
* @param priority
*/
private updatelistPriority(list, priority);
/**
*
* @param item
*/
private findPriorityInDic(item);
private loadingCount;
/**
* 线
*/
thread: number;
/**
* 线
*/
private loadNextResource();
/**
*
*/
private loadSingleResource();
/**
*
*/
private getOneResourceInfoInGroup();
/**
*
* @param groupName
* @param r
*/
private setGroupProgress(groupName, r);
/**
*
* @param groupName
* @param lastError
*/
private loadGroupEnd(groupName, lastError?);
/**
* Promise的缓存
* @param groupName root+name
*/
private deleteDispatcher(groupName);
/**
*
* @param r
* @param p
*/
private loadResource(r, p?);
/**
*
* @param r
*/
unloadResource(r: ResourceInfo): boolean;
}
}
declare module RES {
}
declare module RES {
type GetResAsyncCallback = (value?: any, key?: string) => any;
/**
* Convert the file name of the resource to the Key value used in the project.
* @param url Resource Name.
* @returns The key value used in the project
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* 使Key值
* 使A_jsonA_png
* 使key和文件对应的需要修改
* @param url
* @returns key值
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function nameSelector(url: any): string;
/**
* Get the read type of the file.
* When using getResByUrl does not specify the type of the read file, it will find the corresponding type according to this method.
* File types not found are loaded by default in binary format
* @param path file path.
* @returns Processor type used to read the file
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* 使getResByUrl没有指定读取文件的类型
*
* @param path
* @returns Processor类型
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function typeSelector(path: string): string;
/**
* Conduct mapping injection with class definition as the value, Deprecated.
* @deprecated
* @see RES.processor.map
* @language en_US
*/
/**
*
* @deprecated
* @see RES.processor.map
* @language zh_CN
*/
function registerAnalyzer(type: string, analyzerClass: any): void;
/**
* Set whether it is compatible mode
* When the value is true, the assetsManager will output the design of Res. When it is false, all the loaded resources will be returned as promises.
* The default is false, run in strict assetsManager mode
* @version Egret 5.2.9
* @platform Web,Native
* @language en_US
*/
/**
*
* true时assetsManager会以Res的设计输出false时候promise的方式返回
* falseassetsManager方式运行
* @version Egret 5.2.9
* @platform Web,Native
* @language zh_CN
*/
function setIsCompatible(value: boolean): void;
/**
* Load configuration file and parse.
* @param url The url address of the resource config
* @param resourceRoot The root address of the resource config
* @returns Promise
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param url url地址
* @param resourceRoot
* @returns Promise
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function loadConfig(url: string, resourceRoot: string): Promise<void>;
/**
* Load a set of resources according to the group name.
* @param name Group name to load the resource group.
* @param priority Load priority can be negative, the default value is 0.
* <br>A low priority group must wait for the high priority group to complete the end of the load to start, and the same priority group will be loaded at the same time.
* @param reporter Resource group loading progress prompt
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param name
* @param priority ,, 0
* <br>
* @param reporter
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function loadGroup(name: string, priority?: number, reporter?: PromiseTaskReporter): Promise<void>;
/**
* Check whether a resource group has been loaded.
* @param name Group name
* @returns Is loading or not.
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param name
* @returns
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function isGroupLoaded(name: string): boolean;
/**
* A list of groups of loading is obtained according to the group name.
* @param name Group name.
* @returns The resource item array of group.
* @see RES.ResourceItem
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param name
* @returns
* @see RES.ResourceItem
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function getGroupByName(name: string): Array<ResourceItem>;
/**
* Create a custom load resource group, note that this method is valid only after the resource configuration file is loaded.
* <br>You can monitor the ResourceEvent.CONFIG_COMPLETE event to verify that the configuration is complete.
* @param name Group name to create the load resource group.
* @param keys To be included in the list of key keys, the corresponding configuration file in the name or sbuKeys property one or a resource group name.
* @param override Is the default false for the same name resource group already exists.
* @returns Create success or fail.
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* ,
* <br> ResourceEvent.CONFIG_COMPLETE
* @param name
* @param keys key name sbuKeys
* @param override , false
* @returns
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function createGroup(name: string, keys: Array<string>, override?: boolean): boolean;
/**
* Check whether the configuration file contains the specified resources.
* @param key A sbuKeys attribute or name property in a configuration file.
* @returns Whether you have the specified resource
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param key name sbuKeys
* @returns
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function hasRes(key: string): boolean;
/**
* The synchronization method for obtaining the cache has been loaded with the success of the resource.
* <br>The type of resource and the corresponding return value types are as follows:
* <br>RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript primary object
* <br>RES.ResourceItem.TYPE_IMAGE : img Html Objector egret.BitmapData interface
* <br>RES.ResourceItem.TYPE_JSON : Object
* <br>RES.ResourceItem.TYPE_SHEET : Object
* <br> 1. If the incoming parameter is the name of the entire SpriteSheet is returned is {image1: Texture, "image2": Texture}.
* <br> 2. If the incoming is "sheet.image1", the return is a single resource.
* <br> 3. If the incoming is the name of the "image1" single resource, the return is a single resource.
* But if there are two SpriteSheet in a single picture of the same name, the return of the image after the load.
* <br>RES.ResourceItem.TYPE_SOUND : HtmlSound Html Object
* <br>RES.ResourceItem.TYPE_TEXT : string
* @param key A subKeys attribute or name property in a configuration file.
* @see RES.ResourceItem
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* <br>
* <br>RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript
* <br>RES.ResourceItem.TYPE_IMAGE : img Html egret.BitmapData
* <br>RES.ResourceItem.TYPE_JSON : Object
* <br>RES.ResourceItem.TYPE_SHEET : Object
* <br> 1. SpriteSheet {"image1":Texture,"image2":Texture}
* <br> 2. "sheet.image1"
* <br> 3. "image1" SpriteSheet
* <br>RES.ResourceItem.TYPE_SOUND : HtmlSound Html
* <br>RES.ResourceItem.TYPE_TEXT : string
* @param key name subKeys
* @see RES.ResourceItem
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function getRes(key: string): any;
/**
* Asynchronous mode to get the resources in the configuration. As long as the resources exist in the configuration file, you can get it in an asynchronous way.
* @param key A sbuKeys attribute or name property in a configuration file.
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param key name sbuKeys
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function getResAsync(key: string): Promise<any>;
/**
* Asynchronous mode to get the resources in the configuration. As long as the resources exist in the configuration file, you can get it in an asynchronous way.
* @param key A sbuKeys attribute or name property in a configuration file.
* @param compFunc Call back function. ExamplecompFunc(data,key):void.
* @param thisObject This pointer of call back function.
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param key name sbuKeys
* @param compFunc compFunc(data,key):void
* @param thisObject this
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function getResAsync(key: string, compFunc: GetResAsyncCallback, thisObject: any): Promise<any> | void;
/**
* Access to external resources through the full URL.
* @param url The external path to load the file.
* @param compFunc Call back function. ExamplecompFunc(data,url):void
* @param thisObject This pointer of call back function.
* @param type File type (optional). Use the static constants defined in the ResourceItem class. If you do not set the file name extension.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* URL方式获取外部资源
* @param url
* @param compFunc compFunc(data,url):void
* @param thisObject this
* @param type ()使 ResourceItem
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function getResByUrl(url: string, compFunc?: Function, thisObject?: any, type?: string): Promise<any>;
/**
* Destroy a single resource file or a set of resources to the cache data, to return whether to delete success.
* @param name Name attribute or resource group name of the load item in the configuration file.
* @param force Destruction of a resource group when the other resources groups have the same resource situation whether the resources will be deleted, the default value true.
* @returns Are successful destruction.
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* ,
* @param name name属性或资源组名
* @param force true
* @see #setMaxRetryTimes
* @returns
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function destroyRes(name: string, force?: boolean): boolean;
/**
* Sets the maximum number of concurrent load threads, the default value is 4.
* @param thread The number of concurrent loads to be set.
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* 线 4
* @param thread
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function setMaxLoadingThread(thread: number): void;
/**
* Sets the number of retry times when the resource failed to load, and the default value is 3.
* @param retry To set the retry count.
* @includeExample extension/resource/Resource.ts
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* 3
* @param retry
* @includeExample extension/resource/Resource.ts
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function setMaxRetryTimes(retry: number): void;
/**
* Add event listeners, reference ResourceEvent defined constants.
* @param type Event name
* @param listener Listener functions for handling events. This function must accept the Event object as its only parameter, and can't return any results,
* As shown in the following example: function (evt:Event):void can have any name.
* @param thisObject The this object that is bound to a function.
* @param useCapture Determine the listener is running on the capture or running on the target and the bubbling phase. Set useCapture to true,
* then the listener in the capture phase processing events, but not in the target or the bubbling phase processing events.
* If useCapture is false, then the listener only in the target or the bubbling phase processing events.
* To listen for events in all three stages, please call addEventListener two times: once the useCapture is set to true, once the useCapture is set to false.
* @param priority Event listener priority. Priority is specified by a 32 - bit integer with a symbol. The higher the number, the higher the priority.
* All listeners with a priority for n will be processed before the -1 n listener.
* If two or more listeners share the same priority, they are processed in accordance with the order of their added. The default priority is 0.
* @see RES.ResourceEvent
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* , ResourceEvent
* @param type
* @param listener Event
* function(evt:Event):void
* @param thisObject this
* @param useCapture useCapture true
* useCapture false
* addEventListener useCapture true useCapture false
* @param priority 32 n
* n -1 0
* @see RES.ResourceEvent
* @see #setMaxRetryTimes
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function addEventListener(type: string, listener: (event: egret.Event) => void, thisObject: any, useCapture?: boolean, priority?: number): void;
/**
* Remove event listeners, reference ResourceEvent defined constants.
* @param type Event name
* @param listener Listening function
* @param thisObject The this object that is bound to a function.
* @param useCapture Is used to capture, and this property is only valid in the display list.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* ,ResourceEvent定义的常量
* @param type
* @param listener
* @param thisObject this对象
* @param useCapture 使
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function removeEventListener(type: string, listener: (event: egret.Event) => void, thisObject: any, useCapture?: boolean): void;
/**
* Adding a custom resource configuration.
* @param data To add configuration.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param data
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function $addResourceData(data: {
name: string;
type: string;
url: string;
}): void;
/**
* Returns the VersionController
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* .
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function getVersionController(): VersionController;
/**
* Register the VersionController
* @param vcs The VersionController to register.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* ,RES模块加载资源时会从版本控制器获取真实url
* @param vcs
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function registerVersionController(vcs: VersionController): void;
/**
* Convert the address of the loaded resource (via version controller conversion)
* @param url path to the original resource
* @returns converted address
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param url
* @returns
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function getVirtualUrl(url: any): any;
/**
* @private
*/
class Resource extends egret.EventDispatcher {
vcs: VersionController;
isVcsInit: boolean;
constructor();
registerVersionController(vcs: VersionController): void;
/**
*
* @method RES.loadConfig
*/
loadConfig(): Promise<void>;
/**
* @private
*
*/
private normalLoadConfig;
/**
*
* @method RES.isGroupLoaded
* @param name {string}
*/
isGroupLoaded(name: string): boolean;
/**
*
* @method RES.getGroupByName
* @param name {string}
*/
getGroupByName(name: string): Array<ResourceInfo>;
/**
*
* @method RES.loadGroup
* @param name {string}
* @param priority {number}
*/
loadGroup(name: string, priority?: number, reporter?: PromiseTaskReporter): Promise<any>;
private _loadGroup(name, priority?, reporter?);
/**
* ,
* ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成
* @method RES.ResourceConfig#createGroup
* @param name {string}
* @param keys {egret.Array<string>} key对应配置文件里的name属性或一个资源组名
* @param override {boolean} ,false
* @returns {boolean}
*/
createGroup(name: string, keys: Array<string>, override?: boolean): boolean;
/**
*
* @method RES.hasRes
* @param key {string} name属性或subKeys属性的一项
* @returns {boolean}
*/
hasRes(key: string): boolean;
/**
* key同步获取资源
* @method RES.getRes
* @param key {string}
* @returns {any}
*/
getRes(resKey: string): any;
/**
* key异步获取资源
* @method RES.getResAsync
* @param key {string}
* @param compFunc {Function} compFunc(data,url):void
* @param thisObject {any}
*/
getResAsync(key: string): Promise<any>;
getResAsync(key: string, compFunc: GetResAsyncCallback, thisObject: any): Promise<any>;
/**
* url获取资源
* @method RES.getResByUrl
* @param url {string}
* @param compFunc {Function}
* @param thisObject {any}
* @param type {string}
*/
getResByUrl(url: string, compFunc?: Function, thisObject?: any, type?: string): Promise<any>;
/**
* ,
* @method RES.destroyRes
* @param name {string} name属性或资源组名
* @param force {boolean} true
* @returns {boolean}
*/
destroyRes(name: string, force?: boolean): boolean;
/**
* 线4.
* @method RES.setMaxLoadingThread
* @param thread {number}
*/
setMaxLoadingThread(thread: number): void;
/**
*
* @param retry
*/
setMaxRetryTimes(retry: number): void;
addResourceData(data: {
name: string;
type: string;
url: string;
}): void;
}
}
declare namespace RES {
/**
* Print the memory occupied by the picture.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* C:/A/B/C/D/example.ts
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
namespace path {
/**
* Format the file path,"C:/A/B//C//D//example.ts"=>"C:/A/B/C/D/example.ts"
* @param filename Incoming file path
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* "C:/A/B//C//D//example.ts"=>"C:/A/B/C/D/example.ts"
* @param filename
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function normalize(filename: string): string;
/**
* Get the file name according to the file path, "C:/A/B/example.ts"=>"example.ts"
* @param filename Incoming file path
* @return File name
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* "C:/A/B/example.ts"=>"example.ts"
* @param filename
* @return
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function basename(filename: string): string;
/**
* The path to the folder where the file is located,"C:/A/B/example.ts"=>"C:/A/B"
* @param filename Incoming file path
* @return The address of the folder where the file is located
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* "C:/A/B/example.ts"=>"C:/A/B"
* @param filename
* @return
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function dirname(path: string): string;
}
}
declare namespace RES {
/**
* @private
*/
class NativeVersionController implements IVersionController {
private versionInfo;
init(): Promise<void>;
getVirtualUrl(url: string): string;
private getLocalData(filePath);
}
}
declare module RES.processor {
interface Processor {
/**
* Start loading a single resource
* @param host Load the processor, you can use the processor to load resources, directly use http to get the resources back
* @param resource Resource information
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param host 使http获取资源返回即可
* @param resource
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
onLoadStart(host: ProcessHost, resource: ResourceInfo): Promise<any>;
/**
* Remove a single resource, usually call host.unload (resource);
* @param host Load the processor
* @param resource Resource information
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* host.unload(resource);
* @param host
* @param resource
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
onRemoveStart(host: ProcessHost, resource: ResourceInfo): void;
/**
* Get the submap of the merged atlas
* @param host Load the processor
* @param resource Resource information
* @param key The key value of the resource
* @param subkey Collection of subset names
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param host
* @param resource
* @param key key值
* @param subkey
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
getData?(host: ProcessHost, resource: ResourceInfo, key: string, subkey: string): any;
}
/**
* Register the processor that loads the resource
* @param type Load resource type
* @param processor Loaded processor, an instance that implements the Processor interface
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param type
* @param processor Processor接口的实例
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function map(type: string, processor: Processor): void;
/**
* @private
* @param url
* @param file
*/
function getRelativePath(url: string, file: string): string;
var ImageProcessor: Processor;
const KTXTextureProcessor: RES.processor.Processor;
/**
*
*/
function makeEtc1SeperatedAlphaResourceInfo(resource: ResourceInfo): ResourceInfo;
/**
*
*/
const ETC1KTXProcessor: Processor;
var BinaryProcessor: Processor;
var TextProcessor: Processor;
var JsonProcessor: Processor;
var SoundProcessor: Processor;
}
declare module RES {
/**
* The events of resource loading.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
class ResourceEvent extends egret.Event {
/**
* Failure event for a load item.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
static ITEM_LOAD_ERROR: string;
/**
* Configure file to load and parse the completion event. Note: if a configuration file is loaded, it will not be thrown out, and if you want to handle the configuration loading failure, monitor the CONFIG_LOAD_ERROR event.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* CONFIG_LOAD_ERROR
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
static CONFIG_COMPLETE: string;
/**
* Configuration file failed to load.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
static CONFIG_LOAD_ERROR: string;
/**
* Delay load group resource loading progress event.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
static GROUP_PROGRESS: string;
/**
* Delay load group resource to complete event. Note: if you have a resource item loading failure, the event will not be thrown, if you want to handle the group load failure, please listen to the GROUP_LOAD_ERROR event.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* GROUP_LOAD_ERROR
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
static GROUP_COMPLETE: string;
/**
* Delayed load group resource failed event.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
static GROUP_LOAD_ERROR: string;
/**
* Creates an Event object to pass as a parameter to event listeners.
* @param type The type of the event, accessible as Event.type.
* @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
* @param cancelable Determines whether the Event object can be canceled. The default values is false.
* @version Egret 5.2
* @platform Web,Native
* @private
* @language en_US
*/
/**
* Event
* @param type Event.type 访
* @param bubbles Event false
* @param cancelable Event false
* @version Egret 5.2
* @platform Web,Native
* @private
* @language zh_CN
*/
constructor(type: string, bubbles?: boolean, cancelable?: boolean);
/**
* File number that has been loaded.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
itemsLoaded: number;
/**
* Total file number to load.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
itemsTotal: number;
/**
* Resource group name.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
groupName: string;
/**
* An item of information that is finished by the end of a load.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
resItem: ResourceItem;
}
}
declare module RES {
/**
* Resource term. One of the resources arrays in resource.json.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* resource.json resources
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
namespace ResourceItem {
/**
* XML file.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* XML
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
const TYPE_XML: string;
/**
* Picture file.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
const TYPE_IMAGE: string;
/**
* Binary file.
* @version Egret 5.2
* @platform Web
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web
* @language zh_CN
*/
const TYPE_BIN: string;
/**
* Text file.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
const TYPE_TEXT: string;
/**
* JSON file.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* JSON
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
const TYPE_JSON: string;
/**
* SpriteSheet file.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* SpriteSheet
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
const TYPE_SHEET: string;
/**
* BitmapTextSpriteSheet file.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* BitmapTextSpriteSheet
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
const TYPE_FONT: string;
/**
* Sound file.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
const TYPE_SOUND: string;
function convertToResItem(r: ResourceInfo): ResourceItem;
}
interface ResourceItem extends ResourceInfo {
/**
* Name of resource term.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
name: string;
/**
* URL of resource term.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
url: string;
/**
* Type of resource term.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
type: string;
/**
* The raw data object to be referenced.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
data: ResourceInfo;
crc32?: string;
size?: number;
soundType?: string;
}
}
declare module RES {
/**
* assetsManager underlying storage resource information
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
* assetsManager底层存储资源信息
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
interface File {
url: string;
type: string;
name: string;
root: string;
}
/**
* @private
*/
interface FileSystem {
addFile(data: {
name: string;
type: string;
url: string;
root?: string;
extra?: 1 | undefined;
}): any;
getFile(filename: string): File | null;
profile(): void;
removeFile(filename: string): any;
}
}
declare module RES {
/**
* Print the memory occupied by the picture.
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
function profile(): void;
/**
* @private
*/
interface ProcessHost {
state: {
[index: string]: number;
};
resourceConfig: ResourceConfig;
load: (resource: ResourceInfo, processor?: string | processor.Processor) => Promise<any>;
unload: (resource: ResourceInfo) => void;
save: (rexource: ResourceInfo, data: any) => void;
get: (resource: ResourceInfo) => any;
remove: (resource: ResourceInfo) => void;
}
/**
* @private
*/
class ResourceManagerError extends Error {
static errorMessage: {
1001: string;
1002: string;
2001: string;
2002: string;
2003: string;
2004: string;
2005: string;
2006: string;
};
/**
* why instanceof e != ResourceManagerError ???
* see link : https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
*/
private __resource_manager_error__;
constructor(code: number, replacer?: Object, replacer2?: Object);
}
}
declare namespace RES {
/**
* Resource group loading progress prompt
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
interface PromiseTaskReporter {
/**
* Progress callback, asynchronous execution, load number and order have nothing to do
* @param current The number of currently loaded
* @param total Total resources required in the current resource bundle
* @param resItem currently loading resource information
* @version Egret 5.2
* @platform Web,Native
* @language en_US
*/
/**
*
* @param current
* @param total
* @param resItem
* @version Egret 5.2
* @platform Web,Native
* @language zh_CN
*/
onProgress?(current: number, total: number, resItem: ResourceInfo | undefined): void;
}
}