美素佳儿 litter wizard小游戏
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469
  1. declare namespace RES {
  2. /**
  3. * @classic
  4. * @private
  5. */
  6. class AnalyzerBase extends egret.HashObject {
  7. constructor();
  8. private resourceConfig;
  9. /**
  10. * 添加一个二级键名到配置列表。
  11. * @method RES.ResourceConfig#addSubkey
  12. * @param subkey {string} 要添加的二级键名
  13. * @param name {string} 二级键名所属的资源name属性
  14. */
  15. addSubkey(subkey: string, name: string): void;
  16. /**
  17. * 加载一个资源文件
  18. * @param resItem 加载项信息
  19. * @param compFunc 加载完成回调函数,示例:compFunc(resItem:ResourceItem):void;
  20. * @param thisObject 加载完成回调函数的this引用
  21. */
  22. loadFile(resItem: ResourceItem, compFunc: Function, thisObject: any): void;
  23. /**
  24. * 同步方式获取解析完成的数据
  25. * @param name 对应配置文件里的name属性。
  26. */
  27. getRes(name: string): any;
  28. /**
  29. * 销毁某个资源文件的二进制数据,返回是否删除成功。
  30. * @param name 配置文件中加载项的name属性
  31. */
  32. destroyRes(name: string): boolean;
  33. /**
  34. * 读取一个字符串里第一个点之前的内容。
  35. * @param name {string} 要读取的字符串
  36. */
  37. static getStringPrefix(name: string): string;
  38. /**
  39. * 读取一个字符串里第一个点之后的内容。
  40. * @param name {string} 要读取的字符串
  41. */
  42. static getStringTail(name: string): string;
  43. }
  44. }
  45. declare namespace RES {
  46. /**
  47. * @private
  48. */
  49. class BinAnalyzer extends AnalyzerBase {
  50. /**
  51. * 构造函数
  52. */
  53. constructor();
  54. /**
  55. * 字节流数据缓存字典
  56. */
  57. fileDic: any;
  58. /**
  59. * 加载项字典
  60. */
  61. resItemDic: any[];
  62. /**
  63. * @inheritDoc
  64. */
  65. loadFile(resItem: ResourceItem, compFunc: Function, thisObject: any): void;
  66. _dataFormat: string;
  67. /**
  68. * Loader对象池
  69. */
  70. protected recycler: egret.HttpRequest[];
  71. /**
  72. * 获取一个URLLoader对象
  73. */
  74. private getRequest();
  75. /**
  76. * 一项加载结束
  77. */
  78. onLoadFinish(event: egret.Event): void;
  79. /**
  80. * 解析并缓存加载成功的数据
  81. */
  82. analyzeData(resItem: ResourceItem, data: any): void;
  83. /**
  84. * @inheritDoc
  85. */
  86. getRes(name: string): any;
  87. /**
  88. * @inheritDoc
  89. */
  90. hasRes(name: string): boolean;
  91. /**
  92. * @inheritDoc
  93. */
  94. destroyRes(name: string): boolean;
  95. protected onResourceDestroy(resource: any): void;
  96. }
  97. }
  98. declare namespace RES {
  99. /**
  100. * @language en_US
  101. * Resource term. One of the resources arrays in resource.json.
  102. * @version Egret 2.4
  103. * @platform Web,Native
  104. */
  105. /**
  106. * @language zh_CN
  107. * 资源项。对应 resource.json 中 resources 数组中的一项。
  108. * @version Egret 2.4
  109. * @platform Web,Native
  110. */
  111. class ResourceItem {
  112. /**
  113. * @language en_US
  114. * XML file.
  115. * @version Egret 2.4
  116. * @platform Web,Native
  117. */
  118. /**
  119. * @language zh_CN
  120. * XML 文件。
  121. * @version Egret 2.4
  122. * @platform Web,Native
  123. */
  124. static TYPE_XML: string;
  125. /**
  126. * @language en_US
  127. * Picture file.
  128. * @version Egret 2.4
  129. * @platform Web,Native
  130. */
  131. /**
  132. * @language zh_CN
  133. * 图片文件。
  134. * @version Egret 2.4
  135. * @platform Web,Native
  136. */
  137. static TYPE_IMAGE: string;
  138. /**
  139. * @language en_US
  140. * Binary file.
  141. * @version Egret 2.4
  142. * @platform Web
  143. */
  144. /**
  145. * @language zh_CN
  146. * 二进制文件。
  147. * @version Egret 2.4
  148. * @platform Web
  149. */
  150. static TYPE_BIN: string;
  151. /**
  152. * @language en_US
  153. * Text file.
  154. * @version Egret 2.4
  155. * @platform Web,Native
  156. */
  157. /**
  158. * @language zh_CN
  159. * 文本文件。
  160. * @version Egret 2.4
  161. * @platform Web,Native
  162. */
  163. static TYPE_TEXT: string;
  164. /**
  165. * @language en_US
  166. * JSON file.
  167. * @version Egret 2.4
  168. * @platform Web,Native
  169. */
  170. /**
  171. * @language zh_CN
  172. * JSON 文件。
  173. * @version Egret 2.4
  174. * @platform Web,Native
  175. */
  176. static TYPE_JSON: string;
  177. /**
  178. * @language en_US
  179. * SpriteSheet file.
  180. * @version Egret 2.4
  181. * @platform Web,Native
  182. */
  183. /**
  184. * @language zh_CN
  185. * SpriteSheet 文件。
  186. * @version Egret 2.4
  187. * @platform Web,Native
  188. */
  189. static TYPE_SHEET: string;
  190. /**
  191. * @language en_US
  192. * BitmapTextSpriteSheet file.
  193. * @version Egret 2.4
  194. * @platform Web,Native
  195. */
  196. /**
  197. * @language zh_CN
  198. * BitmapTextSpriteSheet 文件。
  199. * @version Egret 2.4
  200. * @platform Web,Native
  201. */
  202. static TYPE_FONT: string;
  203. /**
  204. * @language en_US
  205. * Sound file.
  206. * @version Egret 2.4
  207. * @platform Web,Native
  208. */
  209. /**
  210. * @language zh_CN
  211. * 声音文件。
  212. * @version Egret 2.4
  213. * @platform Web,Native
  214. */
  215. static TYPE_SOUND: string;
  216. /**
  217. * @language en_US
  218. * Constructor.
  219. * @param name Name of resource term.
  220. * @param url URL of resource term.
  221. * @param type Type of resource term.
  222. * @version Egret 2.4
  223. * @platform Web,Native
  224. */
  225. /**
  226. * @language zh_CN
  227. * 构造函数。
  228. * @param name 加载项名称。
  229. * @param url 要加载的文件地址。
  230. * @param type 加载项文件类型。
  231. * @version Egret 2.4
  232. * @platform Web,Native
  233. */
  234. constructor(name: string, url: string, type: string);
  235. /**
  236. * @language en_US
  237. * Name of resource term.
  238. * @version Egret 2.4
  239. * @platform Web,Native
  240. */
  241. /**
  242. * @language zh_CN
  243. * 加载项名称。
  244. * @version Egret 2.4
  245. * @platform Web,Native
  246. */
  247. name: string;
  248. /**
  249. * @language en_US
  250. * URL of resource term.
  251. * @version Egret 2.4
  252. * @platform Web,Native
  253. */
  254. /**
  255. * @language zh_CN
  256. * 要加载的文件地址。
  257. * @version Egret 2.4
  258. * @platform Web,Native
  259. */
  260. url: string;
  261. /**
  262. * @language en_US
  263. * Type of resource term.
  264. * @version Egret 2.4
  265. * @platform Web,Native
  266. */
  267. /**
  268. * @language zh_CN
  269. * 加载项文件类型。
  270. * @version Egret 2.4
  271. * @platform Web,Native
  272. */
  273. type: string;
  274. /**
  275. * @language en_US
  276. * Name of the resource term group.
  277. * @version Egret 2.4
  278. * @platform Web,Native
  279. */
  280. /**
  281. * @language zh_CN
  282. * 资源所属的组名。
  283. * @version Egret 2.4
  284. * @platform Web,Native
  285. */
  286. groupName: string;
  287. /**
  288. * @language en_US
  289. * The raw data object to be referenced.
  290. * @version Egret 2.4
  291. * @platform Web,Native
  292. */
  293. /**
  294. * @language zh_CN
  295. * 被引用的原始数据对象。
  296. * @version Egret 2.4
  297. * @platform Web,Native
  298. */
  299. data: any;
  300. private _loaded;
  301. /**
  302. * @language en_US
  303. * Load complete flag.
  304. * @version Egret 2.4
  305. * @platform Web,Native
  306. */
  307. /**
  308. * @language zh_CN
  309. * 加载完成的标志。
  310. * @version Egret 2.4
  311. * @platform Web,Native
  312. */
  313. loaded: boolean;
  314. /**
  315. * @language en_US
  316. * Turn into a string.
  317. * @version Egret 2.4
  318. * @platform Web,Native
  319. */
  320. /**
  321. * @language zh_CN
  322. * 转成字符串。
  323. * @version Egret 2.4
  324. * @platform Web,Native
  325. */
  326. toString(): string;
  327. }
  328. }
  329. declare namespace RES {
  330. /**
  331. * SpriteSheet解析器
  332. * @private
  333. */
  334. class SheetAnalyzer extends BinAnalyzer {
  335. constructor();
  336. getRes(name: string): any;
  337. /**
  338. * 一项加载结束
  339. */
  340. onLoadFinish(event: egret.Event): void;
  341. sheetMap: any;
  342. private textureMap;
  343. /**
  344. * 解析并缓存加载成功的配置文件
  345. */
  346. analyzeConfig(resItem: ResourceItem, data: string): string;
  347. /**
  348. * 解析并缓存加载成功的位图数据
  349. */
  350. analyzeBitmap(resItem: ResourceItem, texture: egret.Texture): void;
  351. /**
  352. * 获取相对位置
  353. */
  354. getRelativePath(url: string, file: string): string;
  355. protected parseSpriteSheet(texture: egret.Texture, data: any, name: string): egret.SpriteSheet;
  356. destroyRes(name: string): boolean;
  357. /**
  358. * ImageLoader对象池
  359. */
  360. private recyclerIamge;
  361. private loadImage(url, data);
  362. private getImageLoader();
  363. protected onResourceDestroy(texture: any): void;
  364. }
  365. }
  366. declare namespace RES {
  367. /**
  368. * @language en_US
  369. * Version control loading interface
  370. * @version Egret 2.4
  371. * @platform Web,Native
  372. * @includeExample extension/version/VersionControl.ts
  373. */
  374. /**
  375. * @language zh_CN
  376. * 版本控制加载的接口
  377. * @version Egret 2.4
  378. * @platform Web,Native
  379. * @includeExample extension/version/VersionControl.ts
  380. */
  381. interface IVersionController {
  382. /**
  383. * @language en_US
  384. * Get the version information data.<br/>
  385. * 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.
  386. * @version Egret 2.4
  387. * @platform Web,Native
  388. */
  389. /**
  390. * @language zh_CN
  391. * 获取版本信息数据。<br/>
  392. * 这个方法的调用需要在应用程序进行任何资源加载之前,建议在应用程序的入口类(Main)的开始最先进行调用处理。此方法只负责获取版本信息,不负责资源的下载。
  393. * @version Egret 2.4
  394. * @platform Web,Native
  395. */
  396. fetchVersion(callback: egret.AsyncCallback): void;
  397. /**
  398. * @language en_US
  399. * Get all changed files.<br/>
  400. * The main application in native scene. Changes here include new file, update file (the same file name, but changed files).<br/>
  401. * @returns All changes in the file list. In the Web end this list is empty.
  402. * @version Egret 2.4
  403. * @platform Web,Native
  404. */
  405. /**
  406. * @language zh_CN
  407. * 获取所有有变化的文件。<br/>
  408. * 主要应用在native场景中。这里的变化包括新增文件、更新文件(文件名相同,但更改过的文件)。<br/>
  409. * @returns 所有有变化的文件列表。在Web端此列表为空。
  410. * @version Egret 2.4
  411. * @platform Web,Native
  412. */
  413. getChangeList(): Array<{
  414. url: string;
  415. size: number;
  416. }>;
  417. /**
  418. * @language en_US
  419. * Get the actual URL of the resource file.<br/>
  420. * 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/>
  421. * In the development and debugging phase, this method will directly return value passed.
  422. * @param url Url used in the game
  423. * @returns Actual loaded url
  424. * @version Egret 2.4
  425. * @platform Web,Native
  426. */
  427. /**
  428. * @language zh_CN
  429. * 获取资源文件实际的URL地址。<br/>
  430. * 由于版本控制实际已经对原来的资源文件的URL进行了改变,因此想获取指定资源文件实际的URL时需要调用此方法。<br/>
  431. * 在开发调试阶段,这个方法会直接返回传入的参数值。
  432. * @param url 游戏中使用的url
  433. * @returns 实际加载的url
  434. * @version Egret 2.4
  435. * @platform Web,Native
  436. */
  437. getVirtualUrl(url: string): string;
  438. }
  439. /**
  440. * @language en_US
  441. * Manage version control class
  442. * @version Egret 2.4
  443. * @platform Web,Native
  444. * @event egret.Event.COMPLETE Version control loading is complete when thrown
  445. * @event egret.IOErrorEvent.IO_ERROR Version control failed to load when thrown
  446. * @includeExample extension/version/VersionControl.ts
  447. */
  448. /**
  449. * @language zh_CN
  450. * 管理版本控制的类
  451. * @version Egret 2.4
  452. * @platform Web,Native
  453. * @event egret.Event.COMPLETE 版本控制加载完成时抛出
  454. * @event egret.IOErrorEvent.IO_ERROR 版本控制加载失败时抛出
  455. * @includeExample extension/version/VersionControl.ts
  456. */
  457. interface VersionController extends IVersionController {
  458. }
  459. /**
  460. * @version Egret 2.4
  461. * @platform Web,Native
  462. */
  463. let VersionController: {
  464. /**
  465. * @language en_US
  466. * Constructor initialization
  467. */
  468. /**
  469. * @language zh_CN
  470. * 初始化构造函数
  471. */
  472. new (): VersionController;
  473. };
  474. }
  475. declare namespace RES {
  476. /**
  477. * @language en_US
  478. * The events of resource loading.
  479. * @version Egret 2.4
  480. * @platform Web,Native
  481. */
  482. /**
  483. * @language zh_CN
  484. * 资源加载事件。
  485. * @version Egret 2.4
  486. * @platform Web,Native
  487. */
  488. class ResourceEvent extends egret.Event {
  489. /**
  490. * @language en_US
  491. * Failure event for a load item.
  492. * @version Egret 2.4
  493. * @platform Web,Native
  494. */
  495. /**
  496. * @language zh_CN
  497. * 一个加载项加载失败事件。
  498. * @version Egret 2.4
  499. * @platform Web,Native
  500. */
  501. static ITEM_LOAD_ERROR: string;
  502. /**
  503. * @language en_US
  504. * 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.
  505. * @version Egret 2.4
  506. * @platform Web,Native
  507. */
  508. /**
  509. * @language zh_CN
  510. * 配置文件加载并解析完成事件。注意:若有配置文件加载失败,将不会抛出此事件,若要处理配置加载失败,请同时监听 CONFIG_LOAD_ERROR 事件。
  511. * @version Egret 2.4
  512. * @platform Web,Native
  513. */
  514. static CONFIG_COMPLETE: string;
  515. /**
  516. * @language en_US
  517. * Configuration file failed to load.
  518. * @version Egret 2.4
  519. * @platform Web,Native
  520. */
  521. /**
  522. * @language zh_CN
  523. * 配置文件加载失败事件。
  524. * @version Egret 2.4
  525. * @platform Web,Native
  526. */
  527. static CONFIG_LOAD_ERROR: string;
  528. /**
  529. * @language en_US
  530. * Delay load group resource loading progress event.
  531. * @version Egret 2.4
  532. * @platform Web,Native
  533. */
  534. /**
  535. * @language zh_CN
  536. * 延迟加载组资源加载进度事件。
  537. * @version Egret 2.4
  538. * @platform Web,Native
  539. */
  540. static GROUP_PROGRESS: string;
  541. /**
  542. * @language en_US
  543. * 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.
  544. * @version Egret 2.4
  545. * @platform Web,Native
  546. */
  547. /**
  548. * @language zh_CN
  549. * 延迟加载组资源加载完成事件。注意:若组内有资源项加载失败,将不会抛出此事件,若要处理组加载失败,请同时监听 GROUP_LOAD_ERROR 事件。
  550. * @version Egret 2.4
  551. * @platform Web,Native
  552. */
  553. static GROUP_COMPLETE: string;
  554. /**
  555. * @language en_US
  556. * Delayed load group resource failed event.
  557. * @version Egret 2.4
  558. * @platform Web,Native
  559. */
  560. /**
  561. * @language zh_CN
  562. * 延迟加载组资源加载失败事件。
  563. * @version Egret 2.4
  564. * @platform Web,Native
  565. */
  566. static GROUP_LOAD_ERROR: string;
  567. /**
  568. * @language en_US
  569. * Creates an Event object to pass as a parameter to event listeners.
  570. * @param type The type of the event, accessible as Event.type.
  571. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  572. * @param cancelable Determines whether the Event object can be canceled. The default values is false.
  573. * @version Egret 2.4
  574. * @platform Web,Native
  575. * @private
  576. */
  577. /**
  578. * @language zh_CN
  579. * 创建一个作为参数传递给事件侦听器的 Event 对象。
  580. * @param type 事件的类型,可以作为 Event.type 访问。
  581. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  582. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  583. * @version Egret 2.4
  584. * @platform Web,Native
  585. * @private
  586. */
  587. constructor(type: string, bubbles?: boolean, cancelable?: boolean);
  588. /**
  589. * @language en_US
  590. * File number that has been loaded.
  591. * @version Egret 2.4
  592. * @platform Web,Native
  593. */
  594. /**
  595. * @language zh_CN
  596. * 已经加载的文件数。
  597. * @version Egret 2.4
  598. * @platform Web,Native
  599. */
  600. itemsLoaded: number;
  601. /**
  602. * @language en_US
  603. * Total file number to load.
  604. * @version Egret 2.4
  605. * @platform Web,Native
  606. */
  607. /**
  608. * @language zh_CN
  609. * 要加载的总文件数。
  610. * @version Egret 2.4
  611. * @platform Web,Native
  612. */
  613. itemsTotal: number;
  614. /**
  615. * @language en_US
  616. * Resource group name.
  617. * @version Egret 2.4
  618. * @platform Web,Native
  619. */
  620. /**
  621. * @language zh_CN
  622. * 资源组名。
  623. * @version Egret 2.4
  624. * @platform Web,Native
  625. */
  626. groupName: string;
  627. /**
  628. * @language en_US
  629. * An item of information that is finished by the end of a load.
  630. * @version Egret 2.4
  631. * @platform Web,Native
  632. */
  633. /**
  634. * @language zh_CN
  635. * 一次加载项加载结束的项信息对象。
  636. * @version Egret 2.4
  637. * @platform Web,Native
  638. */
  639. resItem: ResourceItem;
  640. /**
  641. * 使用指定的EventDispatcher对象来抛出事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
  642. * @method RES.ResourceEvent.dispatchResourceEvent
  643. * @param target {egret.IEventDispatcher}
  644. * @param type {string}
  645. * @param groupName {string}
  646. * @param resItem {egret.ResourceItem}
  647. * @param itemsLoaded {number}
  648. * @param itemsTotal {number}
  649. * @private
  650. */
  651. static dispatchResourceEvent(target: egret.IEventDispatcher, type: string, groupName?: string, resItem?: ResourceItem, itemsLoaded?: number, itemsTotal?: number): boolean;
  652. }
  653. }
  654. declare namespace RES {
  655. /**
  656. * @private
  657. */
  658. class TextAnalyzer extends BinAnalyzer {
  659. constructor();
  660. }
  661. }
  662. declare namespace RES {
  663. /**
  664. * @private
  665. */
  666. class JsonAnalyzer extends BinAnalyzer {
  667. constructor();
  668. /**
  669. * 解析并缓存加载成功的数据
  670. */
  671. analyzeData(resItem: ResourceItem, data: any): void;
  672. }
  673. }
  674. declare namespace RES {
  675. /**
  676. * @class RES.ResourceLoader
  677. * @classdesc
  678. * @extends egret.EventDispatcher
  679. * @private
  680. */
  681. class ResourceLoader extends egret.EventDispatcher {
  682. /**
  683. * 构造函数
  684. * @method RES.ResourceLoader#constructor
  685. */
  686. constructor();
  687. /**
  688. * 最大并发加载数
  689. */
  690. thread: number;
  691. /**
  692. * 正在加载的线程计数
  693. */
  694. private loadingCount;
  695. /**
  696. * 一项加载结束回调函数。无论加载成功或者出错都将执行回调函数。示例:callBack(resItem:ResourceItem):void;
  697. * @member {Function} RES.ResourceLoader#callBack
  698. */
  699. callBack: Function;
  700. /**
  701. * RES单例的引用
  702. * @member {any} RES.ResourceLoader#resInstance
  703. */
  704. resInstance: any;
  705. /**
  706. * 当前组加载的项总个数,key为groupName
  707. */
  708. private groupTotalDic;
  709. /**
  710. * 已经加载的项个数,key为groupName
  711. */
  712. private numLoadedDic;
  713. /**
  714. * 正在加载的组列表,key为groupName
  715. */
  716. private itemListDic;
  717. /**
  718. * 加载失败的组,key为groupName
  719. */
  720. private groupErrorDic;
  721. private retryTimesDic;
  722. maxRetryTimes: number;
  723. private failedList;
  724. /**
  725. * 优先级队列,key为priority,value为groupName列表
  726. */
  727. private priorityQueue;
  728. /**
  729. * 检查指定的组是否正在加载中
  730. * @method RES.ResourceLoader#isGroupInLoading
  731. * @param groupName {string}
  732. * @returns {boolean}
  733. */
  734. isGroupInLoading(groupName: string): boolean;
  735. /**
  736. * 开始加载一组文件
  737. * @method RES.ResourceLoader#loadGroup
  738. * @param list {egret.Array<ResourceItem>} 加载项列表
  739. * @param groupName {string} 组名
  740. * @param priority {number} 加载优先级
  741. */
  742. loadGroup(list: Array<ResourceItem>, groupName: string, priority?: number): void;
  743. /**
  744. * 延迟加载队列
  745. */
  746. private lazyLoadList;
  747. /**
  748. * 加载一个文件
  749. * @method RES.ResourceLoader#loadItem
  750. * @param resItem {egret.ResourceItem} 要加载的项
  751. */
  752. loadItem(resItem: ResourceItem): void;
  753. /**
  754. * 资源解析库字典类
  755. */
  756. private analyzerDic;
  757. /**
  758. * 加载下一项
  759. */
  760. private next();
  761. /**
  762. * 当前应该加载同优先级队列的第几列
  763. */
  764. private queueIndex;
  765. /**
  766. * 获取下一个待加载项
  767. */
  768. private getOneResourceItem();
  769. /**
  770. * 加载结束
  771. */
  772. private onItemComplete(resItem);
  773. /**
  774. * 从优先级队列中移除指定的组名
  775. */
  776. private removeGroupName(groupName);
  777. }
  778. }
  779. declare namespace RES {
  780. /**
  781. * @private
  782. */
  783. class FontAnalyzer extends SheetAnalyzer {
  784. constructor();
  785. analyzeConfig(resItem: ResourceItem, data: string): string;
  786. analyzeBitmap(resItem: ResourceItem, texture: egret.Texture): void;
  787. private getTexturePath(url, fntText);
  788. protected onResourceDestroy(font: egret.BitmapFont): void;
  789. }
  790. }
  791. declare namespace RES {
  792. /**
  793. * @private
  794. */
  795. class SoundAnalyzer extends AnalyzerBase {
  796. /**
  797. * 构造函数
  798. */
  799. constructor();
  800. /**
  801. * 字节流数据缓存字典
  802. */
  803. protected soundDic: any;
  804. /**
  805. * 加载项字典
  806. */
  807. protected resItemDic: any[];
  808. /**
  809. * @inheritDoc
  810. */
  811. loadFile(resItem: ResourceItem, callBack: Function, thisObject: any): void;
  812. /**
  813. * 一项加载结束
  814. */
  815. protected onLoadFinish(event: egret.Event): void;
  816. /**
  817. * 解析并缓存加载成功的数据
  818. */
  819. protected analyzeData(resItem: ResourceItem, data: egret.Sound): void;
  820. /**
  821. * @inheritDoc
  822. */
  823. getRes(name: string): any;
  824. /**
  825. * @inheritDoc
  826. */
  827. hasRes(name: string): boolean;
  828. /**
  829. * @inheritDoc
  830. */
  831. destroyRes(name: string): boolean;
  832. }
  833. }
  834. declare namespace RES {
  835. /**
  836. * @private
  837. */
  838. class XMLAnalyzer extends BinAnalyzer {
  839. constructor();
  840. /**
  841. * 解析并缓存加载成功的数据
  842. */
  843. analyzeData(resItem: ResourceItem, data: any): void;
  844. }
  845. }
  846. declare namespace RES {
  847. /**
  848. * @private
  849. */
  850. class ImageAnalyzer extends AnalyzerBase {
  851. /**
  852. * 构造函数
  853. */
  854. constructor();
  855. /**
  856. * 字节流数据缓存字典
  857. */
  858. protected fileDic: any;
  859. /**
  860. * 加载项字典
  861. */
  862. protected resItemDic: any[];
  863. /**
  864. * @inheritDoc
  865. */
  866. loadFile(resItem: ResourceItem, compFunc: Function, thisObject: any): void;
  867. /**
  868. * Loader对象池
  869. */
  870. protected recycler: egret.ImageLoader[];
  871. /**
  872. * 获取一个Loader对象
  873. */
  874. private getLoader();
  875. /**
  876. * 一项加载结束
  877. */
  878. protected onLoadFinish(event: egret.Event): void;
  879. /**
  880. * 解析并缓存加载成功的数据
  881. */
  882. protected analyzeData(resItem: ResourceItem, texture: egret.Texture): void;
  883. /**
  884. * @inheritDoc
  885. */
  886. getRes(name: string): any;
  887. /**
  888. * @inheritDoc
  889. */
  890. hasRes(name: string): boolean;
  891. /**
  892. * @inheritDoc
  893. */
  894. destroyRes(name: string): boolean;
  895. protected onResourceDestroy(texture: any): void;
  896. }
  897. }
  898. declare namespace RES {
  899. /**
  900. * @class RES.ResourceConfig
  901. * @classdesc
  902. * @private
  903. */
  904. class ResourceConfig {
  905. constructor();
  906. /**
  907. * 根据组名获取组加载项列表
  908. * @method RES.ResourceConfig#getGroupByName
  909. * @param name {string} 组名
  910. * @returns {Array<egret.ResourceItem>}
  911. */
  912. getGroupByName(name: string): Array<ResourceItem>;
  913. /**
  914. * 根据组名获取原始的组加载项列表
  915. * @method RES.ResourceConfig#getRawGroupByName
  916. * @param name {string} 组名
  917. * @returns {any[]}
  918. */
  919. getRawGroupByName(name: string): any[];
  920. /**
  921. * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
  922. * 可以监听ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成。
  923. * @method RES.ResourceConfig#createGroup
  924. * @param name {string} 要创建的加载资源组的组名
  925. * @param keys {egret.string[]} 要包含的键名列表,key对应配置文件里的name属性或sbuKeys属性的一项或一个资源组名。
  926. * @param override {boolean} 是否覆盖已经存在的同名资源组,默认false。
  927. * @returns {boolean}
  928. */
  929. createGroup(name: string, keys: string[], override?: boolean): boolean;
  930. /**
  931. * 一级键名字典
  932. */
  933. private keyMap;
  934. /**
  935. * 加载组字典
  936. */
  937. private groupDic;
  938. /**
  939. * 解析一个配置文件
  940. * @method RES.ResourceConfig#parseConfig
  941. * @param data {any} 配置文件数据
  942. * @param folder {string} 加载项的路径前缀。
  943. */
  944. parseConfig(data: any, folder: string): void;
  945. /**
  946. * 添加一个二级键名到配置列表。
  947. * @method RES.ResourceConfig#addSubkey
  948. * @param subkey {string} 要添加的二级键名
  949. * @param name {string} 二级键名所属的资源name属性
  950. */
  951. addSubkey(subkey: string, name: string): void;
  952. /**
  953. * 添加一个加载项数据到列表
  954. */
  955. private addItemToKeyMap(item);
  956. /**
  957. * 获取加载项的name属性
  958. * @method RES.ResourceConfig#getType
  959. * @param key {string} 对应配置文件里的name属性或sbuKeys属性的一项。
  960. * @returns {string}
  961. */
  962. getName(key: string): string;
  963. /**
  964. * 获取加载项类型。
  965. * @method RES.ResourceConfig#getType
  966. * @param key {string} 对应配置文件里的name属性或sbuKeys属性的一项。
  967. * @returns {string}
  968. */
  969. getType(key: string): string;
  970. getRawResourceItem(key: string): any;
  971. /**
  972. * 获取加载项信息对象
  973. * @method RES.ResourceConfig#getResourceItem
  974. * @param key {string} 对应配置文件里的key属性或sbuKeys属性的一项。
  975. * @returns {egret.ResourceItem}
  976. */
  977. getResourceItem(key: string): ResourceItem;
  978. /**
  979. * 转换Object数据为ResourceItem对象
  980. */
  981. private parseResourceItem(data);
  982. }
  983. }
  984. declare namespace RES.native {
  985. /**
  986. * @private
  987. */
  988. class NativeVersionController implements VersionController {
  989. private _versionInfo;
  990. private _versionPath;
  991. private _localFileArr;
  992. constructor();
  993. fetchVersion(callback: egret.AsyncCallback): void;
  994. private getList(callback, type, root?);
  995. /**
  996. * 获取所有有变化的文件
  997. * @returns {any[]}
  998. */
  999. getChangeList(): Array<{
  1000. url: string;
  1001. size: number;
  1002. }>;
  1003. getVirtualUrl(url: string): string;
  1004. private getLocalData(filePath);
  1005. }
  1006. }
  1007. declare namespace RES.web {
  1008. /**
  1009. * @private
  1010. */
  1011. class Html5VersionController extends egret.EventDispatcher implements VersionController {
  1012. constructor();
  1013. private _versionInfo;
  1014. fetchVersion(callback: egret.AsyncCallback): void;
  1015. /**
  1016. * 获取所有有变化的文件
  1017. * @returns {any[]}
  1018. */
  1019. getChangeList(): Array<{
  1020. url: string;
  1021. size: number;
  1022. }>;
  1023. getVirtualUrl(url: string): string;
  1024. }
  1025. }
  1026. declare namespace RES {
  1027. /**
  1028. * @language en_US
  1029. * Conduct mapping injection with class definition as the value.
  1030. * @param type Injection type.
  1031. * @param analyzerClass Injection type classes need to be resolved.
  1032. * @version Egret 2.4
  1033. * @platform Web,Native
  1034. * @includeExample extension/resource/Resource.ts
  1035. */
  1036. /**
  1037. * @language zh_CN
  1038. * 以类定义为值进行映射注入。
  1039. * @param type 注入的类型。
  1040. * @param analyzerClass 注入类型需要解析的类。
  1041. * @version Egret 2.4
  1042. * @platform Web,Native
  1043. * @includeExample extension/resource/Resource.ts
  1044. */
  1045. function registerAnalyzer(type: string, analyzerClass: any): void;
  1046. /**
  1047. * @language en_US
  1048. * Get mapping injection.
  1049. * @param type Injection type.
  1050. * @version Egret 3.2.6
  1051. * @platform Web,Native
  1052. * @includeExample extension/resource/Resource.ts
  1053. */
  1054. /**
  1055. * @language zh_CN
  1056. * 获取映射注入。
  1057. * @param type 注入的类型。
  1058. * @version Egret 3.2.6
  1059. * @platform Web,Native
  1060. * @includeExample extension/resource/Resource.ts
  1061. */
  1062. function getAnalyzer(type: string): AnalyzerBase;
  1063. /**
  1064. * @language en_US
  1065. * Register the VersionController
  1066. * @param vcs The VersionController to register.
  1067. * @version Egret 2.5
  1068. * @platform Web,Native
  1069. */
  1070. /**
  1071. * @language zh_CN
  1072. * 注册版本控制器,通过RES模块加载资源时会从版本控制器获取真实url
  1073. * @param vcs 注入的版本控制器。
  1074. * @version Egret 2.5
  1075. * @platform Web,Native
  1076. */
  1077. function registerVersionController(vcs: VersionController): void;
  1078. /**
  1079. * @language en_US
  1080. * Returns the VersionController
  1081. * @version Egret 2.5
  1082. * @platform Web,Native
  1083. */
  1084. /**
  1085. * @language zh_CN
  1086. * 获得版本控制器.
  1087. * @version Egret 2.5
  1088. * @platform Web,Native
  1089. */
  1090. function getVersionController(): VersionController;
  1091. /**
  1092. * @language en_US
  1093. * Load configuration file and parse.
  1094. * @param url Configuration file path (path resource.json).
  1095. * @param resourceRoot Resource path. All URL in the configuration is the relative value of the path. The ultimate URL is the value of the sum of the URL of the string and the resource in the configuration.
  1096. * @param type Configuration file format. Determine what parser to parse the configuration file. Default "json".
  1097. * @see #setMaxRetryTimes
  1098. * @version Egret 2.4
  1099. * @platform Web,Native
  1100. */
  1101. /**
  1102. * @language zh_CN
  1103. * 加载配置文件并解析。
  1104. * @param url 配置文件路径(resource.json的路径)。
  1105. * @param resourceRoot 资源根路径。配置中的所有url都是这个路径的相对值。最终url是这个字符串与配置里资源项的url相加的值。
  1106. * @param type 配置文件的格式。确定要用什么解析器来解析配置文件。默认"json"
  1107. * @see #setMaxRetryTimes
  1108. * @version Egret 2.4
  1109. * @platform Web,Native
  1110. */
  1111. function loadConfig(url: string, resourceRoot?: string, type?: string): void;
  1112. /**
  1113. * @language en_US
  1114. * Load a set of resources according to the group name.
  1115. * @param name Group name to load the resource group.
  1116. * @param priority Load priority can be negative, the default value is 0.
  1117. * <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.
  1118. * @see #setMaxRetryTimes
  1119. * @version Egret 2.4
  1120. * @platform Web,Native
  1121. */
  1122. /**
  1123. * @language zh_CN
  1124. * 根据组名加载一组资源。
  1125. * @param name 要加载资源组的组名。
  1126. * @param priority 加载优先级,可以为负数,默认值为 0。
  1127. * <br>低优先级的组必须等待高优先级组完全加载结束才能开始,同一优先级的组会同时加载。
  1128. * @see #setMaxRetryTimes
  1129. * @version Egret 2.4
  1130. * @platform Web,Native
  1131. */
  1132. function loadGroup(name: string, priority?: number): void;
  1133. /**
  1134. * @language en_US
  1135. * Check whether a resource group has been loaded.
  1136. * @param name Group name。
  1137. * @returns Is loading or not.
  1138. * @see #setMaxRetryTimes
  1139. * @version Egret 2.4
  1140. * @platform Web,Native
  1141. */
  1142. /**
  1143. * @language zh_CN
  1144. * 检查某个资源组是否已经加载完成。
  1145. * @param name 组名。
  1146. * @returns 是否正在加载。
  1147. * @see #setMaxRetryTimes
  1148. * @version Egret 2.4
  1149. * @platform Web,Native
  1150. */
  1151. function isGroupLoaded(name: string): boolean;
  1152. /**
  1153. * @language en_US
  1154. * A list of groups of loading is obtained according to the group name.
  1155. * @param name Group name.
  1156. * @returns The resource item array of group.
  1157. * @see RES.ResourceItem
  1158. * @see #setMaxRetryTimes
  1159. * @version Egret 2.4
  1160. * @platform Web,Native
  1161. */
  1162. /**
  1163. * @language zh_CN
  1164. * 根据组名获取组加载项列表。
  1165. * @param name 组名。
  1166. * @returns 加载项列表。
  1167. * @see RES.ResourceItem
  1168. * @see #setMaxRetryTimes
  1169. * @version Egret 2.4
  1170. * @platform Web,Native
  1171. */
  1172. function getGroupByName(name: string): Array<ResourceItem>;
  1173. /**
  1174. * @language en_US
  1175. * Create a custom load resource group, note that this method is valid only after the resource configuration file is loaded.
  1176. * <br>You can monitor the ResourceEvent.CONFIG_COMPLETE event to verify that the configuration is complete.
  1177. * @param name Group name to create the load resource group.
  1178. * @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.
  1179. * @param override Is the default false for the same name resource group already exists.
  1180. * @returns Create success or fail.
  1181. * @see #setMaxRetryTimes
  1182. * @version Egret 2.4
  1183. * @platform Web,Native
  1184. */
  1185. /**
  1186. * @language zh_CN
  1187. * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。
  1188. * <br>可以监听 ResourceEvent.CONFIG_COMPLETE 事件来确认配置加载完成。
  1189. * @param name 要创建的加载资源组的组名。
  1190. * @param keys 要包含的键名列表,key 对应配置文件里的 name 属性或 sbuKeys 属性的一项或一个资源组名。
  1191. * @param override 是否覆盖已经存在的同名资源组,默认 false。
  1192. * @returns 是否创建成功。
  1193. * @see #setMaxRetryTimes
  1194. * @version Egret 2.4
  1195. * @platform Web,Native
  1196. */
  1197. function createGroup(name: string, keys: string[], override?: boolean): boolean;
  1198. /**
  1199. * @language en_US
  1200. * Check whether the configuration file contains the specified resources.
  1201. * @param key A sbuKeys attribute or name property in a configuration file.
  1202. * @see #setMaxRetryTimes
  1203. * @version Egret 2.4
  1204. * @platform Web,Native
  1205. */
  1206. /**
  1207. * @language zh_CN
  1208. * 检查配置文件里是否含有指定的资源。
  1209. * @param key 对应配置文件里的 name 属性或 sbuKeys 属性的一项。
  1210. * @see #setMaxRetryTimes
  1211. * @version Egret 2.4
  1212. * @platform Web,Native
  1213. */
  1214. function hasRes(key: string): boolean;
  1215. /**
  1216. * @language en_US
  1217. * parse a configuration file at run time,it will not clean the exist data.
  1218. * @param data Configuration file data, please refer to the resource.json configuration file format. JSON object can be introduced into the corresponding.
  1219. * @param folder Path prefix for load.
  1220. * @see #setMaxRetryTimes
  1221. * @version Egret 2.4
  1222. * @platform Web,Native
  1223. */
  1224. /**
  1225. * @language zh_CN
  1226. * 运行时动态解析一个配置文件,此操作不会清空之前已存在的配置。
  1227. * @param data 配置文件数据,请参考 resource.json 的配置文件格式。传入对应的 json 对象即可。
  1228. * @param folder 加载项的路径前缀。
  1229. * @see #setMaxRetryTimes
  1230. * @version Egret 2.4
  1231. * @platform Web,Native
  1232. */
  1233. function parseConfig(data: any, folder?: string): void;
  1234. /**
  1235. * @language en_US
  1236. * The synchronization method for obtaining the cache has been loaded with the success of the resource.
  1237. * <br>The type of resource and the corresponding return value types are as follows:
  1238. * <br>RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript primary object
  1239. * <br>RES.ResourceItem.TYPE_IMAGE : img Html Object,or egret.BitmapData interface。
  1240. * <br>RES.ResourceItem.TYPE_JSON : Object
  1241. * <br>RES.ResourceItem.TYPE_SHEET : Object
  1242. * <br> 1. If the incoming parameter is the name of the entire SpriteSheet is returned is {image1: Texture, "image2": Texture}.
  1243. * <br> 2. If the incoming is "sheet.image1", the return is a single resource.
  1244. * <br> 3. If the incoming is the name of the "image1" single resource, the return is a single resource.
  1245. * But if there are two SpriteSheet in a single picture of the same name, the return of the image after the load.
  1246. * <br>RES.ResourceItem.TYPE_SOUND : HtmlSound Html Object
  1247. * <br>RES.ResourceItem.TYPE_TEXT : string
  1248. * @param key A subKeys attribute or name property in a configuration file.
  1249. * @see RES.ResourceItem
  1250. * @see #setMaxRetryTimes
  1251. * @version Egret 2.4
  1252. * @platform Web,Native
  1253. */
  1254. /**
  1255. * @language zh_CN
  1256. * 同步方式获取缓存的已经加载成功的资源。
  1257. * <br>资源类型和对应的返回值类型关系如下:
  1258. * <br>RES.ResourceItem.TYPE_BIN : ArrayBuffer JavaScript 原生对象
  1259. * <br>RES.ResourceItem.TYPE_IMAGE : img Html 对象,或者 egret.BitmapData 接口。
  1260. * <br>RES.ResourceItem.TYPE_JSON : Object
  1261. * <br>RES.ResourceItem.TYPE_SHEET : Object
  1262. * <br> 1. 如果传入的参数是整个 SpriteSheet 的名称返回的是 {"image1":Texture,"image2":Texture} 这样的格式。
  1263. * <br> 2. 如果传入的是 "sheet.image1",返回的是单个资源。
  1264. * <br> 3. 如果传入的是 "image1" 单个资源的名称,返回的是单个资源。但是如果有两张 SpriteSheet 中有单个图片资源名称相同,返回的是后加载的那个图片资源。
  1265. * <br>RES.ResourceItem.TYPE_SOUND : HtmlSound Html 对象
  1266. * <br>RES.ResourceItem.TYPE_TEXT : string
  1267. * @param key 对应配置文件里的 name 属性或 subKeys 属性的一项。
  1268. * @see RES.ResourceItem
  1269. * @see #setMaxRetryTimes
  1270. * @version Egret 2.4
  1271. * @platform Web,Native
  1272. */
  1273. function getRes(key: string): any;
  1274. /**
  1275. * @language en_US
  1276. * 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.
  1277. * @param key A sbuKeys attribute or name property in a configuration file.
  1278. * @param compFunc Call back function. Example:compFunc(data,key):void.
  1279. * @param thisObject This pointer of call back function.
  1280. * @see #setMaxRetryTimes
  1281. * @version Egret 2.4
  1282. * @platform Web,Native
  1283. */
  1284. /**
  1285. * @language zh_CN
  1286. * 异步方式获取配置里的资源。只要是配置文件里存在的资源,都可以通过异步方式获取。
  1287. * @param key 对应配置文件里的 name 属性或 sbuKeys 属性的一项。
  1288. * @param compFunc 回调函数。示例:compFunc(data,key):void。
  1289. * @param thisObject 回调函数的 this 引用。
  1290. * @see #setMaxRetryTimes
  1291. * @version Egret 2.4
  1292. * @platform Web,Native
  1293. */
  1294. function getResAsync(key: string, compFunc: Function, thisObject: any): void;
  1295. /**
  1296. * @language en_US
  1297. * Access to external resources through the full URL.
  1298. * @param url The external path to load the file.
  1299. * @param compFunc Call back function. Example:compFunc(data,url):void。
  1300. * @param thisObject This pointer of call back function.
  1301. * @param type File type (optional). Use the static constants defined in the ResourceItem class. If you do not set the file name extension.
  1302. * @version Egret 2.4
  1303. * @platform Web,Native
  1304. * @includeExample extension/resource/GetResByUrl.ts
  1305. */
  1306. /**
  1307. * @language zh_CN
  1308. * 通过完整URL方式获取外部资源。
  1309. * @param url 要加载文件的外部路径。
  1310. * @param compFunc 回调函数。示例:compFunc(data,url):void。
  1311. * @param thisObject 回调函数的 this 引用。
  1312. * @param type 文件类型(可选)。请使用 ResourceItem 类中定义的静态常量。若不设置将根据文件扩展名生成。
  1313. * @version Egret 2.4
  1314. * @platform Web,Native
  1315. * @includeExample extension/resource/GetResByUrl.ts
  1316. */
  1317. function getResByUrl(url: string, compFunc: Function, thisObject: any, type?: string): void;
  1318. /**
  1319. * @language en_US
  1320. * Destroy a single resource file or a set of resources to the cache data, to return whether to delete success.
  1321. * @param name Name attribute or resource group name of the load item in the configuration file.
  1322. * @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.
  1323. * @returns Are successful destruction.
  1324. * @see #setMaxRetryTimes
  1325. * @version Egret 2.4
  1326. * @platform Web,Native
  1327. */
  1328. /**
  1329. * @language zh_CN
  1330. * 销毁单个资源文件或一组资源的缓存数据,返回是否删除成功。
  1331. * @param name 配置文件中加载项的name属性或资源组名。
  1332. * @param force 销毁一个资源组时其他资源组有同样资源情况资源是否会被删除,默认值 true。
  1333. * @see #setMaxRetryTimes
  1334. * @returns 是否销毁成功。
  1335. * @version Egret 2.4
  1336. * @platform Web,Native
  1337. */
  1338. function destroyRes(name: string, force?: boolean): boolean;
  1339. /**
  1340. * @language en_US
  1341. * Sets the maximum number of concurrent load threads, the default value is 2.
  1342. * @param thread The number of concurrent loads to be set.
  1343. * @see #setMaxRetryTimes
  1344. * @version Egret 2.4
  1345. * @platform Web,Native
  1346. */
  1347. /**
  1348. * @language zh_CN
  1349. * 设置最大并发加载线程数量,默认值是 2。
  1350. * @param thread 要设置的并发加载数。
  1351. * @see #setMaxRetryTimes
  1352. * @version Egret 2.4
  1353. * @platform Web,Native
  1354. */
  1355. function setMaxLoadingThread(thread: number): void;
  1356. /**
  1357. * @language en_US
  1358. * Sets the number of retry times when the resource failed to load, and the default value is 3.
  1359. * @param retry To set the retry count.
  1360. * @includeExample extension/resource/Resource.ts
  1361. * @version Egret 2.4
  1362. * @platform Web,Native
  1363. */
  1364. /**
  1365. * @language zh_CN
  1366. * 设置资源加载失败时的重试次数,默认值是 3。
  1367. * @param retry 要设置的重试次数。
  1368. * @includeExample extension/resource/Resource.ts
  1369. * @version Egret 2.4
  1370. * @platform Web,Native
  1371. */
  1372. function setMaxRetryTimes(retry: number): void;
  1373. /**
  1374. * @language en_US
  1375. * Add event listeners, reference ResourceEvent defined constants.
  1376. * @param type Event name。
  1377. * @param listener Listener functions for handling events. This function must accept the Event object as its only parameter, and can't return any results,
  1378. * As shown in the following example: function (evt:Event):void can have any name.
  1379. * @param thisObject The this object that is bound to a function.
  1380. * @param useCapture Determine the listener is running on the capture or running on the target and the bubbling phase. Set useCapture to true,
  1381. * then the listener in the capture phase processing events, but not in the target or the bubbling phase processing events.
  1382. * If useCapture is false, then the listener only in the target or the bubbling phase processing events.
  1383. * 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.
  1384. * @param priority Event listener priority. Priority is specified by a 32 - bit integer with a symbol. The higher the number, the higher the priority.
  1385. * All listeners with a priority for n will be processed before the -1 n listener.
  1386. * 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.
  1387. * @see RES.ResourceEvent
  1388. * @version Egret 2.4
  1389. * @platform Web,Native
  1390. */
  1391. /**
  1392. * @language zh_CN
  1393. * 添加事件侦听器,参考 ResourceEvent 定义的常量。
  1394. * @param type 事件的类型。
  1395. * @param listener 处理事件的侦听器函数。此函数必须接受 Event 对象作为其唯一的参数,并且不能返回任何结果,
  1396. * 如下面的示例所示: function(evt:Event):void 函数可以有任何名称。
  1397. * @param thisObject 侦听函数绑定的 this 对象。
  1398. * @param useCapture 确定侦听器是运行于捕获阶段还是运行于目标和冒泡阶段。如果将 useCapture 设置为 true,
  1399. * 则侦听器只在捕获阶段处理事件,而不在目标或冒泡阶段处理事件。如果 useCapture 为 false,则侦听器只在目标或冒泡阶段处理事件。
  1400. * 要在所有三个阶段都侦听事件,请调用 addEventListener 两次:一次将 useCapture 设置为 true,一次将 useCapture 设置为 false。
  1401. * @param priority 事件侦听器的优先级。优先级由一个带符号的 32 位整数指定。数字越大,优先级越高。优先级为 n 的所有侦听器会在
  1402. * 优先级为 n -1 的侦听器之前得到处理。如果两个或更多个侦听器共享相同的优先级,则按照它们的添加顺序进行处理。默认优先级为 0。
  1403. * @see RES.ResourceEvent
  1404. * @see #setMaxRetryTimes
  1405. * @version Egret 2.4
  1406. * @platform Web,Native
  1407. */
  1408. function addEventListener(type: string, listener: (event: egret.Event) => void, thisObject: any, useCapture?: boolean, priority?: number): void;
  1409. /**
  1410. * @language en_US
  1411. * Remove event listeners, reference ResourceEvent defined constants.
  1412. * @param type Event name。
  1413. * @param listener Listening function。
  1414. * @param thisObject The this object that is bound to a function.
  1415. * @param useCapture Is used to capture, and this property is only valid in the display list.
  1416. * @version Egret 2.4
  1417. * @platform Web,Native
  1418. */
  1419. /**
  1420. * @language zh_CN
  1421. * 移除事件侦听器,参考ResourceEvent定义的常量。
  1422. * @param type 事件名。
  1423. * @param listener 侦听函数。
  1424. * @param thisObject 侦听函数绑定的this对象。
  1425. * @param useCapture 是否使用捕获,这个属性只在显示列表中生效。
  1426. * @version Egret 2.4
  1427. * @platform Web,Native
  1428. */
  1429. function removeEventListener(type: string, listener: (event: egret.Event) => void, thisObject: any, useCapture?: boolean): void;
  1430. function $getVirtualUrl(url: any): any;
  1431. }
  1432. declare namespace RES {
  1433. /**
  1434. * SpriteSheet解析器
  1435. * @private
  1436. */
  1437. class AnimationAnalyzer extends BinAnalyzer {
  1438. constructor();
  1439. /**
  1440. * 一项加载结束
  1441. */
  1442. onLoadFinish(event: egret.Event): void;
  1443. sheetMap: any;
  1444. /**
  1445. * 解析并缓存加载成功的配置文件
  1446. */
  1447. analyzeConfig(resItem: ResourceItem, data: string): string;
  1448. /**
  1449. * 解析并缓存加载成功的位图数据
  1450. */
  1451. analyzeBitmap(resItem: ResourceItem, data: egret.BitmapData): void;
  1452. /**
  1453. * 获取相对位置
  1454. */
  1455. getRelativePath(url: string, file: string): string;
  1456. private parseAnimation(bitmapData, data, name);
  1457. destroyRes(name: string): boolean;
  1458. /**
  1459. * ImageLoader对象池
  1460. */
  1461. private recyclerIamge;
  1462. private loadImage(url, data);
  1463. private getImageLoader();
  1464. }
  1465. }
  1466. declare namespace egret {
  1467. }
  1468. declare namespace egret {
  1469. }