美素佳儿 litter wizard小游戏
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

2535 lines
78KB

  1. declare namespace egret {
  2. /**
  3. * @version Egret 2.4
  4. * @platform Web,Native
  5. * @private
  6. */
  7. class FrameLabel extends EventDispatcher {
  8. /**
  9. * @private
  10. */
  11. private _name;
  12. /**
  13. * @private
  14. */
  15. private _frame;
  16. /**
  17. * @private
  18. */
  19. private _end;
  20. /**
  21. * @version Egret 2.4
  22. * @platform Web,Native
  23. */
  24. constructor(name: string, frame: number, end?: number);
  25. /**
  26. * @language en_US
  27. * Frame number
  28. * @version Egret 2.4
  29. * @platform Web,Native
  30. */
  31. /**
  32. * @language zh_CN
  33. * 标签名
  34. * @version Egret 2.4
  35. * @platform Web,Native
  36. */
  37. name: string;
  38. /**
  39. * @language en_US
  40. * Frame serial number of the label
  41. * @version Egret 2.4
  42. * @platform Web,Native
  43. */
  44. /**
  45. * @language zh_CN
  46. * 标签所在帧序号
  47. * @version Egret 2.4
  48. * @platform Web,Native
  49. */
  50. frame: number;
  51. /**
  52. * @language en_US
  53. * Frame serial number, the end of the label
  54. * @version Egret 2.4
  55. * @platform Web,Native
  56. */
  57. /**
  58. * @language zh_CN
  59. * 标签对应的结束帧序号
  60. * @version Egret 2.4
  61. * @platform Web,Native
  62. */
  63. end: number;
  64. /**
  65. * @language en_US
  66. * Duplicate the current frame label object
  67. * @version Egret 2.4
  68. * @platform Web,Native
  69. */
  70. /**
  71. * @language zh_CN
  72. * 复制当前帧标签对象
  73. * @version Egret 2.4
  74. * @platform Web,Native
  75. */
  76. clone(): FrameLabel;
  77. }
  78. }
  79. declare namespace egret {
  80. /**
  81. * @language en_US
  82. * @version Egret 2.4
  83. * @platform Web,Native
  84. * @includeExample extension/game/display/MovieClip.ts
  85. */
  86. /**
  87. * @language zh_CN
  88. * 影片剪辑,可以通过影片剪辑播放序列帧动画。MovieClip 类从以下类继承而来:DisplayObject 和 EventDispatcher。不同于 DisplayObject 对象,MovieClip 对象拥有一个时间轴。
  89. * @extends egret.DisplayObject
  90. * @event egret.Event.COMPLETE 动画播放完成。
  91. * @event egret.Event.LOOP_COMPLETE 动画循环播放完成。
  92. * @see http://edn.egret.com/cn/docs/page/596 MovieClip序列帧动画
  93. * @version Egret 2.4
  94. * @platform Web,Native
  95. * @includeExample extension/game/display/MovieClip.ts
  96. */
  97. class MovieClip extends DisplayObject {
  98. $bitmapData: Texture;
  99. private offsetPoint;
  100. $movieClipData: MovieClipData;
  101. /**
  102. * @private
  103. */
  104. private frames;
  105. /**
  106. * @private
  107. */
  108. $totalFrames: number;
  109. /**
  110. * @version Egret 2.4
  111. * @platform Web,Native
  112. * @private
  113. */
  114. frameLabels: any[];
  115. /**
  116. * @private
  117. */
  118. $frameLabelStart: number;
  119. /**
  120. * @private
  121. */
  122. $frameLabelEnd: number;
  123. /**
  124. * @version Egret 2.4
  125. * @platform Web,Native
  126. * @private
  127. */
  128. frameEvents: any[];
  129. /**
  130. * @private
  131. */
  132. private frameIntervalTime;
  133. /**
  134. * @private
  135. */
  136. $eventPool: string[];
  137. $isPlaying: boolean;
  138. /**
  139. * @private
  140. */
  141. private isStopped;
  142. /**
  143. * @private
  144. */
  145. private playTimes;
  146. /**
  147. * @private
  148. */
  149. $currentFrameNum: number;
  150. /**
  151. * @private
  152. */
  153. $nextFrameNum: number;
  154. /**
  155. * @private
  156. */
  157. private displayedKeyFrameNum;
  158. /**
  159. * @private
  160. */
  161. private passedTime;
  162. /**
  163. * @private
  164. */
  165. private $frameRate;
  166. /**
  167. * 创建新的 MovieClip 实例。创建 MovieClip 之后,调用舞台上的显示对象容器的addElement方法。
  168. * @param movieClipData {movieClipData} 被引用的 movieClipData 对象
  169. * @version Egret 2.4
  170. * @platform Web,Native
  171. */
  172. constructor(movieClipData?: MovieClipData);
  173. /**
  174. * @private
  175. */
  176. $smoothing: boolean;
  177. /**
  178. * @language en_US
  179. * Whether or not is smoothed when scaled.
  180. * @version Egret 3.0
  181. * @platform Web
  182. */
  183. /**
  184. * @language zh_CN
  185. * 控制在缩放时是否进行平滑处理。
  186. * @version Egret 3.0
  187. * @platform Web
  188. */
  189. smoothing: boolean;
  190. /**
  191. * @private
  192. *
  193. */
  194. $init(): void;
  195. /**
  196. * @private
  197. *
  198. */
  199. $reset(): void;
  200. /**
  201. * @private
  202. *
  203. */
  204. private _initFrame();
  205. /**
  206. * @private
  207. */
  208. $render(): void;
  209. /**
  210. * @private
  211. */
  212. $measureContentBounds(bounds: Rectangle): void;
  213. /**
  214. * @private
  215. *
  216. * @param stage
  217. * @param nestLevel
  218. */
  219. $onAddToStage(stage: Stage, nestLevel: number): void;
  220. /**
  221. * @private
  222. *
  223. */
  224. $onRemoveFromStage(): void;
  225. /**
  226. * @private
  227. * 返回帧标签为指定字符串的FrameLabel对象
  228. * @param labelName {string} 帧标签名
  229. * @param ignoreCase {boolean} 是否忽略大小写,可选参数,默认false
  230. * @returns {egret.FrameLabel} FrameLabel对象
  231. */
  232. private getFrameLabelByName(labelName, ignoreCase?);
  233. /**
  234. * @private
  235. * 根据帧标签,设置开始和结束的帧数
  236. * @param labelName {string} 帧标签名
  237. */
  238. private getFrameStartEnd(labelName);
  239. /**
  240. * @private
  241. * 返回指定序号的帧的FrameLabel对象
  242. * @param frame {number} 帧序号
  243. * @returns {egret.FrameLabel} FrameLabel对象
  244. */
  245. private getFrameLabelByFrame(frame);
  246. /**
  247. * @private
  248. * 返回指定序号的帧对应的FrameLabel对象,如果当前帧没有标签,则返回前面最近的有标签的帧的FrameLabel对象
  249. * @method egret.MovieClip#getFrameLabelForFrame
  250. * @param frame {number} 帧序号
  251. * @returns {egret.FrameLabel} FrameLabel对象
  252. */
  253. private getFrameLabelForFrame(frame);
  254. /**
  255. * 继续播放当前动画
  256. * @param playTimes {number} 播放次数。 参数为整数,可选参数,>=1:设定播放次数,<0:循环播放,默认值 0:不改变播放次数(MovieClip初始播放次数设置为1),
  257. * @version Egret 2.4
  258. * @platform Web,Native
  259. */
  260. play(playTimes?: number): void;
  261. /**
  262. * 暂停播放动画
  263. * @version Egret 2.4
  264. * @platform Web,Native
  265. */
  266. stop(): void;
  267. /**
  268. * 将播放头移到前一帧并停止
  269. * @version Egret 2.4
  270. * @platform Web,Native
  271. */
  272. prevFrame(): void;
  273. /**
  274. * 跳到后一帧并停止
  275. * @version Egret 2.4
  276. * @platform Web,Native
  277. */
  278. nextFrame(): void;
  279. /**
  280. * 将播放头移到指定帧并播放
  281. * @param frame {any} 指定帧的帧号或帧标签
  282. * @param playTimes {number} 播放次数。 参数为整数,可选参数,>=1:设定播放次数,<0:循环播放,默认值 0:不改变播放次数,
  283. * @version Egret 2.4
  284. * @platform Web,Native
  285. */
  286. gotoAndPlay(frame: any, playTimes?: number): void;
  287. /**
  288. * 将播放头移到指定帧并停止
  289. * @param frame {any} 指定帧的帧号或帧标签
  290. * @version Egret 2.4
  291. * @platform Web,Native
  292. */
  293. gotoAndStop(frame: any): void;
  294. /**
  295. * @private
  296. *
  297. * @param frame
  298. */
  299. private gotoFrame(frame);
  300. /**
  301. * @private
  302. */
  303. private lastTime;
  304. /**
  305. * @private
  306. *
  307. * @param advancedTime
  308. * @returns
  309. */
  310. private advanceTime(timeStamp);
  311. /**
  312. * @private
  313. *
  314. */
  315. private advanceFrame();
  316. /**
  317. * @private
  318. *
  319. */
  320. private constructFrame();
  321. /**
  322. * @private
  323. *
  324. */
  325. $renderFrame(): void;
  326. /**
  327. * @private
  328. *
  329. */
  330. private handlePendingEvent();
  331. /**
  332. * MovieClip 实例中帧的总数
  333. * @version Egret 2.4
  334. * @platform Web,Native
  335. */
  336. totalFrames: number;
  337. /**
  338. * MovieClip 实例当前播放的帧的序号
  339. * @version Egret 2.4
  340. * @platform Web,Native
  341. */
  342. currentFrame: number;
  343. /**
  344. * MovieClip 实例当前播放的帧的标签。如果当前帧没有标签,则 currentFrameLabel返回null。
  345. * @version Egret 2.4
  346. * @platform Web,Native
  347. */
  348. currentFrameLabel: string;
  349. /**
  350. * 当前播放的帧对应的标签,如果当前帧没有标签,则currentLabel返回包含标签的先前帧的标签。如果当前帧和先前帧都不包含标签,currentLabel返回null。
  351. * @version Egret 2.4
  352. * @platform Web,Native
  353. */
  354. currentLabel: string;
  355. /**
  356. * MovieClip 实例的帧频
  357. * @version Egret 2.4
  358. * @platform Web,Native
  359. */
  360. frameRate: number;
  361. /**
  362. * MovieClip 实例当前是否正在播放
  363. * @version Egret 2.4
  364. * @platform Web,Native
  365. */
  366. isPlaying: boolean;
  367. /**
  368. * @version Egret 2.4
  369. * @platform Web,Native
  370. */
  371. /**
  372. * MovieClip数据源
  373. */
  374. movieClipData: MovieClipData;
  375. /**
  376. * @private
  377. *
  378. * @param value
  379. */
  380. private setMovieClipData(value);
  381. /**
  382. * @private
  383. *
  384. * @param value
  385. */
  386. private setPlayTimes(value);
  387. /**
  388. * @private
  389. *
  390. * @param value
  391. */
  392. private setIsStopped(value);
  393. }
  394. }
  395. declare namespace egret {
  396. /**
  397. * @classdesc 使用 MovieClipData 类,您可以创建 MovieClip 对象和处理 MovieClip 对象的数据。MovieClipData 一般由MovieClipDataFactory生成
  398. * @see http://edn.egret.com/cn/docs/page/596 MovieClip序列帧动画
  399. * @version Egret 2.4
  400. * @platform Web,Native
  401. */
  402. class MovieClipData extends HashObject {
  403. /**
  404. * @private
  405. * MovieClip数据
  406. */
  407. $mcData: any;
  408. /**
  409. * 总帧数
  410. * @version Egret 2.4
  411. * @platform Web,Native
  412. */
  413. numFrames: number;
  414. /**
  415. * 帧数据列表
  416. * @version Egret 2.4
  417. * @platform Web,Native
  418. */
  419. frames: any[];
  420. /**
  421. * 帧标签列表
  422. * @version Egret 2.4
  423. * @platform Web,Native
  424. */
  425. labels: any[];
  426. /**
  427. * 帧事件列表
  428. * @version Egret 2.4
  429. * @platform Web,Native
  430. */
  431. events: any[];
  432. /**
  433. * 帧率
  434. * @version Egret 2.4
  435. * @platform Web,Native
  436. */
  437. frameRate: number;
  438. /**
  439. * 纹理数据
  440. * @version Egret 2.4
  441. * @platform Web,Native
  442. */
  443. textureData: any;
  444. /**
  445. * 纹理集
  446. * @version Egret 2.4
  447. * @platform Web,Native
  448. */
  449. spriteSheet: SpriteSheet;
  450. /**
  451. * 创建一个 egret.MovieClipData 对象
  452. * @version Egret 2.4
  453. * @platform Web,Native
  454. */
  455. constructor();
  456. /**
  457. * @private
  458. *
  459. * @param mcData
  460. * @param textureData
  461. * @param spriteSheet
  462. */
  463. $init(mcData: any, textureData: any, spriteSheet: SpriteSheet): void;
  464. /**
  465. * 根据指定帧序号获取该帧对应的关键帧数据
  466. * @param frame {number} 帧序号
  467. * @returns {any} 帧数据对象
  468. * @version Egret 2.4
  469. * @platform Web,Native
  470. */
  471. getKeyFrameData(frame: number): any;
  472. /**
  473. * 根据指定帧序号获取该帧对应的Texture对象
  474. * @param frame {number} 帧序号
  475. * @returns {egret.Texture} Texture对象
  476. * @version Egret 2.4
  477. * @platform Web,Native
  478. */
  479. getTextureByFrame(frame: number): Texture;
  480. $getOffsetByFrame(frame: number, point: Point): void;
  481. /**
  482. * @private
  483. *
  484. * @param resName
  485. * @returns
  486. */
  487. private getTextureByResName(resName);
  488. /**
  489. * @private
  490. *
  491. * @returns
  492. */
  493. $isDataValid(): boolean;
  494. /**
  495. * @private
  496. *
  497. * @returns
  498. */
  499. $isTextureValid(): boolean;
  500. /**
  501. * @private
  502. *
  503. * @param mcData
  504. */
  505. $fillMCData(mcData: any): void;
  506. /**
  507. * @private
  508. *
  509. * @param framesData
  510. */
  511. private fillFramesData(framesData);
  512. /**
  513. * @private
  514. *
  515. * @param frameLabelsData
  516. */
  517. private fillFrameLabelsData(frameLabelsData);
  518. /**
  519. * @private
  520. *
  521. * @param frameEventsData
  522. */
  523. private fillFrameEventsData(frameEventsData);
  524. /**
  525. * @version Egret 2.4
  526. * @platform Web,Native
  527. */
  528. /**
  529. * MovieClip数据源
  530. */
  531. mcData: MovieClipData;
  532. /**
  533. * @private
  534. *
  535. * @param value
  536. */
  537. private setMCData(value);
  538. }
  539. }
  540. declare namespace egret {
  541. /**
  542. * @classdesc 使用 MovieClipDataFactory 类,可以生成 MovieClipData 对象用于创建MovieClip
  543. * @see http://edn.egret.com/cn/docs/page/596 MovieClip序列帧动画
  544. * @version Egret 2.4
  545. * @platform Web,Native
  546. */
  547. class MovieClipDataFactory extends EventDispatcher {
  548. /**
  549. * 是否开启缓存
  550. * @version Egret 2.4
  551. * @platform Web,Native
  552. */
  553. enableCache: boolean;
  554. /**
  555. * @private
  556. */
  557. $mcDataSet: any;
  558. /**
  559. * @private
  560. */
  561. $spriteSheet: SpriteSheet;
  562. /**
  563. * @private
  564. */
  565. $mcDataCache: any;
  566. /**
  567. * 创建一个 egret.MovieClipDataFactory 对象
  568. * @param movieClipDataSet {any} MovieClip数据集,该数据集必须由Egret官方工具生成
  569. * @param texture {Texture} 纹理
  570. * @version Egret 2.4
  571. * @platform Web,Native
  572. */
  573. constructor(movieClipDataSet?: any, texture?: Texture);
  574. /**
  575. * 清空缓存
  576. * @version Egret 2.4
  577. * @platform Web,Native
  578. */
  579. clearCache(): void;
  580. /**
  581. * 根据名字生成一个MovieClipData实例。可以用于创建MovieClip。
  582. * @param movieClipName {string} MovieClip名字. 可选参数,默认为"", 相当于取第一个MovieClip数据
  583. * @returns {MovieClipData} 生成的MovieClipData对象
  584. * @version Egret 2.4
  585. * @platform Web,Native
  586. */
  587. generateMovieClipData(movieClipName?: string): MovieClipData;
  588. /**
  589. * @private
  590. *
  591. * @param movieClipName
  592. * @param cache
  593. * @returns
  594. */
  595. private findFromCache(movieClipName, cache);
  596. /**
  597. * @private
  598. *
  599. * @param movieClipName
  600. * @param movieClip
  601. * @param cache
  602. */
  603. private fillData(movieClipName, movieClip, cache);
  604. /**
  605. * MovieClip数据集
  606. * @version Egret 2.4
  607. * @platform Web,Native
  608. */
  609. mcDataSet: any;
  610. /**
  611. * MovieClip需要使用的纹理图
  612. */
  613. texture: Texture;
  614. /**
  615. * 由纹理图生成的精灵表
  616. * @version Egret 2.4
  617. * @platform Web,Native
  618. */
  619. spriteSheet: SpriteSheet;
  620. /**
  621. * @private
  622. *
  623. * @param value
  624. */
  625. private setTexture(value);
  626. }
  627. }
  628. declare namespace egret {
  629. /**
  630. * @language en_US
  631. * When the movieClip's current frame have a frameLabel, dispatches MovieClipEvent object. FrameLabel Event type: MovieClipEvent.FRAME_LABEL
  632. * @version Egret 2.4
  633. * @platform Web,Native
  634. */
  635. /**
  636. * @language zh_CN
  637. * 当动画的当前帧有事件,将调度 MovieClipEvent 对象。帧事件类型 MovieClipEvent.FRAME_LABEL.
  638. * @version Egret 2.4
  639. * @platform Web,Native
  640. */
  641. class MovieClipEvent extends Event {
  642. /**
  643. * @language en_US
  644. * TextEvent create an object that contains information about movieClip events.
  645. * @param type Type of event, you can access the MovieClipEvent.type.
  646. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  647. * @param cancelable Determine whether the Event object can be canceled. The default value is false.
  648. * @param frameLabel When the current frame have a frameLabel, the event listeners can access this information through the frameLabel property.
  649. * @version Egret 2.4
  650. * @platform Web,Native
  651. */
  652. /**
  653. * @language zh_CN
  654. * 创建一个 MovieClipEvent 对象,其中包含有关帧事件的信息。
  655. * @param type 事件的类型,可以作为 MovieClipEvent.type 访问。
  656. * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
  657. * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
  658. * @param frameLabel 动画上的帧事件。事件侦听器可以通过 frameLabel 属性访问此信息。
  659. * @version Egret 2.4
  660. * @platform Web,Native
  661. */
  662. constructor(type: string, bubbles?: boolean, cancelable?: boolean, frameLabel?: string);
  663. /**
  664. * @language en_US
  665. * Dispatched whenever the current frame have a frameLabel.
  666. * @version Egret 2.4
  667. * @platform Web,Native
  668. */
  669. /**
  670. * @language zh_CN
  671. * 动画的当前帧上有事件时调度
  672. * @version Egret 2.4
  673. * @platform Web,Native
  674. */
  675. static FRAME_LABEL: string;
  676. /**
  677. * @language en_US
  678. * In MovieClipEvent.FRAME_LABEL event, event corresponding string.
  679. * @version Egret 2.4
  680. * @platform Web,Native
  681. */
  682. /**
  683. * @language zh_CN
  684. * 在 MovieClipEvent.FRAME_LABEL 事件中,event对应的字符串。
  685. * @version Egret 2.4
  686. * @platform Web,Native
  687. */
  688. frameLabel: string;
  689. /**
  690. * @language en_US
  691. * EventDispatcher object using the specified event object thrown MovieClipEvent. The objects will be thrown in the object cache pool for the next round robin.
  692. * @param type The type of the event, accessible as Event.type.
  693. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
  694. * @param frameLabel MovieClipEvent object frameLabel
  695. * @version Egret 2.4
  696. * @platform Web,Native
  697. */
  698. /**
  699. * @language zh_CN
  700. * 使用指定的EventDispatcher对象来抛出 MovieClipEvent 事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
  701. * @param target 派发事件目标
  702. * @param type 事件类型
  703. * @param frameLabel MovieClipEvent 对象的 frameLabel 赋值
  704. * @version Egret 2.4
  705. * @platform Web,Native
  706. */
  707. static dispatchMovieClipEvent(target: IEventDispatcher, type: string, frameLabel?: string): boolean;
  708. }
  709. }
  710. declare namespace egret {
  711. /**
  712. * @private
  713. */
  714. class ScrollEase {
  715. /**
  716. * @version Egret 2.4
  717. * @platform Web,Native
  718. */
  719. constructor();
  720. /**
  721. *
  722. * @param amount
  723. * @returns
  724. * @version Egret 2.4
  725. * @platform Web,Native
  726. */
  727. static get(amount: any): Function;
  728. /**
  729. * @version Egret 2.4
  730. * @platform Web,Native
  731. */
  732. static quintOut: Function;
  733. /**
  734. *
  735. * @param pow
  736. * @returns
  737. * @version Egret 2.4
  738. * @platform Web,Native
  739. */
  740. static getPowOut(pow: any): Function;
  741. /**
  742. * @version Egret 2.4
  743. * @platform Web,Native
  744. */
  745. static quartOut: Function;
  746. }
  747. /**
  748. * @private
  749. */
  750. class ScrollTween extends EventDispatcher {
  751. /**
  752. * @private
  753. */
  754. private static _tweens;
  755. /**
  756. * @private
  757. */
  758. private static IGNORE;
  759. /**
  760. * @private
  761. */
  762. private static _plugins;
  763. /**
  764. * @private
  765. */
  766. private static _inited;
  767. /**
  768. * @private
  769. */
  770. private _target;
  771. /**
  772. * @private
  773. */
  774. private _useTicks;
  775. /**
  776. * @private
  777. */
  778. private ignoreGlobalPause;
  779. /**
  780. * @private
  781. */
  782. private loop;
  783. /**
  784. * @private
  785. */
  786. private pluginData;
  787. /**
  788. * @private
  789. */
  790. private _curQueueProps;
  791. /**
  792. * @private
  793. */
  794. private _initQueueProps;
  795. /**
  796. * @private
  797. */
  798. private _steps;
  799. /**
  800. * @private
  801. */
  802. private _actions;
  803. /**
  804. * @private
  805. */
  806. private paused;
  807. /**
  808. * @private
  809. */
  810. private duration;
  811. /**
  812. * @private
  813. */
  814. private _prevPos;
  815. /**
  816. * @private
  817. */
  818. private position;
  819. /**
  820. * @private
  821. */
  822. private _prevPosition;
  823. /**
  824. * @private
  825. */
  826. private _stepPosition;
  827. /**
  828. * @private
  829. */
  830. private passive;
  831. /**
  832. * @language en_US
  833. * Activate an object and add a ScrollTween animation to the object
  834. * @param target {any} The object to be activated
  835. * @param props {any} Parameters, support loop onChange onChangeObj
  836. * @param pluginData {any} Write realized
  837. * @param override {boolean} Whether to remove the object before adding a tween, the default value false
  838. * @version Egret 2.4
  839. * @platform Web,Native
  840. */
  841. /**
  842. * @language zh_CN
  843. * 激活一个对象,对其添加 ScrollTween 动画
  844. * @param target {any} 要激活 ScrollTween 的对象
  845. * @param props {any} 参数,支持loop(循环播放) onChange(变化函数) onChangeObj(变化函数作用域)
  846. * @param pluginData {any} 暂未实现
  847. * @param override {boolean} 是否移除对象之前添加的tween,默认值false
  848. * @version Egret 2.4
  849. * @platform Web,Native
  850. */
  851. static get(target: any, props?: any, pluginData?: any, override?: boolean): ScrollTween;
  852. /**
  853. * @language en_US
  854. * Delete all ScrollTween animations from an object
  855. * @param target The object whose ScrollTween to be deleted
  856. * @version Egret 2.4
  857. * @platform Web,Native
  858. */
  859. /**
  860. * @language zh_CN
  861. * 删除一个对象上的全部 ScrollTween 动画
  862. * @param target 需要移除 ScrollTween 的对象
  863. * @version Egret 2.4
  864. * @platform Web,Native
  865. */
  866. static removeTweens(target: any): void;
  867. /**
  868. * @private
  869. *
  870. * @param delta
  871. * @param paused
  872. */
  873. private static tick(timeStamp, paused?);
  874. private static _lastTime;
  875. /**
  876. * @private
  877. *
  878. * @param tween
  879. * @param value
  880. */
  881. private static _register(tween, value);
  882. /**
  883. * 创建一个 egret.ScrollTween 对象
  884. * @private
  885. * @version Egret 2.4
  886. * @platform Web,Native
  887. */
  888. constructor(target: any, props: any, pluginData: any);
  889. /**
  890. * @private
  891. *
  892. * @param target
  893. * @param props
  894. * @param pluginData
  895. */
  896. private initialize(target, props, pluginData);
  897. /**
  898. * @private
  899. *
  900. * @param value
  901. * @param actionsMode
  902. * @returns
  903. */
  904. private setPosition(value, actionsMode?);
  905. /**
  906. * @private
  907. *
  908. * @param startPos
  909. * @param endPos
  910. * @param includeStart
  911. */
  912. private _runActions(startPos, endPos, includeStart?);
  913. /**
  914. * @private
  915. *
  916. * @param step
  917. * @param ratio
  918. */
  919. private _updateTargetProps(step, ratio);
  920. /**
  921. * @language en_US
  922. * Whether setting is paused
  923. * @param value {boolean} Whether to pause
  924. * @returns ScrollTween object itself
  925. * @version Egret 2.4
  926. * @platform Web,Native
  927. */
  928. /**
  929. * @language zh_CN
  930. * 设置是否暂停
  931. * @param value {boolean} 是否暂停
  932. * @returns Tween对象本身
  933. * @version Egret 2.4
  934. * @platform Web,Native
  935. */
  936. setPaused(value: boolean): ScrollTween;
  937. /**
  938. * @private
  939. *
  940. * @param props
  941. * @returns
  942. */
  943. private _cloneProps(props);
  944. /**
  945. * @private
  946. *
  947. * @param o
  948. * @returns
  949. */
  950. private _addStep(o);
  951. /**
  952. * @private
  953. *
  954. * @param o
  955. * @returns
  956. */
  957. private _appendQueueProps(o);
  958. /**
  959. * @private
  960. *
  961. * @param o
  962. * @returns
  963. */
  964. private _addAction(o);
  965. /**
  966. * @language en_US
  967. * Modify the property of the specified display object to a specified value
  968. * @param props {Object} Property set of an object
  969. * @param duration {number} Duration
  970. * @param ease {egret.ScrollEase} Easing algorithm
  971. * @returns {egret.ScrollTween} ScrollTween object itself
  972. * @version Egret 2.4
  973. * @platform Web,Native
  974. */
  975. /**
  976. * @language zh_CN
  977. * 将指定显示对象的属性修改为指定值
  978. * @param props {Object} 对象的属性集合
  979. * @param duration {number} 持续时间
  980. * @param ease {egret.ScrollEase} 缓动算法
  981. * @returns {egret.ScrollTween} Tween对象本身
  982. * @version Egret 2.4
  983. * @platform Web,Native
  984. */
  985. to(props: any, duration?: number, ease?: Function): ScrollTween;
  986. /**
  987. * @language en_US
  988. * Execute callback function
  989. * @param callback {Function} Callback method
  990. * @param thisObj {any} this action scope of the callback method
  991. * @param params {any[]} Parameter of the callback method
  992. * @returns {egret.ScrollTween} ScrollTween object itself
  993. * @version Egret 2.4
  994. * @platform Web,Native
  995. */
  996. /**
  997. * @language zh_CN
  998. * 执行回调函数
  999. * @param callback {Function} 回调方法
  1000. * @param thisObj {any} 回调方法this作用域
  1001. * @param params {any[]} 回调方法参数
  1002. * @returns {egret.ScrollTween} Tween对象本身
  1003. * @version Egret 2.4
  1004. * @platform Web,Native
  1005. */
  1006. call(callback: Function, thisObj?: any, params?: any[]): ScrollTween;
  1007. /**
  1008. * @method egret.ScrollTween#tick
  1009. * @param delta {number}
  1010. * @private
  1011. * @version Egret 2.4
  1012. * @platform Web,Native
  1013. */
  1014. tick(delta: number): void;
  1015. }
  1016. }
  1017. declare namespace egret {
  1018. /**
  1019. * @language en_US
  1020. * ScrollView auxiliary classes for slides, you will pass a display object constructor. It can display more than the range display object within the specified size range. And can easily drag in this range.
  1021. * @version Egret 2.4
  1022. * @platform Web,Native
  1023. * @includeExample extension/game/display/ScrollView.ts
  1024. */
  1025. /**
  1026. * @language zh_CN
  1027. * ScrollView 是用于滑动的辅助类,将一个显示对象传入构造函数即可。可以在指定的尺寸范围内显示超过该范围的显示对象。并可以在此范围内随意拖动。
  1028. * @version Egret 2.4
  1029. * @platform Web,Native
  1030. * @includeExample extension/game/display/ScrollView.ts
  1031. */
  1032. class ScrollView extends DisplayObjectContainer {
  1033. /**
  1034. * @private
  1035. */
  1036. _ScrV_Props_: ScrollViewProperties;
  1037. /**
  1038. * @language en_US
  1039. * Start rolling threshold when the touch point from the initial touch point at a distance exceeding this value will trigger roll
  1040. * @version Egret 2.4
  1041. * @platform Web,Native
  1042. */
  1043. /**
  1044. * @language zh_CN
  1045. * 开始滚动的阈值,当触摸点偏离初始触摸点的距离超过这个值时才会触发滚动
  1046. * @version Egret 2.4
  1047. * @platform Web,Native
  1048. */
  1049. scrollBeginThreshold: number;
  1050. /**
  1051. * @language en_US
  1052. * Scrolling speed, the speed is required and the default speed ratio.
  1053. * The range of scrollSpeed> 0 assigned to 2:00, the speed is 2 times the default speed
  1054. * @version Egret 2.4
  1055. * @platform Web,Native
  1056. */
  1057. /**
  1058. * @language zh_CN
  1059. * 滚动速度,这个值为需要的速度与默认速度的比值。
  1060. * 取值范围为 scrollSpeed > 0 赋值为 2 时,速度是默认速度的 2 倍
  1061. * @version Egret 2.4
  1062. * @platform Web,Native
  1063. */
  1064. scrollSpeed: number;
  1065. /**
  1066. * @language en_US
  1067. * Whether to enable rebound, rebound When enabled, ScrollView contents allowed to continue to drag the border after arriving at the end user drag operation, and then bounce back boundary position
  1068. * @default true
  1069. * @version Egret 2.4
  1070. */
  1071. /**
  1072. * @language zh_CN
  1073. * 是否启用回弹,当启用回弹后,ScrollView中内容在到达边界后允许继续拖动,在用户拖动操作结束后,再反弹回边界位置
  1074. * @default true
  1075. * @version Egret 2.4
  1076. */
  1077. bounces: boolean;
  1078. /**
  1079. * @language en_US
  1080. * Create a egret.ScrollView objects
  1081. * @param content {egret.DisplayObject} You need to scroll object
  1082. * @version Egret 2.4
  1083. * @platform Web,Native
  1084. */
  1085. /**
  1086. * @language zh_CN
  1087. * 创建一个 egret.ScrollView 对象
  1088. * @param content {egret.DisplayObject} 需要滚动的对象
  1089. * @version Egret 2.4
  1090. * @platform Web,Native
  1091. */
  1092. constructor(content?: DisplayObject);
  1093. /**
  1094. * @private
  1095. */
  1096. _content: DisplayObject;
  1097. /**
  1098. * @language en_US
  1099. * Set to scroll object
  1100. * @param content {egret.DisplayObject} You need to scroll object
  1101. * @version Egret 2.4
  1102. * @platform Web,Native
  1103. */
  1104. /**
  1105. * @language zh_CN
  1106. * 设置需要滚动的对象
  1107. * @param content {egret.DisplayObject} 需要滚动的对象
  1108. * @version Egret 2.4
  1109. * @platform Web,Native
  1110. */
  1111. setContent(content: DisplayObject): void;
  1112. /**
  1113. * @language en_US
  1114. * Remove rolling objects
  1115. * @version Egret 2.4
  1116. * @platform Web,Native
  1117. */
  1118. /**
  1119. * @language zh_CN
  1120. * 移除滚动的对象
  1121. * @version Egret 2.4
  1122. * @platform Web,Native
  1123. */
  1124. removeContent(): void;
  1125. /**
  1126. * @language en_US
  1127. * Vertical scroll bar display policy, on / off / auto.
  1128. * @version Egret 2.4
  1129. * @platform Web,Native
  1130. */
  1131. /**
  1132. * @language zh_CN
  1133. * 垂直滚动条显示策略,on/off/auto。
  1134. * @version Egret 2.4
  1135. * @platform Web,Native
  1136. */
  1137. verticalScrollPolicy: string;
  1138. /**
  1139. * @language en_US
  1140. * The horizontal scroll bar display policy, on / off / auto.
  1141. * @version Egret 2.4
  1142. * @platform Web,Native
  1143. */
  1144. /**
  1145. * @language zh_CN
  1146. * 水平滚动条显示策略,on/off/auto。
  1147. * @version Egret 2.4
  1148. * @platform Web,Native
  1149. */
  1150. horizontalScrollPolicy: string;
  1151. /**
  1152. * @language en_US
  1153. * Gets or sets the horizontal scroll position
  1154. * @returns {number}
  1155. * @version Egret 2.4
  1156. * @platform Web,Native
  1157. */
  1158. /**
  1159. * @language zh_CN
  1160. * 获取或设置水平滚动位置,
  1161. * @returns {number}
  1162. * @version Egret 2.4
  1163. * @platform Web,Native
  1164. */
  1165. scrollLeft: number;
  1166. /**
  1167. * @language en_US
  1168. * Gets or sets the vertical scroll position
  1169. * @returns {number}
  1170. * @version Egret 2.4
  1171. * @platform Web,Native
  1172. */
  1173. /**
  1174. * @language zh_CN
  1175. * 获取或设置垂直滚动位置,
  1176. * @returns {number}
  1177. * @version Egret 2.4
  1178. * @platform Web,Native
  1179. */
  1180. scrollTop: number;
  1181. /**
  1182. * @language en_US
  1183. * Set scroll position
  1184. * @param top {number} The vertical scroll position
  1185. * @param left {number} The horizontal scroll position
  1186. * @param isOffset {boolean} Optional parameter, the default is false, whether it is the amount of scrolling increase as top = 1 on behalf of one pixel scroll up
  1187. * @version Egret 2.4
  1188. * @platform Web,Native
  1189. */
  1190. /**
  1191. * @language zh_CN
  1192. * 设置滚动位置
  1193. * @param top {number} 垂直滚动位置
  1194. * @param left {number} 水平滚动位置
  1195. * @param isOffset {boolean} 可选参数,默认是false,是否是滚动增加量,如 top=1 代表往上滚动1像素
  1196. * @version Egret 2.4
  1197. * @platform Web,Native
  1198. */
  1199. setScrollPosition(top: number, left: number, isOffset?: boolean): void;
  1200. /**
  1201. * @private
  1202. *
  1203. * @param top
  1204. * @param left
  1205. */
  1206. private _validatePosition(top?, left?);
  1207. /**
  1208. * @private
  1209. * @inheritDoc
  1210. */
  1211. $setWidth(value: number): boolean;
  1212. /**
  1213. * @private
  1214. * @inheritDoc
  1215. */
  1216. $setHeight(value: number): boolean;
  1217. /**
  1218. * @private
  1219. *
  1220. */
  1221. _updateContentPosition(): void;
  1222. /**
  1223. * @private
  1224. *
  1225. * @returns
  1226. */
  1227. _checkScrollPolicy(): boolean;
  1228. /**
  1229. * @private
  1230. *
  1231. * @param policy
  1232. * @param contentLength
  1233. * @param viewLength
  1234. * @returns
  1235. */
  1236. private __checkScrollPolicy(policy, contentLength, viewLength);
  1237. /**
  1238. * @private
  1239. *
  1240. * @returns
  1241. */
  1242. _addEvents(): void;
  1243. /**
  1244. * @private
  1245. *
  1246. * @returns
  1247. */
  1248. _removeEvents(): void;
  1249. private _tempStage;
  1250. /**
  1251. * @private
  1252. *
  1253. * @param e
  1254. */
  1255. _onTouchBegin(e: TouchEvent): void;
  1256. /**
  1257. * @private
  1258. */
  1259. private delayTouchBeginEvent;
  1260. /**
  1261. * @private
  1262. */
  1263. private touchBeginTimer;
  1264. /**
  1265. * @private
  1266. *
  1267. * @param event
  1268. */
  1269. _onTouchBeginCapture(event: TouchEvent): void;
  1270. /**
  1271. * @private
  1272. *
  1273. * @param event
  1274. * @returns
  1275. */
  1276. private _onTouchEndCapture(event);
  1277. /**
  1278. * @private
  1279. *
  1280. */
  1281. private _onTouchBeginTimer();
  1282. /**
  1283. * @private
  1284. *
  1285. * @param event
  1286. * @returns
  1287. */
  1288. private dispatchPropagationEvent(event);
  1289. /**
  1290. * @private
  1291. *
  1292. * @param event
  1293. * @returns
  1294. */
  1295. _onTouchMove(event: TouchEvent): void;
  1296. /**
  1297. * @private
  1298. *
  1299. * @param event
  1300. * @returns
  1301. */
  1302. _onTouchEnd(event: TouchEvent): void;
  1303. /**
  1304. * @private
  1305. *
  1306. * @param event
  1307. * @returns
  1308. */
  1309. _onEnterFrame(event: Event): void;
  1310. /**
  1311. * @private
  1312. *
  1313. * @param e
  1314. * @returns
  1315. */
  1316. private _logTouchEvent(e);
  1317. /**
  1318. * @private
  1319. *
  1320. * @param e
  1321. * @returns
  1322. */
  1323. private _getPointChange(e);
  1324. /**
  1325. * @private
  1326. *
  1327. * @param e
  1328. * @returns
  1329. */
  1330. private _calcVelocitys(e);
  1331. /**
  1332. * @private
  1333. *
  1334. * @returns
  1335. */
  1336. _getContentWidth(): number;
  1337. /**
  1338. * @private
  1339. *
  1340. * @returns
  1341. */
  1342. _getContentHeight(): number;
  1343. /**
  1344. * @language en_US
  1345. * The left side of the maximum distance
  1346. * @returns The left side of the maximum distance
  1347. * @version Egret 2.4
  1348. * @platform Web,Native
  1349. */
  1350. /**
  1351. * @language zh_CN
  1352. * 距离左侧的最大值
  1353. * @returns 距离左侧最大值
  1354. * @version Egret 2.4
  1355. * @platform Web,Native
  1356. */
  1357. getMaxScrollLeft(): number;
  1358. /**
  1359. * @language en_US
  1360. * Above the maximum distance
  1361. * @returns Above the maximum distance
  1362. * @version Egret 2.4
  1363. * @platform Web,Native
  1364. */
  1365. /**
  1366. * @language zh_CN
  1367. * 距离上方最大值
  1368. * @returns 距离上方最大值
  1369. * @version Egret 2.4
  1370. * @platform Web,Native
  1371. */
  1372. getMaxScrollTop(): number;
  1373. /**
  1374. * @private
  1375. */
  1376. private static weight;
  1377. /**
  1378. * @private
  1379. *
  1380. */
  1381. private _moveAfterTouchEnd();
  1382. /**
  1383. * @private
  1384. *
  1385. * @param tw
  1386. */
  1387. private onTweenFinished(tw);
  1388. /**
  1389. * @private
  1390. *
  1391. * @returns
  1392. */
  1393. _onScrollStarted(): void;
  1394. /**
  1395. * @private
  1396. *
  1397. * @returns
  1398. */
  1399. _onScrollFinished(): void;
  1400. /**
  1401. * @language en_US
  1402. * Set the scroll position above the distance
  1403. * @param scrollTop Position above distance
  1404. * @param duration Easing of time, in milliseconds
  1405. * @returns Get tween vertical scrolling
  1406. * @version Egret 2.4
  1407. * @platform Web,Native
  1408. */
  1409. /**
  1410. * @language zh_CN
  1411. * 设置滚动距离上方的位置
  1412. * @param scrollTop 距离上方的位置
  1413. * @param duration 缓动时间,毫秒单位
  1414. * @returns 获取垂直滚动的tween
  1415. * @version Egret 2.4
  1416. * @platform Web,Native
  1417. */
  1418. setScrollTop(scrollTop: number, duration?: number): void;
  1419. /**
  1420. * @language en_US
  1421. * Set the scroll position from the left side
  1422. * @param scrollLeft From the position on the left side
  1423. * @param duration Get tween vertical scrolling
  1424. * @returns Gets the horizontal scroll tween
  1425. * @version Egret 2.4
  1426. * @platform Web,Native
  1427. */
  1428. /**
  1429. * @language zh_CN
  1430. * 设置滚动距离左侧的位置
  1431. * @param scrollLeft 距离左侧的位置
  1432. * @param duration 缓动时间,毫秒单位
  1433. * @returns 获取水平滚动的tween
  1434. * @version Egret 2.4
  1435. * @platform Web,Native
  1436. */
  1437. setScrollLeft(scrollLeft: number, duration?: number): void;
  1438. /**
  1439. * @private
  1440. *
  1441. * @param pixelsPerMS
  1442. * @param curPos
  1443. * @param maxPos
  1444. * @returns
  1445. */
  1446. private getAnimationDatas(pixelsPerMS, curPos, maxPos);
  1447. /**
  1448. * @private
  1449. *
  1450. * @param event
  1451. * @returns
  1452. */
  1453. private cloneTouchEvent(event);
  1454. /**
  1455. * @private
  1456. *
  1457. * @returns
  1458. */
  1459. private throwNotSupportedError();
  1460. /**
  1461. * @deprecated
  1462. * @inheritDoc
  1463. * @inheritDoc
  1464. * @version Egret 2.4
  1465. * @platform Web,Native
  1466. */
  1467. addChild(child: DisplayObject): DisplayObject;
  1468. /**
  1469. * @deprecated
  1470. * @inheritDoc
  1471. * @version Egret 2.4
  1472. * @platform Web,Native
  1473. */
  1474. addChildAt(child: DisplayObject, index: number): DisplayObject;
  1475. /**
  1476. * @deprecated
  1477. * @inheritDoc
  1478. * @version Egret 2.4
  1479. * @platform Web,Native
  1480. */
  1481. removeChild(child: DisplayObject): DisplayObject;
  1482. /**
  1483. * @deprecated
  1484. * @inheritDoc
  1485. * @version Egret 2.4
  1486. * @platform Web,Native
  1487. */
  1488. removeChildAt(index: number): DisplayObject;
  1489. /**
  1490. * @deprecated
  1491. * @inheritDoc
  1492. * @version Egret 2.4
  1493. * @platform Web,Native
  1494. */
  1495. setChildIndex(child: DisplayObject, index: number): void;
  1496. /**
  1497. * @deprecated
  1498. * @inheritDoc
  1499. * @version Egret 2.4
  1500. * @platform Web,Native
  1501. */
  1502. swapChildren(child1: DisplayObject, child2: DisplayObject): void;
  1503. /**
  1504. * @deprecated
  1505. * @inheritDoc
  1506. * @version Egret 2.4
  1507. * @platform Web,Native
  1508. */
  1509. swapChildrenAt(index1: number, index2: number): void;
  1510. }
  1511. }
  1512. declare namespace egret {
  1513. /**
  1514. * @private
  1515. * @version Egret 2.4
  1516. * @platform Web,Native
  1517. */
  1518. class ScrollViewProperties {
  1519. /**
  1520. * @private
  1521. */
  1522. _verticalScrollPolicy: string;
  1523. /**
  1524. * @private
  1525. */
  1526. _horizontalScrollPolicy: string;
  1527. /**
  1528. * @private
  1529. */
  1530. _scrollLeft: number;
  1531. /**
  1532. * @private
  1533. */
  1534. _scrollTop: number;
  1535. /**
  1536. * @private
  1537. */
  1538. _hCanScroll: boolean;
  1539. /**
  1540. * @private
  1541. */
  1542. _vCanScroll: boolean;
  1543. /**
  1544. * @private
  1545. */
  1546. _lastTouchPosition: egret.Point;
  1547. /**
  1548. * @private
  1549. */
  1550. _touchStartPosition: egret.Point;
  1551. /**
  1552. * @private
  1553. */
  1554. _scrollStarted: boolean;
  1555. /**
  1556. * @private
  1557. */
  1558. _lastTouchTime: number;
  1559. /**
  1560. * @private
  1561. */
  1562. _lastTouchEvent: TouchEvent;
  1563. /**
  1564. * @private
  1565. */
  1566. _velocitys: Array<{
  1567. x: number;
  1568. y: number;
  1569. }>;
  1570. /**
  1571. * @private
  1572. */
  1573. _isHTweenPlaying: boolean;
  1574. /**
  1575. * @private
  1576. */
  1577. _isVTweenPlaying: boolean;
  1578. /**
  1579. * @private
  1580. */
  1581. _hScrollTween: ScrollTween;
  1582. /**
  1583. * @private
  1584. */
  1585. _vScrollTween: ScrollTween;
  1586. /**
  1587. * @private
  1588. */
  1589. _bounces: boolean;
  1590. }
  1591. }
  1592. declare namespace egret {
  1593. /**
  1594. * @private
  1595. * @version Egret 2.4
  1596. * @platform Web,Native
  1597. */
  1598. interface NetContext extends HashObject {
  1599. /**
  1600. *
  1601. * @param loader
  1602. * @version Egret 2.4
  1603. * @platform Web,Native
  1604. */
  1605. proceed(loader: URLLoader): void;
  1606. }
  1607. /**
  1608. * @private
  1609. * @version Egret 2.4
  1610. * @platform Web,Native
  1611. */
  1612. let NetContext: {
  1613. new (): NetContext;
  1614. getNetContext(): NetContext;
  1615. };
  1616. /**
  1617. * @private
  1618. *
  1619. * @param request
  1620. * @returns
  1621. */
  1622. function $getUrl(request: URLRequest): string;
  1623. }
  1624. declare namespace egret {
  1625. /**
  1626. * @language en_US
  1627. * Run the designated function in specified delay (in milliseconds).
  1628. * @param listener {Function} Listener function
  1629. * @param thisObject {any} this object
  1630. * @param delay {number} Delay time, in milliseconds
  1631. * @param ...args {any} Parameter list
  1632. * @returns {number} Return index which can be used for clearTimeout
  1633. * @version Egret 2.4
  1634. * @platform Web,Native
  1635. * @includeExample extension/game/utils/setTimeout.ts
  1636. */
  1637. /**
  1638. * @language zh_CN
  1639. * 在指定的延迟(以毫秒为单位)后运行指定的函数。
  1640. * @param listener {Function} 侦听函数
  1641. * @param thisObject {any} this对象
  1642. * @param delay {number} 延迟时间,以毫秒为单位
  1643. * @param ...args {any} 参数列表
  1644. * @returns {number} 返回索引,可以用于 clearTimeout
  1645. * @version Egret 2.4
  1646. * @platform Web,Native
  1647. * @includeExample extension/game/utils/setTimeout.ts
  1648. */
  1649. function setTimeout(listener: Function, thisObject: any, delay: number, ...args: any[]): number;
  1650. /**
  1651. * @language en_US
  1652. * Function run after the specified delay is cleared.
  1653. * @param key {number} Index that egret.setTimeout returns
  1654. * @version Egret 2.4
  1655. * @platform Web,Native
  1656. */
  1657. /**
  1658. * @language zh_CN
  1659. * 清除指定延迟后运行的函数。
  1660. * @param key {number} egret.setTimeout所返回的索引
  1661. * @version Egret 2.4
  1662. * @platform Web,Native
  1663. */
  1664. function clearTimeout(key: number): void;
  1665. }
  1666. declare namespace egret {
  1667. /**
  1668. * @language en_US
  1669. * The URLLoaderDataFormat class provides values that specify how downloaded data is received.
  1670. * @see http://edn.egret.com/cn/docs/page/600 Read different data format
  1671. * @version Egret 2.4
  1672. * @platform Web,Native
  1673. * @includeExample extension/game/net/URLLoaderDataFormat.ts
  1674. */
  1675. /**
  1676. * @language zh_CN
  1677. * URLLoaderDataFormat 类提供了一些用于指定如何接收已下载数据的值。
  1678. * @see http://edn.egret.com/cn/docs/page/600 读取不同数据格式
  1679. * @version Egret 2.4
  1680. * @platform Web,Native
  1681. * @includeExample extension/game/net/URLLoaderDataFormat.ts
  1682. */
  1683. class URLLoaderDataFormat {
  1684. /**
  1685. * @language en_US
  1686. * Specify that downloaded data is received as raw binary data.
  1687. * @version Egret 2.4
  1688. * @platform Web
  1689. */
  1690. /**
  1691. * @language zh_CN
  1692. * 指定以原始二进制数据形式接收下载的数据。
  1693. * @version Egret 2.4
  1694. * @platform Web
  1695. */
  1696. static BINARY: string;
  1697. /**
  1698. * @language en_US
  1699. * Specify that downloaded data is received as text.
  1700. * @version Egret 2.4
  1701. * @platform Web,Native
  1702. */
  1703. /**
  1704. * @language zh_CN
  1705. * 指定以文本形式接收已下载的数据。
  1706. * @version Egret 2.4
  1707. * @platform Web,Native
  1708. */
  1709. static TEXT: string;
  1710. /**
  1711. * @language en_US
  1712. * Specify that downloaded data is received as URL-encoded variables.
  1713. * @version Egret 2.4
  1714. * @platform Web,Native
  1715. */
  1716. /**
  1717. * @language zh_CN
  1718. * 指定以 URL 编码变量形式接收下载的数据。
  1719. * @version Egret 2.4
  1720. * @platform Web,Native
  1721. */
  1722. static VARIABLES: string;
  1723. /**
  1724. * @language en_US
  1725. * Specify that downloaded data is received as bitmap texture.
  1726. * @version Egret 2.4
  1727. * @platform Web,Native
  1728. */
  1729. /**
  1730. * @language zh_CN
  1731. * 指定以位图纹理形式接收已下载的数据。
  1732. * @version Egret 2.4
  1733. * @platform Web,Native
  1734. */
  1735. static TEXTURE: string;
  1736. /**
  1737. * @language en_US
  1738. * Specify that downloaded data is received as sound.
  1739. * @version Egret 2.4
  1740. * @platform Web,Native
  1741. */
  1742. /**
  1743. * @language zh_CN
  1744. * 指定以声音形式接收已下载的数据。
  1745. * @version Egret 2.4
  1746. * @platform Web,Native
  1747. */
  1748. static SOUND: string;
  1749. }
  1750. }
  1751. declare namespace egret {
  1752. /**
  1753. * @language en_US
  1754. * The URLRequest class captures all of the information in a single HTTP request.
  1755. * @see http://edn.egret.com/cn/index.php/article/index/id/601 Build communication request
  1756. * @version Egret 2.4
  1757. * @platform Web,Native
  1758. * @includeExample extension/game/net/URLRequest.ts
  1759. */
  1760. /**
  1761. * @language zh_CN
  1762. * URLRequest 类可捕获单个 HTTP 请求中的所有信息。
  1763. * @see http://edn.egret.com/cn/index.php/article/index/id/601 构建通信请求
  1764. * @version Egret 2.4
  1765. * @platform Web,Native
  1766. * @includeExample extension/game/net/URLRequest.ts
  1767. */
  1768. class URLRequest extends HashObject {
  1769. /**
  1770. * @language en_US
  1771. * Create an egret.URLRequest object
  1772. * @param url {string} Addresses for URL requests
  1773. * @version Egret 2.4
  1774. * @platform Web,Native
  1775. */
  1776. /**
  1777. * @language zh_CN
  1778. * 创建一个 egret.URLRequest 对象
  1779. * @param url {string} 进行网络请求的地址
  1780. * @version Egret 2.4
  1781. * @platform Web,Native
  1782. */
  1783. constructor(url?: string);
  1784. /**
  1785. * @language en_US
  1786. * An object contains data to be transmitted with the URL request.
  1787. * This property is used in conjunction with the method property. When the value of method is GET, the value of data is appended to the value of URLRequest.url, using HTTP query-string syntax.
  1788. * When the method value is POST (or any value other than GET), the value of data is transmitted in the body of the HTTP request.
  1789. * The URLRequest API offers binary POST support and support for URL-encoded variables, as well as support for strings. The data object can be a ArrayBuffer, URLVariables, or String object.
  1790. * The way in which the data is used depends on the type of object used:
  1791. * If the object is a ArrayBuffer object, the binary data of the ArrayBuffer object is used as POST data. For GET, data of ArrayBuffer type is not supported.
  1792. * If the object is a URLVariables object and the method is POST, then the variables are encoded using x-www-form-urlencoded format and the resulting string is used as POST data.
  1793. * If the object is a URLVariables object and the method is GET, the URLVariables object will define variables to be sent with the URLRequest object.
  1794. * Otherwise, the object is converted into a string, and the string is used as the POST or GET data.
  1795. * @version Egret 2.4
  1796. * @platform Web,Native
  1797. */
  1798. /**
  1799. * @language zh_CN
  1800. * 一个对象,它包含将随 URL 请求一起传输的数据。
  1801. * 该属性与 method 属性配合使用。当 method 值为 GET 时,将使用 HTTP 查询字符串语法将 data 值追加到 URLRequest.url 值。
  1802. * 当 method 值为 POST(或 GET 之外的任何值)时,将在 HTTP 请求体中传输 data 值。
  1803. * URLRequest API 支持二进制 POST,并支持 URL 编码变量和字符串。该数据对象可以是 ArrayBuffer、URLVariables 或 String 对象。
  1804. * 该数据的使用方式取决于所用对象的类型:
  1805. * 如果该对象为 ArrayBuffer 对象,则 ArrayBuffer 对象的二进制数据用作 POST 数据。对于 GET,不支持 ArrayBuffer 类型的数据。
  1806. * 如果该对象是 URLVariables 对象,并且该方法是 POST,则使用 x-www-form-urlencoded 格式对变量进行编码,并且生成的字符串会用作 POST 数据。
  1807. * 如果该对象是 URLVariables 对象,并且该方法是 GET,则 URLVariables 对象将定义要随 URLRequest 对象一起发送的变量。
  1808. * 否则,该对象会转换为字符串,并且该字符串会用作 POST 或 GET 数据。
  1809. * @version Egret 2.4
  1810. * @platform Web,Native
  1811. */
  1812. data: any;
  1813. /**
  1814. * @language en_US
  1815. * Request method, valid values are URLRequestMethod.GET or URLRequestMethod.POST.
  1816. * @version Egret 2.4
  1817. * @platform Web,Native
  1818. */
  1819. /**
  1820. * @language zh_CN
  1821. * 请求方式,有效值为URLRequestMethod.GET 或 URLRequestMethod.POST。
  1822. * @version Egret 2.4
  1823. * @platform Web,Native
  1824. */
  1825. method: string;
  1826. /**
  1827. * @language en_US
  1828. * The requested URL.
  1829. * @version Egret 2.4
  1830. * @platform Web,Native
  1831. */
  1832. /**
  1833. * @language zh_CN
  1834. * 所请求的 URL。
  1835. * @version Egret 2.4
  1836. * @platform Web,Native
  1837. */
  1838. url: string;
  1839. /**
  1840. * @language en_US
  1841. * The array of HTTP request headers to be appended to the HTTP request. The array is composed of URLRequestHeader objects.
  1842. * Each object in the array must be a URLRequestHeader object that contains a name string and a value string.
  1843. * Because of browser compatibility, this property has not been achieved in html5
  1844. * @version Egret 2.4
  1845. * @platform Web,Native
  1846. */
  1847. /**
  1848. * @language zh_CN
  1849. * 要追加到 HTTP 请求的 HTTP 请求标头的数组。该数组由 URLRequestHeader 对象组成。
  1850. * 数组中的每一对象必须是包含一个名称字符串和一个值字符串的 URLRequestHeader 对象。
  1851. * 由于浏览器兼容性原因,该属性在 html5 中并未实现
  1852. * @version Egret 2.4
  1853. * @platform Web,Native
  1854. */
  1855. requestHeaders: Array<URLRequestHeader>;
  1856. }
  1857. }
  1858. declare namespace egret {
  1859. /**
  1860. * @language en_US
  1861. * A URLRequestHeader object encapsulates a single HTTP request header and consists of a name/value pair. URLRequestHeader objects are used in the requestHeaders property of the URLRequest class.
  1862. * Note: Because of browser compatibility, this property has not been achieved in html5
  1863. * @version Egret 2.4
  1864. * @platform Web,Native
  1865. * @includeExample extension/game/net/URLRequestHeader.ts
  1866. */
  1867. /**
  1868. * @language zh_CN
  1869. * URLRequestHeader 对象封装了一个 HTTP 请求标头并由一个名称/值对组成。URLRequestHeader 对象在 URLRequest 类的 requestHeaders 属性中使用。
  1870. * 注意:由于浏览器兼容性原因,在 html5 中并未实现
  1871. * @version Egret 2.4
  1872. * @platform Web,Native
  1873. * @includeExample extension/game/net/URLRequestHeader.ts
  1874. */
  1875. class URLRequestHeader {
  1876. /**
  1877. * @language en_US
  1878. * HTTP request header name, such as Content-Type
  1879. * @version Egret 2.4
  1880. * @platform Web,Native
  1881. */
  1882. /**
  1883. * @language zh_CN
  1884. * HTTP 请求标头名称,如 Content-Type
  1885. * @version Egret 2.4
  1886. * @platform Web,Native
  1887. */
  1888. name: string;
  1889. /**
  1890. * @language en_US
  1891. * The values associated with the name property (such as text/plain).
  1892. * @version Egret 2.4
  1893. * @platform Web,Native
  1894. */
  1895. /**
  1896. * @language zh_CN
  1897. * 与 name 属性相关联的值,如 text/plain
  1898. * @version Egret 2.4
  1899. * @platform Web,Native
  1900. */
  1901. value: string;
  1902. /**
  1903. * @language en_US
  1904. * Create an egret.URLRequestHeader object
  1905. * @version Egret 2.4
  1906. * @platform Web,Native
  1907. */
  1908. /**
  1909. * @language zh_CN
  1910. * 创建一个 egret.URLRequestHeader 对象
  1911. * @version Egret 2.4
  1912. * @platform Web,Native
  1913. */
  1914. constructor(name: string, value: string);
  1915. }
  1916. }
  1917. declare namespace egret {
  1918. /**
  1919. * @language en_US
  1920. * The URLRequestMethod class provides values that specify whether the
  1921. * URLRequest object should use the POST method or the GET method when sending data to a server.
  1922. * @see http://edn.egret.com/cn/docs/page/599 POST与GET
  1923. * @version Egret 2.4
  1924. * @platform Web,Native
  1925. * @includeExample extension/game/net/URLRequestMethod.ts
  1926. */
  1927. /**
  1928. * @language zh_CN
  1929. * URLRequestMethod 类提供了一些值,这些值可指定在将数据发送到服务器时,
  1930. * URLRequest 对象应使用 POST 方法还是 GET 方法。
  1931. * @see http://edn.egret.com/cn/docs/page/599 POST与GET
  1932. * @version Egret 2.4
  1933. * @platform Web,Native
  1934. * @includeExample extension/game/net/URLRequestMethod.ts
  1935. */
  1936. class URLRequestMethod {
  1937. /**
  1938. * @language en_US
  1939. * Specify that the URLRequest object is a GET.
  1940. * @version Egret 2.4
  1941. * @platform Web,Native
  1942. */
  1943. /**
  1944. * @language zh_CN
  1945. * 表示 URLRequest 对象是一个 GET。
  1946. * @version Egret 2.4
  1947. * @platform Web,Native
  1948. */
  1949. static GET: string;
  1950. /**
  1951. * @language en_US
  1952. * Specify that the URLRequest object is a POST.
  1953. * @version Egret 2.4
  1954. * @platform Web,Native
  1955. */
  1956. /**
  1957. * @language zh_CN
  1958. * 表示 URLRequest 对象是一个 POST。
  1959. * @version Egret 2.4
  1960. * @platform Web,Native
  1961. */
  1962. static POST: string;
  1963. }
  1964. }
  1965. declare namespace egret {
  1966. /**
  1967. * @language en_US
  1968. * The URLVariables class allows you to transfer variables between an application and a server.
  1969. * Use URLVariables objects with methods of the URLLoader class and the data property of the URLRequest class.
  1970. * @see http://edn.egret.com/cn/docs/page/598 Send the request with parameters
  1971. * @version Egret 2.4
  1972. * @platform Web,Native
  1973. * @includeExample extension/game/net/URLVariables.ts
  1974. */
  1975. /**
  1976. * @language zh_CN
  1977. * 使用 URLVariables 类可以在应用程序和服务器之间传输变量。
  1978. * 将 URLVariables 对象与 URLLoader 类的方法、URLRequest 类的 data 属性一起使用。
  1979. * @see http://edn.egret.com/cn/docs/page/598 发送带参数的请求
  1980. * @version Egret 2.4
  1981. * @platform Web,Native
  1982. * @includeExample extension/game/net/URLVariables.ts
  1983. */
  1984. class URLVariables extends HashObject {
  1985. /**
  1986. * @language en_US
  1987. * Create an egret.URLVariable object
  1988. * @param source {String} A URL-encoded string containing name/value pairs.
  1989. * @version Egret 2.4
  1990. * @platform Web,Native
  1991. */
  1992. /**
  1993. * @language zh_CN
  1994. * 创建一个 egret.URLVariables 对象
  1995. * @param source {String} 包含名称/值对的 URL 编码的字符串。
  1996. * @version Egret 2.4
  1997. * @platform Web,Native
  1998. */
  1999. constructor(source?: string);
  2000. /**
  2001. * @language en_US
  2002. * Key-value pair data object saved in this URLVariables object
  2003. * @version Egret 2.4
  2004. * @platform Web,Native
  2005. */
  2006. /**
  2007. * @language zh_CN
  2008. * 此 URLVariables 储存的键值对数据对象。
  2009. * @version Egret 2.4
  2010. * @platform Web,Native
  2011. */
  2012. variables: Object;
  2013. /**
  2014. * @language en_US
  2015. * Convert the variable string into the property of this URLVariables.variables object.
  2016. * @param source {string}
  2017. * @version Egret 2.4
  2018. * @platform Web,Native
  2019. */
  2020. /**
  2021. * @language zh_CN
  2022. * 将变量字符串转换为此 URLVariables.variables 对象的属性。
  2023. * @param source {string}
  2024. * @version Egret 2.4
  2025. * @platform Web,Native
  2026. */
  2027. decode(source: string): void;
  2028. /**
  2029. * @language en_US
  2030. * Return a string containing all enumerable variables using the MIME content encoding format : application/x-www-form-urlencoded.
  2031. * @version Egret 2.4
  2032. * @platform Web,Native
  2033. */
  2034. /**
  2035. * @language zh_CN
  2036. * 以 MIME 内容编码格式 application/x-www-form-urlencoded 返回包含所有可枚举变量的字符串。
  2037. * @version Egret 2.4
  2038. * @platform Web,Native
  2039. */
  2040. toString(): string;
  2041. /**
  2042. * @private
  2043. *
  2044. * @param key
  2045. * @param value
  2046. */
  2047. private encodeValue(key, value);
  2048. /**
  2049. * @private
  2050. *
  2051. * @param key
  2052. * @param value
  2053. */
  2054. private encodeArray(key, value);
  2055. }
  2056. }
  2057. declare namespace egret {
  2058. /**
  2059. * @language en_US
  2060. * @version Egret 2.4
  2061. * @platform Web,Native
  2062. * @includeExample extension/game/player/Ticker.ts
  2063. */
  2064. /**
  2065. * @language zh_CN
  2066. * @version Egret 2.4
  2067. * @platform Web,Native
  2068. * @includeExample extension/game/player/Ticker.ts
  2069. */
  2070. class Ticker extends EventDispatcher {
  2071. /**
  2072. * @deprecated
  2073. * @version Egret 2.4
  2074. * @platform Web,Native
  2075. */
  2076. constructor();
  2077. private _timeScale;
  2078. private _paused;
  2079. private _callIndex;
  2080. private _callList;
  2081. private _lastTime;
  2082. private update(timeStamp);
  2083. private callBackList;
  2084. /**
  2085. * 注册帧回调事件,同一函数的重复监听会被忽略。推荐使用 egret.startTick 替代此方法。
  2086. * @method egret.Ticker#register
  2087. * @param listener {Function} 帧回调函数,参数返回上一帧和这帧的间隔时间。示例:onEnterFrame(frameTime:number):void
  2088. * @param thisObject {any} 帧回调函数的this对象
  2089. * @param priority {number} 事件优先级,开发者请勿传递 Number.NEGATIVE_INFINITY 和 Number.POSITIVE_INFINITY
  2090. * @version Egret 2.4
  2091. * @platform Web,Native
  2092. * @deprecated
  2093. */
  2094. register(listener: Function, thisObject: any, priority?: number): void;
  2095. /**
  2096. * 取消侦听enterFrame事件。推荐使用 egret.stopTick 替代此方法。
  2097. * @method egret.Ticker#unregister
  2098. * @param listener {Function} 事件侦听函数
  2099. * @param thisObject {any} 侦听函数的this对象
  2100. * @version Egret 2.4
  2101. * @platform Web,Native
  2102. * @deprecated
  2103. */
  2104. unregister(listener: Function, thisObject: any): void;
  2105. /**
  2106. * @deprecated
  2107. * @param timeScale {number}
  2108. * @private
  2109. */
  2110. setTimeScale(timeScale: number): void;
  2111. /**
  2112. * @deprecated
  2113. * @method egret.Ticker#getTimeScale
  2114. * @private
  2115. */
  2116. getTimeScale(): number;
  2117. /**
  2118. * 暂停
  2119. * @deprecated
  2120. * @method egret.Ticker#pause
  2121. */
  2122. pause(): void;
  2123. /**
  2124. * 继续
  2125. * @deprecated
  2126. * @method egret.Ticker#resume
  2127. */
  2128. resume(): void;
  2129. /**
  2130. * @private
  2131. */
  2132. private static instance;
  2133. /**
  2134. * @method egret.Ticker.getInstance
  2135. * @returns {Ticker}
  2136. * @version Egret 2.4
  2137. * @platform Web,Native
  2138. * @deprecated
  2139. */
  2140. static getInstance(): egret.Ticker;
  2141. }
  2142. }
  2143. declare namespace egret {
  2144. /**
  2145. * @class egret.MainContext
  2146. * @classdesc
  2147. * MainContext是游戏的核心跨平台接口,组合了多个功能Context,并是游戏启动的主入口
  2148. * @extends egret.EventDispatcher
  2149. * @private
  2150. * @version Egret 2.4
  2151. * @platform Web,Native
  2152. */
  2153. class MainContext extends EventDispatcher {
  2154. /**
  2155. * @version Egret 2.4
  2156. * @platform Web,Native
  2157. */
  2158. constructor();
  2159. /**
  2160. * 渲染Context
  2161. * @member egret.MainContext#rendererContext
  2162. * @version Egret 2.4
  2163. * @platform Web,Native
  2164. */
  2165. /**
  2166. * 触摸Context
  2167. * @member egret.MainContext#touchContext
  2168. * @version Egret 2.4
  2169. * @platform Web,Native
  2170. */
  2171. /**
  2172. * 网络Context
  2173. * @member egret.MainContext#netContext
  2174. * @version Egret 2.4
  2175. * @platform Web,Native
  2176. */
  2177. /**
  2178. * 设备divice
  2179. * @member egret.MainContext#deviceContext
  2180. * @version Egret 2.4
  2181. * @platform Web,Native
  2182. */
  2183. /**
  2184. * 舞台
  2185. * @member egret.MainContext#stage
  2186. * @version Egret 2.4
  2187. * @platform Web,Native
  2188. */
  2189. stage: Stage;
  2190. /**
  2191. * @version Egret 2.4
  2192. * @platform Web,Native
  2193. */
  2194. static deviceType: string;
  2195. /**
  2196. * @version Egret 2.4
  2197. * @platform Web,Native
  2198. */
  2199. static DEVICE_PC: string;
  2200. /**
  2201. * @version Egret 2.4
  2202. * @platform Web,Native
  2203. */
  2204. static DEVICE_MOBILE: string;
  2205. /**
  2206. * @private
  2207. */
  2208. static _runtimeType: string;
  2209. /**
  2210. * @version Egret 2.4
  2211. * @platform Web,Native
  2212. */
  2213. static runtimeType: string;
  2214. /**
  2215. * @version Egret 2.4
  2216. * @platform Web,Native
  2217. */
  2218. static RUNTIME_HTML5: string;
  2219. /**
  2220. * @version Egret 2.4
  2221. * @platform Web,Native
  2222. */
  2223. static RUNTIME_NATIVE: string;
  2224. /**
  2225. * 游戏启动,开启主循环,参考Flash的滑动跑道模型
  2226. * @method egret.MainContext#run
  2227. * @version Egret 2.4
  2228. * @platform Web,Native
  2229. */
  2230. run(): void;
  2231. /**
  2232. * @private
  2233. */
  2234. private static _instance;
  2235. /**
  2236. * @method egret.Ticker.getInstance
  2237. * @returns {Ticker}
  2238. * @version Egret 2.4
  2239. * @platform Web,Native
  2240. */
  2241. static instance: egret.MainContext;
  2242. }
  2243. }
  2244. /**
  2245. * @private
  2246. */
  2247. declare let testDeviceType1: () => boolean;
  2248. /**
  2249. * @private
  2250. */
  2251. declare let testRuntimeType1: () => boolean;
  2252. declare namespace egret {
  2253. /**
  2254. * @language en_US
  2255. * Tool class for object cache repeat use, which can be used to construct an object pool. Objects are automatically recycled after a certain duration.
  2256. * @version Egret 2.4
  2257. * @platform Web,Native
  2258. * @includeExample extension/game/utils/Recycler.ts
  2259. * @private
  2260. */
  2261. /**
  2262. * @language zh_CN
  2263. * 对象缓存复用工具类,可用于构建对象池,一段时间后会自动回收对象。
  2264. * @version Egret 2.4
  2265. * @platform Web,Native
  2266. * @includeExample extension/game/utils/Recycler.ts
  2267. * @private
  2268. */
  2269. class Recycler extends HashObject {
  2270. /**
  2271. * @language en_US
  2272. * Create an egret.Recycler object
  2273. * @param autoDisposeTime {number} Number of frames when objects are destroyed automatically. Default value: 300
  2274. * @version Egret 2.4
  2275. * @platform Web,Native
  2276. */
  2277. /**
  2278. * @language zh_CN
  2279. * 创建一个 egret.Recycler 对象
  2280. * @param autoDisposeTime {number} 多少帧后自动销毁对象,默认值300
  2281. * @version Egret 2.4
  2282. * @platform Web,Native
  2283. */
  2284. constructor(autoDisposeTime?: number);
  2285. /**
  2286. * @private
  2287. */
  2288. static _callBackList: any[];
  2289. static $init(): void;
  2290. static onUpdate(timeStamp: number): boolean;
  2291. /**
  2292. * @private
  2293. * 多少帧后自动销毁对象。
  2294. */
  2295. private autoDisposeTime;
  2296. /**
  2297. * @private
  2298. */
  2299. private frameCount;
  2300. /**
  2301. * @private
  2302. *
  2303. */
  2304. $checkFrame(): void;
  2305. /**
  2306. * @private
  2307. */
  2308. private objectPool;
  2309. /**
  2310. * @private
  2311. */
  2312. private _length;
  2313. /**
  2314. * @language en_US
  2315. * Number of cached objects"
  2316. * @version Egret 2.4
  2317. * @platform Web,Native
  2318. */
  2319. /**
  2320. * @language zh_CN
  2321. * 缓存的对象数量
  2322. * @version Egret 2.4
  2323. * @platform Web,Native
  2324. */
  2325. length: number;
  2326. /**
  2327. * @language en_US
  2328. * Cache an object for repeat use
  2329. * @param object {any} The object to be cached
  2330. * @version Egret 2.4
  2331. * @platform Web,Native
  2332. */
  2333. /**
  2334. * @language zh_CN
  2335. * 缓存一个对象以复用
  2336. * @param object {any} 需要缓存的对象
  2337. * @version Egret 2.4
  2338. * @platform Web,Native
  2339. */
  2340. push(object: any): void;
  2341. /**
  2342. * @language en_US
  2343. * Obtain a cached object
  2344. * @returns {any} The obtained cached object
  2345. * @version Egret 2.4
  2346. * @platform Web,Native
  2347. */
  2348. /**
  2349. * @language zh_CN
  2350. * 获取一个缓存的对象
  2351. * @returns {any} 获得的缓存对象
  2352. * @version Egret 2.4
  2353. * @platform Web,Native
  2354. */
  2355. pop(): any;
  2356. /**
  2357. * @language en_US
  2358. * Immediately clear all cached objects.
  2359. * @version Egret 2.4
  2360. * @platform Web,Native
  2361. */
  2362. /**
  2363. * @language zh_CN
  2364. * 立即清空所有缓存的对象。
  2365. * @version Egret 2.4
  2366. * @platform Web,Native
  2367. */
  2368. dispose(): void;
  2369. }
  2370. }
  2371. declare namespace egret {
  2372. /**
  2373. * @language en_US
  2374. * To specify a delay (in milliseconds) calls the function specified interval loop.
  2375. * @param listener {Function} Listener function
  2376. * @param thisObject {any} this object
  2377. * @param delay {number} Delay time, in milliseconds
  2378. * @param ...args {any} Parameter list
  2379. * @returns {number} Return index which can be used for clearInterval
  2380. * @version Egret 2.4
  2381. * @platform Web,Native
  2382. * @includeExample extension/game/utils/setInterval.ts
  2383. */
  2384. /**
  2385. * @language zh_CN
  2386. * 以指定的延迟(以毫秒为单位)间隔循环调用指定的函数。
  2387. * @param listener {Function} 侦听函数
  2388. * @param thisObject {any} this对象
  2389. * @param delay {number} 延迟时间,以毫秒为单位
  2390. * @param ...args {any} 参数列表
  2391. * @returns {number} 返回索引,可以用于 clearInterval
  2392. * @version Egret 2.4
  2393. * @platform Web,Native
  2394. * @includeExample extension/game/utils/setInterval.ts
  2395. */
  2396. function setInterval(listener: Function, thisObject: any, delay: number, ...args: any[]): number;
  2397. /**
  2398. * @language en_US
  2399. * Clear function to run after a specified delay.
  2400. * @param key {number} Index that egret.setInterval returns
  2401. * @version Egret 2.4
  2402. * @platform Web,Native
  2403. * @includeExample egret/utils/setInterval.ts
  2404. */
  2405. /**
  2406. * @language zh_CN
  2407. * 清除指定延迟后运行的函数。
  2408. * @param key {number} egret.setInterval所返回的索引
  2409. * @version Egret 2.4
  2410. * @platform Web,Native
  2411. * @includeExample egret/utils/setInterval.ts
  2412. */
  2413. function clearInterval(key: number): void;
  2414. }
  2415. declare namespace egret {
  2416. /**
  2417. * @language en_US
  2418. * UThe URLLoader class downloads data from a URL as text, binary data, or URL-encoded variables. It is useful for downloading text files, XML, or other information to be used in a dynamic, data-driven application.
  2419. * A URLLoader object downloads all of the data from a URL before making it available to code in the applications. It sends out notifications about the progress of the download,
  2420. * which you can monitor through bytesLoaded and bytesTotal properties, as well as through dispatched events.
  2421. * @see http://edn.egret.com/cn/docs/page/601 Build communication request
  2422. * @event egret.Event.COMPLETE Dispatched when the net request is complete.
  2423. * @event egret.IOErrorEvent.IO_ERROR io error.
  2424. * @version Egret 2.4
  2425. * @platform Web,Native
  2426. * @includeExample extension/game/net/URLLoader.ts
  2427. */
  2428. /**
  2429. * @language zh_CN
  2430. * URLLoader 类以文本、二进制数据或 URL 编码变量的形式从 URL 下载数据。在下载文本文件、XML 或其他用于动态数据驱动应用程序的信息时,它很有用。
  2431. * URLLoader 对象会先从 URL 中下载所有数据,然后才将数据用于应用程序中的代码。它会发出有关下载进度的通知,
  2432. * 通过 bytesLoaded 和 bytesTotal 属性以及已调度的事件,可以监视下载进度。
  2433. * @see http://edn.egret.com/cn/docs/page/601 构建通信请求
  2434. * @event egret.Event.COMPLETE 加载完成后调度。
  2435. * @event egret.IOErrorEvent.IO_ERROR 加载错误后调度。
  2436. * @version Egret 2.4
  2437. * @platform Web,Native
  2438. * @includeExample extension/game/net/URLLoader.ts
  2439. */
  2440. class URLLoader extends EventDispatcher {
  2441. /**
  2442. * @language en_US
  2443. * Create an egret.URLLoader object
  2444. * @param request {URLRequest} A URLRequest object specifies the URL to be downloaded.
  2445. * If this parameter is omitted, no load operation begins. If a parameter is specified, the load operation begins immediately
  2446. * @version Egret 2.4
  2447. * @platform Web,Native
  2448. */
  2449. /**
  2450. * @language zh_CN
  2451. * 创建 egret.URLLoader 对象
  2452. * @param request {URLRequest} 一个 URLRequest 对象,指定要下载的 URL。
  2453. * 如果省略该参数,则不开始加载操作。如果已指定参数,则立即开始加载操作
  2454. * @version Egret 2.4
  2455. * @platform Web,Native
  2456. */
  2457. constructor(request?: URLRequest);
  2458. /**
  2459. * @language en_US
  2460. * Control whether the downloaded data is received as text (URLLoaderDataFormat.TEXT), raw binary data (URLLoaderDataFormat.BINARY), or URL-encoded variables (URLLoaderDataFormat.VARIABLES).
  2461. * If the value of the dataFormat property is URLLoaderDataFormat.TEXT, the received data is a string containing the text of the loaded file.
  2462. * If the value of the dataFormat property is URLLoaderDataFormat.BINARY, the received data is a ByteArray object containing the raw binary data.
  2463. * If the value of the dataFormat property is URLLoaderDataFormat.TEXTURE, the received data is a Texture object containing the bitmap data.
  2464. * If the value of the dataFormat property is URLLoaderDataFormat.VARIABLES, the received data is a URLVariables object containing the URL-encoded variables.
  2465. * The default value is URLLoaderDataFormat.TEXT.
  2466. * @default egret.URLLoaderDataFormat.TEXT
  2467. * @version Egret 2.4
  2468. * @platform Web,Native
  2469. */
  2470. /**
  2471. * @language zh_CN
  2472. * 控制是以文本 (URLLoaderDataFormat.TEXT)、原始二进制数据 (URLLoaderDataFormat.BINARY) 还是 URL 编码变量 (URLLoaderDataFormat.VARIABLES) 接收下载的数据。
  2473. * 如果 dataFormat 属性的值是 URLLoaderDataFormat.TEXT,则所接收的数据是一个包含已加载文件文本的字符串。
  2474. * 如果 dataFormat 属性的值是 URLLoaderDataFormat.BINARY,则所接收的数据是一个包含原始二进制数据的 ByteArray 对象。
  2475. * 如果 dataFormat 属性的值是 URLLoaderDataFormat.TEXTURE,则所接收的数据是一个包含位图数据的Texture对象。
  2476. * 如果 dataFormat 属性的值是 URLLoaderDataFormat.VARIABLES,则所接收的数据是一个包含 URL 编码变量的 URLVariables 对象。
  2477. * @default egret.URLLoaderDataFormat.TEXT
  2478. * @version Egret 2.4
  2479. * @platform Web,Native
  2480. */
  2481. dataFormat: string;
  2482. /**
  2483. * @language en_US
  2484. * The data received from the load operation. This property is populated only when the load operation is complete. The format of the data depends on the setting of the dataFormat property:
  2485. * If the dataFormat property is URLLoaderDataFormat.TEXT, the received data is a string containing the text of the loaded file.
  2486. * If the dataFormat property is URLLoaderDataFormat.BINARY, the received data is a ByteArray object containing the raw binary data.
  2487. * If the dataFormat property is URLLoaderDataFormat.TEXTURE, the received data is a Texture object containing the bitmap data.
  2488. * If the dataFormat property is URLLoaderDataFormat.VARIABLES, the received data is a URLVariables object containing the URL-encoded variables.
  2489. * @version Egret 2.4
  2490. * @platform Web,Native
  2491. */
  2492. /**
  2493. * @language zh_CN
  2494. * 从加载操作接收的数据。只有完成加载操作时,才会填充该属性。该数据的格式取决于 dataFormat 属性的设置:
  2495. * 如果 dataFormat 属性是 URLLoaderDataFormat.TEXT,则所接收的数据是一个包含已加载文件文本的字符串。
  2496. * 如果 dataFormat 属性是 URLLoaderDataFormat.BINARY,则所接收的数据是一个包含原始二进制数据的 ByteArray 对象。
  2497. * 如果 dataFormat 属性是 URLLoaderDataFormat.TEXTURE,则所接收的数据是一个包含位图数据的Texture对象。
  2498. * 如果 dataFormat 属性是 URLLoaderDataFormat.VARIABLES,则所接收的数据是一个包含 URL 编码变量的 URLVariables 对象。
  2499. * @version Egret 2.4
  2500. * @platform Web,Native
  2501. */
  2502. data: any;
  2503. /**
  2504. * @private
  2505. */
  2506. _request: URLRequest;
  2507. /**
  2508. * @language en_US
  2509. * Send and load data from the specified URL. The data can be received as text, raw binary data, or URL-encoded variables, depending on the value you set for the dataFormat property.
  2510. * Note that the default value of the dataFormat property is text. If you want to send data to the specified URL, you can set the data property in the URLRequest object.
  2511. * @param request {URLRequest} A URLRequest object specifies the URL to be downloaded.
  2512. * @version Egret 2.4
  2513. * @platform Web,Native
  2514. */
  2515. /**
  2516. * @language zh_CN
  2517. * 从指定的 URL 发送和加载数据。可以以文本、原始二进制数据或 URL 编码变量格式接收数据,这取决于为 dataFormat 属性所设置的值。
  2518. * 请注意 dataFormat 属性的默认值为文本。如果想将数据发送至指定的 URL,则可以在 URLRequest 对象中设置 data 属性。
  2519. * @param request {URLRequest} 一个 URLRequest 对象,指定要下载的 URL。
  2520. * @version Egret 2.4
  2521. * @platform Web,Native
  2522. */
  2523. load(request: URLRequest): void;
  2524. /**
  2525. * @private
  2526. */
  2527. _status: number;
  2528. /**
  2529. * @private
  2530. *
  2531. */
  2532. __recycle(): void;
  2533. }
  2534. }