Commit e45a04b2 authored by wildfirecode's avatar wildfirecode

1

parent 233d0e69
......@@ -33,34 +33,10 @@
<script src="libs/modules/eui/eui.js"></script>
<script src="libs/modules/assetsmanager/assetsmanager.js"></script>
<script src="libs/modules/tween/tween.js"></script>
<script src="libs/modules/game/game.min.js"></script>
<script src="libs/modules/promise/promise.js"></script>
<script src="libs/zepto.min.js"></script>
<script src="libs/security.js"></script>
<script src="libs/physics.min.js"></script>
<!-- <script src="default.thm.js"></script> -->
<script src="libs/downloadApp.js"></script>
<script>
localStorage.clear();
var __t0__ = Date.now();
var __debug__ = 1;
var __mode__ = 2;
var __award_thanks_score__ = 0;
var __monkeyHandSize__ = 30;
var __boxMoveSpeed__ = 3*1.5;
var __BOX_CREATE_INTERVAL__ = 60*1.5;
var __boxOpenState__ = 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/openstate.json';
var __boxmap__ = {
coin: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/coin.json', offset: [117, 68] },
gift: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/gift.json', offset: [119, 103] },
gift2: { award: 1, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/gift2.json', offset: [122, 87] },
woodbox: { award: 1, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/woodbox.json', offset: [115, 80] },
silverbox: { award: 3, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/silverbox.json', offset: [147, 77] },
goldenbox: { award: 5, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/goldenbox.json', offset: [130, 88] }
};
var __bgUrl__ = 'resource/assets/startScene/bg.jpg';
var gameId = 1;
var CFG = {
appInfo: {
......
declare namespace egret {
/**
* The URLLoaderDataFormat class provides values that specify how downloaded data is received.
* @see http://edn.egret.com/cn/docs/page/600 Read different data format
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLLoaderDataFormat.ts
* @language en_US
*/
/**
* URLLoaderDataFormat 类提供了一些用于指定如何接收已下载数据的值。
* @see http://edn.egret.com/cn/docs/page/600 读取不同数据格式
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLLoaderDataFormat.ts
* @language zh_CN
*/
class URLLoaderDataFormat {
/**
* Specify that downloaded data is received as raw binary data.
* @version Egret 2.4
* @platform Web
* @language en_US
*/
/**
* 指定以原始二进制数据形式接收下载的数据。
* @version Egret 2.4
* @platform Web
* @language zh_CN
*/
static BINARY: string;
/**
* Specify that downloaded data is received as text.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 指定以文本形式接收已下载的数据。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static TEXT: string;
/**
* Specify that downloaded data is received as URL-encoded variables.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 指定以 URL 编码变量形式接收下载的数据。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static VARIABLES: string;
/**
* Specify that downloaded data is received as bitmap texture.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 指定以位图纹理形式接收已下载的数据。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static TEXTURE: string;
/**
* Specify that downloaded data is received as sound.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 指定以声音形式接收已下载的数据。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static SOUND: string;
}
}
declare namespace egret {
/**
* @version Egret 2.4
* @platform Web,Native
* @private
*/
class FrameLabel extends EventDispatcher {
/**
* @private
*/
private _name;
/**
* @private
*/
private _frame;
/**
* @private
*/
private _end;
/**
* @version Egret 2.4
* @platform Web,Native
*/
constructor(name: string, frame: number, end?: number);
/**
* Frame number
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 标签名
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
readonly name: string;
/**
* Frame serial number of the label
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 标签所在帧序号
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
readonly frame: number;
/**
* Frame serial number, the end of the label
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 标签对应的结束帧序号
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
readonly end: number;
/**
* Duplicate the current frame label object
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 复制当前帧标签对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
clone(): FrameLabel;
}
}
declare namespace egret {
/**
* @classdesc 使用 MovieClipData 类,您可以创建 MovieClip 对象和处理 MovieClip 对象的数据。MovieClipData 一般由MovieClipDataFactory生成
* @see http://edn.egret.com/cn/docs/page/596 MovieClip序列帧动画
* @version Egret 2.4
* @platform Web,Native
*/
class MovieClipData extends HashObject {
/**
* @private
* MovieClip数据
*/
$mcData: any;
/**
* 总帧数
* @version Egret 2.4
* @platform Web,Native
*/
numFrames: number;
/**
* 帧数据列表
* @version Egret 2.4
* @platform Web,Native
*/
frames: any[];
/**
* 帧标签列表
* @version Egret 2.4
* @platform Web,Native
*/
labels: any[];
/**
* 帧事件列表
* @version Egret 2.4
* @platform Web,Native
*/
events: any[];
/**
* 帧率
* @version Egret 2.4
* @platform Web,Native
*/
frameRate: number;
/**
* 纹理数据
* @version Egret 2.4
* @platform Web,Native
*/
textureData: any;
/**
* 纹理集
* @version Egret 2.4
* @platform Web,Native
*/
spriteSheet: SpriteSheet;
/**
* 创建一个 egret.MovieClipData 对象
* @version Egret 2.4
* @platform Web,Native
*/
constructor();
/**
* @private
*
* @param mcData
* @param textureData
* @param spriteSheet
*/
$init(mcData: any, textureData: any, spriteSheet: SpriteSheet): void;
/**
* 根据指定帧序号获取该帧对应的关键帧数据
* @param frame {number} 帧序号
* @returns {any} 帧数据对象
* @version Egret 2.4
* @platform Web,Native
*/
getKeyFrameData(frame: number): any;
/**
* 根据指定帧序号获取该帧对应的Texture对象
* @param frame {number} 帧序号
* @returns {egret.Texture} Texture对象
* @version Egret 2.4
* @platform Web,Native
*/
getTextureByFrame(frame: number): Texture;
$getOffsetByFrame(frame: number, point: Point): void;
/**
* @private
*
* @param resName
* @returns
*/
private getTextureByResName(resName);
/**
* @private
*
* @returns
*/
$isDataValid(): boolean;
/**
* @private
*
* @returns
*/
$isTextureValid(): boolean;
/**
* @private
*
* @param mcData
*/
$fillMCData(mcData: any): void;
/**
* @private
*
* @param framesData
*/
private fillFramesData(framesData);
/**
* @private
*
* @param frameLabelsData
*/
private fillFrameLabelsData(frameLabelsData);
/**
* @private
*
* @param frameEventsData
*/
private fillFrameEventsData(frameEventsData);
/**
* @version Egret 2.4
* @platform Web,Native
*/
/**
* MovieClip数据源
*/
mcData: MovieClipData;
/**
* @private
*
* @param value
*/
private setMCData(value);
}
}
declare namespace egret {
/**
* @classdesc 使用 MovieClipDataFactory 类,可以生成 MovieClipData 对象用于创建MovieClip
* @see http://edn.egret.com/cn/docs/page/596 MovieClip序列帧动画
* @version Egret 2.4
* @platform Web,Native
*/
class MovieClipDataFactory extends EventDispatcher {
/**
* 是否开启缓存
* @version Egret 2.4
* @platform Web,Native
*/
enableCache: boolean;
/**
* @private
*/
$mcDataSet: any;
/**
* @private
*/
$spriteSheet: SpriteSheet;
/**
* @private
*/
$mcDataCache: any;
/**
* 创建一个 egret.MovieClipDataFactory 对象
* @param movieClipDataSet {any} MovieClip数据集,该数据集必须由Egret官方工具生成
* @param texture {Texture} 纹理
* @version Egret 2.4
* @platform Web,Native
*/
constructor(movieClipDataSet?: any, texture?: Texture);
/**
* 清空缓存
* @version Egret 2.4
* @platform Web,Native
*/
clearCache(): void;
/**
* 根据名字生成一个MovieClipData实例。可以用于创建MovieClip。
* @param movieClipName {string} MovieClip名字. 可选参数,默认为"", 相当于取第一个MovieClip数据
* @returns {MovieClipData} 生成的MovieClipData对象
* @version Egret 2.4
* @platform Web,Native
*/
generateMovieClipData(movieClipName?: string): MovieClipData;
/**
* @private
*
* @param movieClipName
* @param cache
* @returns
*/
private findFromCache(movieClipName, cache);
/**
* @private
*
* @param movieClipName
* @param movieClip
* @param cache
*/
private fillData(movieClipName, movieClip, cache);
/**
* MovieClip数据集
* @version Egret 2.4
* @platform Web,Native
*/
mcDataSet: any;
/**
* MovieClip需要使用的纹理图
*/
texture: Texture;
/**
* 由纹理图生成的精灵表
* @version Egret 2.4
* @platform Web,Native
*/
readonly spriteSheet: SpriteSheet;
/**
* @private
*
* @param value
*/
private setTexture(value);
}
}
declare namespace egret {
/**
* When the movieClip's current frame have a frameLabel, dispatches MovieClipEvent object. FrameLabel Event type: MovieClipEvent.FRAME_LABEL
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 当动画的当前帧有事件,将调度 MovieClipEvent 对象。帧事件类型 MovieClipEvent.FRAME_LABEL.
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
class MovieClipEvent extends Event {
/**
* TextEvent create an object that contains information about movieClip events.
* @param type Type of event, you can access the MovieClipEvent.type.
* @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
* @param cancelable Determine whether the Event object can be canceled. The default value is false.
* @param frameLabel When the current frame have a frameLabel, the event listeners can access this information through the frameLabel property.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 创建一个 MovieClipEvent 对象,其中包含有关帧事件的信息。
* @param type 事件的类型,可以作为 MovieClipEvent.type 访问。
* @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。
* @param cancelable 确定是否可以取消 Event 对象。默认值为 false。
* @param frameLabel 动画上的帧事件。事件侦听器可以通过 frameLabel 属性访问此信息。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
constructor(type: string, bubbles?: boolean, cancelable?: boolean, frameLabel?: string);
/**
* Dispatched whenever the current frame have a frameLabel.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 动画的当前帧上有事件时调度
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static FRAME_LABEL: string;
/**
* In MovieClipEvent.FRAME_LABEL event, event corresponding string.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 在 MovieClipEvent.FRAME_LABEL 事件中,event对应的字符串。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
frameLabel: string;
/**
* EventDispatcher object using the specified event object thrown MovieClipEvent. The objects will be thrown in the object cache pool for the next round robin.
* @param type The type of the event, accessible as Event.type.
* @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
* @param frameLabel MovieClipEvent object frameLabel
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 使用指定的EventDispatcher对象来抛出 MovieClipEvent 事件对象。抛出的对象将会缓存在对象池上,供下次循环复用。
* @param target 派发事件目标
* @param type 事件类型
* @param frameLabel MovieClipEvent 对象的 frameLabel 赋值
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static dispatchMovieClipEvent(target: IEventDispatcher, type: string, frameLabel?: string): boolean;
}
}
declare namespace egret {
/**
* @private
*/
class ScrollEase {
/**
* @version Egret 2.4
* @platform Web,Native
*/
constructor();
/**
*
* @param amount
* @returns
* @version Egret 2.4
* @platform Web,Native
*/
static get(amount: any): Function;
/**
* @version Egret 2.4
* @platform Web,Native
*/
static quintOut: Function;
/**
*
* @param pow
* @returns
* @version Egret 2.4
* @platform Web,Native
*/
static getPowOut(pow: any): Function;
/**
* @version Egret 2.4
* @platform Web,Native
*/
static quartOut: Function;
}
/**
* @private
*/
class ScrollTween extends EventDispatcher {
/**
* @private
*/
private static _tweens;
/**
* @private
*/
private static IGNORE;
/**
* @private
*/
private static _plugins;
/**
* @private
*/
private static _inited;
/**
* @private
*/
private _target;
/**
* @private
*/
private _useTicks;
/**
* @private
*/
private ignoreGlobalPause;
/**
* @private
*/
private loop;
/**
* @private
*/
private pluginData;
/**
* @private
*/
private _curQueueProps;
/**
* @private
*/
private _initQueueProps;
/**
* @private
*/
private _steps;
/**
* @private
*/
private _actions;
/**
* @private
*/
private paused;
/**
* @private
*/
private duration;
/**
* @private
*/
private _prevPos;
/**
* @private
*/
private position;
/**
* @private
*/
private _prevPosition;
/**
* @private
*/
private _stepPosition;
/**
* @private
*/
private passive;
/**
* Activate an object and add a ScrollTween animation to the object
* @param target {any} The object to be activated
* @param props {any} Parameters, support loop onChange onChangeObj
* @param pluginData {any} Write realized
* @param override {boolean} Whether to remove the object before adding a tween, the default value false
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 激活一个对象,对其添加 ScrollTween 动画
* @param target {any} 要激活 ScrollTween 的对象
* @param props {any} 参数,支持loop(循环播放) onChange(变化函数) onChangeObj(变化函数作用域)
* @param pluginData {any} 暂未实现
* @param override {boolean} 是否移除对象之前添加的tween,默认值false
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static get(target: any, props?: any, pluginData?: any, override?: boolean): ScrollTween;
/**
* Delete all ScrollTween animations from an object
* @param target The object whose ScrollTween to be deleted
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 删除一个对象上的全部 ScrollTween 动画
* @param target 需要移除 ScrollTween 的对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static removeTweens(target: any): void;
/**
* @private
*
* @param delta
* @param paused
*/
private static tick(timeStamp, paused?);
private static _lastTime;
/**
* @private
*
* @param tween
* @param value
*/
private static _register(tween, value);
/**
* 创建一个 egret.ScrollTween 对象
* @private
* @version Egret 2.4
* @platform Web,Native
*/
constructor(target: any, props: any, pluginData: any);
/**
* @private
*
* @param target
* @param props
* @param pluginData
*/
private initialize(target, props, pluginData);
/**
* @private
*
* @param value
* @param actionsMode
* @returns
*/
private setPosition(value, actionsMode?);
/**
* @private
*
* @param startPos
* @param endPos
* @param includeStart
*/
private _runActions(startPos, endPos, includeStart?);
/**
* @private
*
* @param step
* @param ratio
*/
private _updateTargetProps(step, ratio);
/**
* Whether setting is paused
* @param value {boolean} Whether to pause
* @returns ScrollTween object itself
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 设置是否暂停
* @param value {boolean} 是否暂停
* @returns Tween对象本身
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
setPaused(value: boolean): ScrollTween;
/**
* @private
*
* @param props
* @returns
*/
private _cloneProps(props);
/**
* @private
*
* @param o
* @returns
*/
private _addStep(o);
/**
* @private
*
* @param o
* @returns
*/
private _appendQueueProps(o);
/**
* @private
*
* @param o
* @returns
*/
private _addAction(o);
/**
* Modify the property of the specified display object to a specified value
* @param props {Object} Property set of an object
* @param duration {number} Duration
* @param ease {egret.ScrollEase} Easing algorithm
* @returns {egret.ScrollTween} ScrollTween object itself
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 将指定显示对象的属性修改为指定值
* @param props {Object} 对象的属性集合
* @param duration {number} 持续时间
* @param ease {egret.ScrollEase} 缓动算法
* @returns {egret.ScrollTween} Tween对象本身
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
to(props: any, duration?: number, ease?: Function): ScrollTween;
/**
* Execute callback function
* @param callback {Function} Callback method
* @param thisObj {any} this action scope of the callback method
* @param params {any[]} Parameter of the callback method
* @returns {egret.ScrollTween} ScrollTween object itself
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 执行回调函数
* @param callback {Function} 回调方法
* @param thisObj {any} 回调方法this作用域
* @param params {any[]} 回调方法参数
* @returns {egret.ScrollTween} Tween对象本身
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
call(callback: Function, thisObj?: any, params?: any[]): ScrollTween;
/**
* @method egret.ScrollTween#tick
* @param delta {number}
* @private
* @version Egret 2.4
* @platform Web,Native
*/
tick(delta: number): void;
}
}
declare namespace egret {
/**
* 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.
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/display/ScrollView.ts
* @language en_US
*/
/**
* ScrollView 是用于滑动的辅助类,将一个显示对象传入构造函数即可。可以在指定的尺寸范围内显示超过该范围的显示对象。并可以在此范围内随意拖动。
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/display/ScrollView.ts
* @language zh_CN
*/
class ScrollView extends DisplayObjectContainer {
/**
* @private
*/
_ScrV_Props_: ScrollViewProperties;
/**
* Start rolling threshold when the touch point from the initial touch point at a distance exceeding this value will trigger roll
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 开始滚动的阈值,当触摸点偏离初始触摸点的距离超过这个值时才会触发滚动
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
scrollBeginThreshold: number;
/**
* Scrolling speed, the speed is required and the default speed ratio.
* The range of scrollSpeed> 0 assigned to 2:00, the speed is 2 times the default speed
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 滚动速度,这个值为需要的速度与默认速度的比值。
* 取值范围为 scrollSpeed > 0 赋值为 2 时,速度是默认速度的 2 倍
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
scrollSpeed: number;
/**
* 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
* @default true
* @version Egret 2.4
* @language en_US
*/
/**
* 是否启用回弹,当启用回弹后,ScrollView中内容在到达边界后允许继续拖动,在用户拖动操作结束后,再反弹回边界位置
* @default true
* @version Egret 2.4
* @language zh_CN
*/
bounces: boolean;
/**
* Create a egret.ScrollView objects
* @param content {egret.DisplayObject} You need to scroll object
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 创建一个 egret.ScrollView 对象
* @param content {egret.DisplayObject} 需要滚动的对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
constructor(content?: DisplayObject);
/**
* @private
*/
_content: DisplayObject;
/**
* Set to scroll object
* @param content {egret.DisplayObject} You need to scroll object
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 设置需要滚动的对象
* @param content {egret.DisplayObject} 需要滚动的对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
setContent(content: DisplayObject): void;
/**
* Remove rolling objects
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 移除滚动的对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
removeContent(): void;
/**
* Vertical scroll bar display policy, on / off / auto.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 垂直滚动条显示策略,on/off/auto。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
verticalScrollPolicy: string;
/**
* The horizontal scroll bar display policy, on / off / auto.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 水平滚动条显示策略,on/off/auto。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
horizontalScrollPolicy: string;
/**
* Gets or sets the horizontal scroll position
* @returns {number}
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 获取或设置水平滚动位置,
* @returns {number}
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
scrollLeft: number;
/**
* Gets or sets the vertical scroll position
* @returns {number}
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 获取或设置垂直滚动位置,
* @returns {number}
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
scrollTop: number;
/**
* Set scroll position
* @param top {number} The vertical scroll position
* @param left {number} The horizontal scroll position
* @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
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 设置滚动位置
* @param top {number} 垂直滚动位置
* @param left {number} 水平滚动位置
* @param isOffset {boolean} 可选参数,默认是false,是否是滚动增加量,如 top=1 代表往上滚动1像素
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
setScrollPosition(top: number, left: number, isOffset?: boolean): void;
/**
* @private
*
* @param top
* @param left
*/
private _validatePosition(top?, left?);
/**
* @private
* @inheritDoc
*/
$setWidth(value: number): void;
/**
* @private
* @inheritDoc
*/
$setHeight(value: number): void;
/**
* @private
*
*/
_updateContentPosition(): void;
/**
* @private
*
* @returns
*/
_checkScrollPolicy(): boolean;
/**
* @private
*
* @param policy
* @param contentLength
* @param viewLength
* @returns
*/
private __checkScrollPolicy(policy, contentLength, viewLength);
/**
* @private
*
* @returns
*/
_addEvents(): void;
/**
* @private
*
* @returns
*/
_removeEvents(): void;
private _tempStage;
/**
* @private
*
* @param e
*/
_onTouchBegin(e: TouchEvent): void;
/**
* @private
*/
private delayTouchBeginEvent;
/**
* @private
*/
private touchBeginTimer;
/**
* @private
*
* @param event
*/
_onTouchBeginCapture(event: TouchEvent): void;
/**
* @private
*
* @param event
* @returns
*/
private _onTouchEndCapture(event);
/**
* @private
*
*/
private _onTouchBeginTimer();
/**
* @private
*
* @param event
* @returns
*/
private dispatchPropagationEvent(event);
/**
* @private
*
* @param event
* @returns
*/
_onTouchMove(event: TouchEvent): void;
/**
* @private
*
* @param event
* @returns
*/
_onTouchEnd(event: TouchEvent): void;
/**
* @private
*
* @param event
* @returns
*/
_onEnterFrame(event: Event): void;
/**
* @private
*
* @param e
* @returns
*/
private _logTouchEvent(e);
/**
* @private
*
* @param e
* @returns
*/
private _getPointChange(e);
/**
* @private
*
* @param e
* @returns
*/
private _calcVelocitys(e);
/**
* @private
*
* @returns
*/
_getContentWidth(): number;
/**
* @private
*
* @returns
*/
_getContentHeight(): number;
/**
* The left side of the maximum distance
* @returns The left side of the maximum distance
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 距离左侧的最大值
* @returns 距离左侧最大值
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
getMaxScrollLeft(): number;
/**
* Above the maximum distance
* @returns Above the maximum distance
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 距离上方最大值
* @returns 距离上方最大值
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
getMaxScrollTop(): number;
/**
* @private
*/
private static weight;
/**
* @private
*
*/
private _moveAfterTouchEnd();
/**
* @private
*
* @param tw
*/
private onTweenFinished(tw);
/**
* @private
*
* @returns
*/
_onScrollStarted(): void;
/**
* @private
*
* @returns
*/
_onScrollFinished(): void;
/**
* Set the scroll position above the distance
* @param scrollTop Position above distance
* @param duration Easing of time, in milliseconds
* @returns Get tween vertical scrolling
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 设置滚动距离上方的位置
* @param scrollTop 距离上方的位置
* @param duration 缓动时间,毫秒单位
* @returns 获取垂直滚动的tween
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
setScrollTop(scrollTop: number, duration?: number): void;
/**
* Set the scroll position from the left side
* @param scrollLeft From the position on the left side
* @param duration Get tween vertical scrolling
* @returns Gets the horizontal scroll tween
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 设置滚动距离左侧的位置
* @param scrollLeft 距离左侧的位置
* @param duration 缓动时间,毫秒单位
* @returns 获取水平滚动的tween
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
setScrollLeft(scrollLeft: number, duration?: number): void;
/**
* @private
*
* @param pixelsPerMS
* @param curPos
* @param maxPos
* @returns
*/
private getAnimationDatas(pixelsPerMS, curPos, maxPos);
/**
* @private
*
* @param event
* @returns
*/
private cloneTouchEvent(event);
/**
* @private
*
* @returns
*/
private throwNotSupportedError();
/**
* @deprecated
* @inheritDoc
* @inheritDoc
* @version Egret 2.4
* @platform Web,Native
*/
addChild(child: DisplayObject): DisplayObject;
/**
* @deprecated
* @inheritDoc
* @version Egret 2.4
* @platform Web,Native
*/
addChildAt(child: DisplayObject, index: number): DisplayObject;
/**
* @deprecated
* @inheritDoc
* @version Egret 2.4
* @platform Web,Native
*/
removeChild(child: DisplayObject): DisplayObject;
/**
* @deprecated
* @inheritDoc
* @version Egret 2.4
* @platform Web,Native
*/
removeChildAt(index: number): DisplayObject;
/**
* @deprecated
* @inheritDoc
* @version Egret 2.4
* @platform Web,Native
*/
setChildIndex(child: DisplayObject, index: number): void;
/**
* @deprecated
* @inheritDoc
* @version Egret 2.4
* @platform Web,Native
*/
swapChildren(child1: DisplayObject, child2: DisplayObject): void;
/**
* @deprecated
* @inheritDoc
* @version Egret 2.4
* @platform Web,Native
*/
swapChildrenAt(index1: number, index2: number): void;
}
}
declare namespace egret {
/**
* @private
* @version Egret 2.4
* @platform Web,Native
*/
class ScrollViewProperties {
/**
* @private
*/
_verticalScrollPolicy: string;
/**
* @private
*/
_horizontalScrollPolicy: string;
/**
* @private
*/
_scrollLeft: number;
/**
* @private
*/
_scrollTop: number;
/**
* @private
*/
_hCanScroll: boolean;
/**
* @private
*/
_vCanScroll: boolean;
/**
* @private
*/
_lastTouchPosition: egret.Point;
/**
* @private
*/
_touchStartPosition: egret.Point;
/**
* @private
*/
_scrollStarted: boolean;
/**
* @private
*/
_lastTouchTime: number;
/**
* @private
*/
_lastTouchEvent: TouchEvent;
/**
* @private
*/
_velocitys: Array<{
x: number;
y: number;
}>;
/**
* @private
*/
_isHTweenPlaying: boolean;
/**
* @private
*/
_isVTweenPlaying: boolean;
/**
* @private
*/
_hScrollTween: ScrollTween;
/**
* @private
*/
_vScrollTween: ScrollTween;
/**
* @private
*/
_bounces: boolean;
}
}
declare namespace egret {
/**
* 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.
* 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,
* which you can monitor through bytesLoaded and bytesTotal properties, as well as through dispatched events.
* @see http://edn.egret.com/cn/docs/page/601 Build communication request
* @event egret.Event.COMPLETE Dispatched when the net request is complete.
* @event egret.IOErrorEvent.IO_ERROR io error.
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLLoader.ts
* @language en_US
*/
/**
* URLLoader 类以文本、二进制数据或 URL 编码变量的形式从 URL 下载数据。在下载文本文件、XML 或其他用于动态数据驱动应用程序的信息时,它很有用。
* URLLoader 对象会先从 URL 中下载所有数据,然后才将数据用于应用程序中的代码。它会发出有关下载进度的通知,
* 通过 bytesLoaded 和 bytesTotal 属性以及已调度的事件,可以监视下载进度。
* @see http://edn.egret.com/cn/docs/page/601 构建通信请求
* @event egret.Event.COMPLETE 加载完成后调度。
* @event egret.IOErrorEvent.IO_ERROR 加载错误后调度。
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLLoader.ts
* @language zh_CN
*/
class URLLoader extends EventDispatcher {
/**
* Create an egret.URLLoader object
* @param request {URLRequest} A URLRequest object specifies the URL to be downloaded.
* If this parameter is omitted, no load operation begins. If a parameter is specified, the load operation begins immediately
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 创建 egret.URLLoader 对象
* @param request {URLRequest} 一个 URLRequest 对象,指定要下载的 URL。
* 如果省略该参数,则不开始加载操作。如果已指定参数,则立即开始加载操作
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
constructor(request?: URLRequest);
/**
* Control whether the downloaded data is received as text (URLLoaderDataFormat.TEXT), raw binary data (URLLoaderDataFormat.BINARY), or URL-encoded variables (URLLoaderDataFormat.VARIABLES).
* If the value of the dataFormat property is URLLoaderDataFormat.TEXT, the received data is a string containing the text of the loaded file.
* If the value of the dataFormat property is URLLoaderDataFormat.BINARY, the received data is a ByteArray object containing the raw binary data.
* If the value of the dataFormat property is URLLoaderDataFormat.TEXTURE, the received data is a Texture object containing the bitmap data.
* If the value of the dataFormat property is URLLoaderDataFormat.VARIABLES, the received data is a URLVariables object containing the URL-encoded variables.
* The default value is URLLoaderDataFormat.TEXT.
* @default egret.URLLoaderDataFormat.TEXT
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 控制是以文本 (URLLoaderDataFormat.TEXT)、原始二进制数据 (URLLoaderDataFormat.BINARY) 还是 URL 编码变量 (URLLoaderDataFormat.VARIABLES) 接收下载的数据。
* 如果 dataFormat 属性的值是 URLLoaderDataFormat.TEXT,则所接收的数据是一个包含已加载文件文本的字符串。
* 如果 dataFormat 属性的值是 URLLoaderDataFormat.BINARY,则所接收的数据是一个包含原始二进制数据的 ByteArray 对象。
* 如果 dataFormat 属性的值是 URLLoaderDataFormat.TEXTURE,则所接收的数据是一个包含位图数据的Texture对象。
* 如果 dataFormat 属性的值是 URLLoaderDataFormat.VARIABLES,则所接收的数据是一个包含 URL 编码变量的 URLVariables 对象。
* @default egret.URLLoaderDataFormat.TEXT
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
dataFormat: string;
/**
* 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:
* If the dataFormat property is URLLoaderDataFormat.TEXT, the received data is a string containing the text of the loaded file.
* If the dataFormat property is URLLoaderDataFormat.BINARY, the received data is a ByteArray object containing the raw binary data.
* If the dataFormat property is URLLoaderDataFormat.TEXTURE, the received data is a Texture object containing the bitmap data.
* If the dataFormat property is URLLoaderDataFormat.VARIABLES, the received data is a URLVariables object containing the URL-encoded variables.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 从加载操作接收的数据。只有完成加载操作时,才会填充该属性。该数据的格式取决于 dataFormat 属性的设置:
* 如果 dataFormat 属性是 URLLoaderDataFormat.TEXT,则所接收的数据是一个包含已加载文件文本的字符串。
* 如果 dataFormat 属性是 URLLoaderDataFormat.BINARY,则所接收的数据是一个包含原始二进制数据的 ByteArray 对象。
* 如果 dataFormat 属性是 URLLoaderDataFormat.TEXTURE,则所接收的数据是一个包含位图数据的Texture对象。
* 如果 dataFormat 属性是 URLLoaderDataFormat.VARIABLES,则所接收的数据是一个包含 URL 编码变量的 URLVariables 对象。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
data: any;
/**
* @private
*/
_request: URLRequest;
/**
* 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.
* 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.
* @param request {URLRequest} A URLRequest object specifies the URL to be downloaded.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 从指定的 URL 发送和加载数据。可以以文本、原始二进制数据或 URL 编码变量格式接收数据,这取决于为 dataFormat 属性所设置的值。
* 请注意 dataFormat 属性的默认值为文本。如果想将数据发送至指定的 URL,则可以在 URLRequest 对象中设置 data 属性。
* @param request {URLRequest} 一个 URLRequest 对象,指定要下载的 URL。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
load(request: URLRequest): void;
private getResponseType(dataFormat);
/**
* @private
*
* @param loader
*/
private loadSound(loader);
/**
* @private
*
* @param loader
*/
private loadTexture(loader);
/**
* @private
*/
_status: number;
/**
* @private
*
*/
__recycle(): void;
}
}
declare namespace egret {
/**
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/display/MovieClip.ts
* @language en_US
*/
/**
* 影片剪辑,可以通过影片剪辑播放序列帧动画。MovieClip 类从以下类继承而来:DisplayObject 和 EventDispatcher。不同于 DisplayObject 对象,MovieClip 对象拥有一个时间轴。
* @extends egret.DisplayObject
* @event egret.Event.COMPLETE 动画播放完成。
* @event egret.Event.LOOP_COMPLETE 动画循环播放完成。循环最后一次只派发 COMPLETE 事件,不派发 LOOP_COMPLETE 事件。
* @see http://edn.egret.com/cn/docs/page/596 MovieClip序列帧动画
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/display/MovieClip.ts
* @language zh_CN
*/
class MovieClip extends DisplayObject {
$texture: Texture;
private offsetPoint;
$movieClipData: MovieClipData;
/**
* @private
*/
private frames;
/**
* @private
*/
$totalFrames: number;
/**
* @version Egret 2.4
* @platform Web,Native
* @private
*/
frameLabels: any[];
/**
* @private
*/
$frameLabelStart: number;
/**
* @private
*/
$frameLabelEnd: number;
/**
* @version Egret 2.4
* @platform Web,Native
* @private
*/
frameEvents: any[];
/**
* @private
*/
private frameIntervalTime;
/**
* @private
*/
$eventPool: string[];
$isPlaying: boolean;
/**
* @private
*/
private isStopped;
/**
* @private
*/
private playTimes;
/**
* @private
*/
$currentFrameNum: number;
/**
* @private
*/
$nextFrameNum: number;
/**
* @private
*/
private displayedKeyFrameNum;
/**
* @private
*/
private passedTime;
/**
* @private
*/
private $frameRate;
/**
* 创建新的 MovieClip 实例。创建 MovieClip 之后,调用舞台上的显示对象容器的addElement方法。
* @param movieClipData {movieClipData} 被引用的 movieClipData 对象
* @version Egret 2.4
* @platform Web,Native
*/
constructor(movieClipData?: MovieClipData);
protected createNativeDisplayObject(): void;
/**
* @private
*/
$smoothing: boolean;
/**
* Whether or not is smoothed when scaled.
* @version Egret 3.0
* @platform Web
* @language en_US
*/
/**
* 控制在缩放时是否进行平滑处理。
* @version Egret 3.0
* @platform Web
* @language zh_CN
*/
smoothing: boolean;
/**
* @private
*
*/
$init(): void;
/**
* @private
*
*/
$reset(): void;
/**
* @private
*
*/
private _initFrame();
/**
* @private
*/
$updateRenderNode(): void;
/**
* @private
*/
$measureContentBounds(bounds: Rectangle): void;
/**
* @private
*
* @param stage
* @param nestLevel
*/
$onAddToStage(stage: Stage, nestLevel: number): void;
/**
* @private
*
*/
$onRemoveFromStage(): void;
/**
* @private
* 返回帧标签为指定字符串的FrameLabel对象
* @param labelName {string} 帧标签名
* @param ignoreCase {boolean} 是否忽略大小写,可选参数,默认false
* @returns {egret.FrameLabel} FrameLabel对象
*/
private getFrameLabelByName(labelName, ignoreCase?);
/**
* @private
* 根据帧标签,设置开始和结束的帧数
* @param labelName {string} 帧标签名
*/
private getFrameStartEnd(labelName);
/**
* @private
* 返回指定序号的帧的FrameLabel对象
* @param frame {number} 帧序号
* @returns {egret.FrameLabel} FrameLabel对象
*/
private getFrameLabelByFrame(frame);
/**
* @private
* 返回指定序号的帧对应的FrameLabel对象,如果当前帧没有标签,则返回前面最近的有标签的帧的FrameLabel对象
* @method egret.MovieClip#getFrameLabelForFrame
* @param frame {number} 帧序号
* @returns {egret.FrameLabel} FrameLabel对象
*/
private getFrameLabelForFrame(frame);
/**
* 继续播放当前动画
* @param playTimes {number} 播放次数。 参数为整数,可选参数,>=1:设定播放次数,<0:循环播放,默认值 0:不改变播放次数(MovieClip初始播放次数设置为1),
* @version Egret 2.4
* @platform Web,Native
*/
play(playTimes?: number): void;
/**
* 暂停播放动画
* @version Egret 2.4
* @platform Web,Native
*/
stop(): void;
/**
* 将播放头移到前一帧并停止
* @version Egret 2.4
* @platform Web,Native
*/
prevFrame(): void;
/**
* 跳到后一帧并停止
* @version Egret 2.4
* @platform Web,Native
*/
nextFrame(): void;
/**
* 将播放头移到指定帧并播放
* @param frame {any} 指定帧的帧号或帧标签
* @param playTimes {number} 播放次数。 参数为整数,可选参数,>=1:设定播放次数,<0:循环播放,默认值 0:不改变播放次数,
* @version Egret 2.4
* @platform Web,Native
*/
gotoAndPlay(frame: string | number, playTimes?: number): void;
/**
* 将播放头移到指定帧并停止
* @param frame {any} 指定帧的帧号或帧标签
* @version Egret 2.4
* @platform Web,Native
*/
gotoAndStop(frame: string | number): void;
/**
* @private
*
* @param frame
*/
private gotoFrame(frame);
/**
* @private
*/
private lastTime;
/**
* @private
*
* @param advancedTime
* @returns
*/
private advanceTime(timeStamp);
/**
* @private
*
*/
private advanceFrame();
/**
* @private
*
*/
private constructFrame();
/**
* @private
*
*/
$renderFrame(): void;
/**
* @private
*
*/
private handlePendingEvent();
/**
* MovieClip 实例中帧的总数
* @version Egret 2.4
* @platform Web,Native
*/
readonly totalFrames: number;
/**
* MovieClip 实例当前播放的帧的序号
* @version Egret 2.4
* @platform Web,Native
*/
readonly currentFrame: number;
/**
* MovieClip 实例当前播放的帧的标签。如果当前帧没有标签,则 currentFrameLabel返回null。
* @version Egret 2.4
* @platform Web,Native
*/
readonly currentFrameLabel: string;
/**
* 当前播放的帧对应的标签,如果当前帧没有标签,则currentLabel返回包含标签的先前帧的标签。如果当前帧和先前帧都不包含标签,currentLabel返回null。
* @version Egret 2.4
* @platform Web,Native
*/
readonly currentLabel: string;
/**
* MovieClip 实例的帧频
* @version Egret 2.4
* @platform Web,Native
*/
frameRate: number;
/**
* MovieClip 实例当前是否正在播放
* @version Egret 2.4
* @platform Web,Native
*/
readonly isPlaying: boolean;
/**
* @version Egret 2.4
* @platform Web,Native
*/
/**
* MovieClip数据源
*/
movieClipData: MovieClipData;
/**
* @private
*
* @param value
*/
private setMovieClipData(value);
/**
* @private
*
* @param value
*/
private setPlayTimes(value);
/**
* @private
*
* @param value
*/
private setIsStopped(value);
}
}
declare namespace egret {
/**
* The URLRequest class captures all of the information in a single HTTP request.
* @see http://edn.egret.com/cn/index.php/article/index/id/601 Build communication request
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLRequest.ts
* @language en_US
*/
/**
* URLRequest 类可捕获单个 HTTP 请求中的所有信息。
* @see http://edn.egret.com/cn/index.php/article/index/id/601 构建通信请求
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLRequest.ts
* @language zh_CN
*/
class URLRequest extends HashObject {
/**
* Create an egret.URLRequest object
* @param url {string} Addresses for URL requests
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 创建一个 egret.URLRequest 对象
* @param url {string} 进行网络请求的地址
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
constructor(url?: string);
/**
* An object contains data to be transmitted with the URL request.
* 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.
* 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.
* 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.
* The way in which the data is used depends on the type of object used:
* 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.
* 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.
* 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.
* Otherwise, the object is converted into a string, and the string is used as the POST or GET data.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 一个对象,它包含将随 URL 请求一起传输的数据。
* 该属性与 method 属性配合使用。当 method 值为 GET 时,将使用 HTTP 查询字符串语法将 data 值追加到 URLRequest.url 值。
* 当 method 值为 POST(或 GET 之外的任何值)时,将在 HTTP 请求体中传输 data 值。
* URLRequest API 支持二进制 POST,并支持 URL 编码变量和字符串。该数据对象可以是 ArrayBuffer、URLVariables 或 String 对象。
* 该数据的使用方式取决于所用对象的类型:
* 如果该对象为 ArrayBuffer 对象,则 ArrayBuffer 对象的二进制数据用作 POST 数据。对于 GET,不支持 ArrayBuffer 类型的数据。
* 如果该对象是 URLVariables 对象,并且该方法是 POST,则使用 x-www-form-urlencoded 格式对变量进行编码,并且生成的字符串会用作 POST 数据。
* 如果该对象是 URLVariables 对象,并且该方法是 GET,则 URLVariables 对象将定义要随 URLRequest 对象一起发送的变量。
* 否则,该对象会转换为字符串,并且该字符串会用作 POST 或 GET 数据。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
data: any;
/**
* Request method, valid values are URLRequestMethod.GET or URLRequestMethod.POST.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 请求方式,有效值为URLRequestMethod.GET 或 URLRequestMethod.POST。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
method: string;
/**
* The requested URL.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 所请求的 URL。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
url: string;
/**
* The array of HTTP request headers to be appended to the HTTP request. The array is composed of URLRequestHeader objects.
* Each object in the array must be a URLRequestHeader object that contains a name string and a value string.
* Because of browser compatibility, this property has not been achieved in html5
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 要追加到 HTTP 请求的 HTTP 请求标头的数组。该数组由 URLRequestHeader 对象组成。
* 数组中的每一对象必须是包含一个名称字符串和一个值字符串的 URLRequestHeader 对象。
* 由于浏览器兼容性原因,该属性在 html5 中并未实现
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
requestHeaders: Array<URLRequestHeader>;
}
}
declare namespace egret {
/**
* 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.
* Note: Because of browser compatibility, this property has not been achieved in html5
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLRequestHeader.ts
* @language en_US
*/
/**
* URLRequestHeader 对象封装了一个 HTTP 请求标头并由一个名称/值对组成。URLRequestHeader 对象在 URLRequest 类的 requestHeaders 属性中使用。
* 注意:由于浏览器兼容性原因,在 html5 中并未实现
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLRequestHeader.ts
* @language zh_CN
*/
class URLRequestHeader {
/**
* HTTP request header name, such as Content-Type
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* HTTP 请求标头名称,如 Content-Type
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
name: string;
/**
* The values associated with the name property (such as text/plain).
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 与 name 属性相关联的值,如 text/plain
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
value: string;
/**
* Create an egret.URLRequestHeader object
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 创建一个 egret.URLRequestHeader 对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
constructor(name: string, value: string);
}
}
declare namespace egret {
/**
* The URLRequestMethod class provides values that specify whether the
* URLRequest object should use the POST method or the GET method when sending data to a server.
* @see http://edn.egret.com/cn/docs/page/599 POST与GET
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLRequestMethod.ts
* @language en_US
*/
/**
* URLRequestMethod 类提供了一些值,这些值可指定在将数据发送到服务器时,
* URLRequest 对象应使用 POST 方法还是 GET 方法。
* @see http://edn.egret.com/cn/docs/page/599 POST与GET
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLRequestMethod.ts
* @language zh_CN
*/
class URLRequestMethod {
/**
* Specify that the URLRequest object is a GET.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 表示 URLRequest 对象是一个 GET。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static GET: string;
/**
* Specify that the URLRequest object is a POST.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 表示 URLRequest 对象是一个 POST。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
static POST: string;
}
}
declare namespace egret {
/**
* The URLVariables class allows you to transfer variables between an application and a server.
* Use URLVariables objects with methods of the URLLoader class and the data property of the URLRequest class.
* @see http://edn.egret.com/cn/docs/page/598 Send the request with parameters
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLVariables.ts
* @language en_US
*/
/**
* 使用 URLVariables 类可以在应用程序和服务器之间传输变量。
* 将 URLVariables 对象与 URLLoader 类的方法、URLRequest 类的 data 属性一起使用。
* @see http://edn.egret.com/cn/docs/page/598 发送带参数的请求
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/net/URLVariables.ts
* @language zh_CN
*/
class URLVariables extends HashObject {
/**
* Create an egret.URLVariable object
* @param source {String} A URL-encoded string containing name/value pairs.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 创建一个 egret.URLVariables 对象
* @param source {String} 包含名称/值对的 URL 编码的字符串。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
constructor(source?: string);
/**
* Key-value pair data object saved in this URLVariables object
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 此 URLVariables 储存的键值对数据对象。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
variables: Object;
/**
* Convert the variable string into the property of this URLVariables.variables object.
* @param source {string}
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 将变量字符串转换为此 URLVariables.variables 对象的属性。
* @param source {string}
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
decode(source: string): void;
/**
* Return a string containing all enumerable variables using the MIME content encoding format : application/x-www-form-urlencoded.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 以 MIME 内容编码格式 application/x-www-form-urlencoded 返回包含所有可枚举变量的字符串。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
toString(): string;
/**
* @private
*
* @param key
* @param value
*/
private encodeValue(key, value);
/**
* @private
*
* @param key
* @param value
*/
private encodeArray(key, value);
}
}
declare namespace egret {
/**
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/player/Ticker.ts
* @language en_US
*/
/**
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/player/Ticker.ts
* @language zh_CN
*/
class Ticker extends EventDispatcher {
/**
* @deprecated
* @version Egret 2.4
* @platform Web,Native
*/
constructor();
private _timeScale;
private _paused;
private _callIndex;
private _callList;
private _lastTime;
private update(timeStamp);
private callBackList;
/**
* 注册帧回调事件,同一函数的重复监听会被忽略。推荐使用 egret.startTick 替代此方法。
* @method egret.Ticker#register
* @param listener {Function} 帧回调函数,参数返回上一帧和这帧的间隔时间。示例:onEnterFrame(frameTime:number):void
* @param thisObject {any} 帧回调函数的this对象
* @param priority {number} 事件优先级,开发者请勿传递 Number.NEGATIVE_INFINITY 和 Number.POSITIVE_INFINITY
* @version Egret 2.4
* @platform Web,Native
* @deprecated
*/
register(listener: Function, thisObject: any, priority?: number): void;
/**
* 取消侦听enterFrame事件。推荐使用 egret.stopTick 替代此方法。
* @method egret.Ticker#unregister
* @param listener {Function} 事件侦听函数
* @param thisObject {any} 侦听函数的this对象
* @version Egret 2.4
* @platform Web,Native
* @deprecated
*/
unregister(listener: Function, thisObject: any): void;
/**
* @deprecated
* @param timeScale {number}
* @private
*/
setTimeScale(timeScale: number): void;
/**
* @deprecated
* @method egret.Ticker#getTimeScale
* @private
*/
getTimeScale(): number;
/**
* 暂停
* @deprecated
* @method egret.Ticker#pause
*/
pause(): void;
/**
* 继续
* @deprecated
* @method egret.Ticker#resume
*/
resume(): void;
/**
* @private
*/
private static instance;
/**
* @method egret.Ticker.getInstance
* @returns {Ticker}
* @version Egret 2.4
* @platform Web,Native
* @deprecated
*/
static getInstance(): egret.Ticker;
}
}
declare namespace egret {
/**
* @class egret.MainContext
* @classdesc
* MainContext是游戏的核心跨平台接口,组合了多个功能Context,并是游戏启动的主入口
* @extends egret.EventDispatcher
* @private
* @version Egret 2.4
* @platform Web,Native
*/
class MainContext extends EventDispatcher {
/**
* @version Egret 2.4
* @platform Web,Native
*/
constructor();
/**
* 渲染Context
* @member egret.MainContext#rendererContext
* @version Egret 2.4
* @platform Web,Native
*/
/**
* 触摸Context
* @member egret.MainContext#touchContext
* @version Egret 2.4
* @platform Web,Native
*/
/**
* 设备divice
* @member egret.MainContext#deviceContext
* @version Egret 2.4
* @platform Web,Native
*/
/**
* 舞台
* @member egret.MainContext#stage
* @version Egret 2.4
* @platform Web,Native
*/
readonly stage: Stage;
/**
* @version Egret 2.4
* @platform Web,Native
*/
static deviceType: string;
/**
* @version Egret 2.4
* @platform Web,Native
*/
static DEVICE_PC: string;
/**
* @version Egret 2.4
* @platform Web,Native
*/
static DEVICE_MOBILE: string;
/**
* 游戏启动,开启主循环,参考Flash的滑动跑道模型
* @method egret.MainContext#run
* @version Egret 2.4
* @platform Web,Native
*/
/**
* @private
*/
private static _instance;
/**
* @method egret.Ticker.getInstance
* @returns {Ticker}
* @version Egret 2.4
* @platform Web,Native
*/
static readonly instance: egret.MainContext;
}
}
declare namespace egret {
/**
* Tool class for object cache repeat use, which can be used to construct an object pool. Objects are automatically recycled after a certain duration.
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/utils/Recycler.ts
* @private
* @language en_US
*/
/**
* 对象缓存复用工具类,可用于构建对象池,一段时间后会自动回收对象。
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/utils/Recycler.ts
* @private
* @language zh_CN
*/
class Recycler extends HashObject {
/**
* Create an egret.Recycler object
* @param autoDisposeTime {number} Number of frames when objects are destroyed automatically. Default value: 300
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 创建一个 egret.Recycler 对象
* @param autoDisposeTime {number} 多少帧后自动销毁对象,默认值300
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
constructor(autoDisposeTime?: number);
/**
* @private
*/
static _callBackList: any[];
static $init(): void;
static onUpdate(timeStamp: number): boolean;
/**
* @private
* 多少帧后自动销毁对象。
*/
private autoDisposeTime;
/**
* @private
*/
private frameCount;
/**
* @private
*
*/
$checkFrame(): void;
/**
* @private
*/
private objectPool;
/**
* @private
*/
private _length;
/**
* Number of cached objects"
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 缓存的对象数量
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
readonly length: number;
/**
* Cache an object for repeat use
* @param object {any} The object to be cached
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 缓存一个对象以复用
* @param object {any} 需要缓存的对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
push(object: any): void;
/**
* Obtain a cached object
* @returns {any} The obtained cached object
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 获取一个缓存的对象
* @returns {any} 获得的缓存对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
pop(): any;
/**
* Immediately clear all cached objects.
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 立即清空所有缓存的对象。
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
dispose(): void;
}
}
declare namespace egret {
/**
* To specify a delay (in milliseconds) calls the function specified interval loop.
* @param listener {Function} Listener function
* @param thisObject {any} this object
* @param delay {number} Delay time, in milliseconds
* @param ...args {any} Parameter list
* @returns {number} Return index which can be used for clearInterval
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/utils/setInterval.ts
* @language en_US
*/
/**
* 以指定的延迟(以毫秒为单位)间隔循环调用指定的函数。
* @param listener {Function} 侦听函数
* @param thisObject {any} this对象
* @param delay {number} 延迟时间,以毫秒为单位
* @param ...args {any} 参数列表
* @returns {number} 返回索引,可以用于 clearInterval
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/utils/setInterval.ts
* @language zh_CN
*/
function setInterval<Z>(listener: (this: Z, ...arg) => void, thisObject: Z, delay: number, ...args: any[]): number;
/**
* Clear function to run after a specified delay.
* @param key {number} Index that egret.setInterval returns
* @version Egret 2.4
* @platform Web,Native
* @includeExample egret/utils/setInterval.ts
* @language en_US
*/
/**
* 清除指定延迟后运行的函数。
* @param key {number} egret.setInterval所返回的索引
* @version Egret 2.4
* @platform Web,Native
* @includeExample egret/utils/setInterval.ts
* @language zh_CN
*/
function clearInterval(key: number): void;
}
declare namespace egret {
/**
* Run the designated function in specified delay (in milliseconds).
* @param listener {Function} Listener function
* @param thisObject {any} this object
* @param delay {number} Delay time, in milliseconds
* @param ...args {any} Parameter list
* @returns {number} Return index which can be used for clearTimeout
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/utils/setTimeout.ts
* @language en_US
*/
/**
* 在指定的延迟(以毫秒为单位)后运行指定的函数。
* @param listener {Function} 侦听函数
* @param thisObject {any} this对象
* @param delay {number} 延迟时间,以毫秒为单位
* @param ...args {any} 参数列表
* @returns {number} 返回索引,可以用于 clearTimeout
* @version Egret 2.4
* @platform Web,Native
* @includeExample extension/game/utils/setTimeout.ts
* @language zh_CN
*/
function setTimeout<Z>(listener: (this: Z, ...arg) => void, thisObject: Z, delay: number, ...args: any[]): number;
/**
* Function run after the specified delay is cleared.
* @param key {number} Index that egret.setTimeout returns
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 清除指定延迟后运行的函数。
* @param key {number} egret.setTimeout所返回的索引
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
function clearTimeout(key: number): void;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
var __reflect=this&&this.__reflect||function(t,e,r){t.__class__=e,r?r.push(e):r=[e],t.__types__=t.__types__?r.concat(t.__types__):r},__extends=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);r.prototype=e.prototype,t.prototype=new r},egret;!function(t){var e=function(){function t(){}return t.BINARY="binary",t.TEXT="text",t.VARIABLES="variables",t.TEXTURE="texture",t.SOUND="sound",t}();t.URLLoaderDataFormat=e,__reflect(e.prototype,"egret.URLLoaderDataFormat")}(egret||(egret={}));var egret;!function(t){var e=function(t){function e(e,r,i){var o=t.call(this)||this;return o._name=e,o._frame=0|r,i&&(o._end=0|i),o}return __extends(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},enumerable:!0,configurable:!0}),e.prototype.clone=function(){return new e(this._name,this._frame,this._end)},e}(t.EventDispatcher);t.FrameLabel=e,__reflect(e.prototype,"egret.FrameLabel")}(egret||(egret={}));var egret;!function(t){var e=function(e){function r(){var t=e.call(this)||this;return t.$mcData=null,t.numFrames=1,t.frames=[],t.labels=null,t.events=[],t.frameRate=0,t.textureData=null,t.spriteSheet=null,t}return __extends(r,e),r.prototype.$init=function(t,e,r){this.textureData=e,this.spriteSheet=r,this.setMCData(t)},r.prototype.getKeyFrameData=function(t){var e=this.frames[t-1];return e.frame&&(e=this.frames[e.frame-1]),e},r.prototype.getTextureByFrame=function(t){var e=this.getKeyFrameData(t);if(e.res){var r=this.getTextureByResName(e.res);return r}return null},r.prototype.$getOffsetByFrame=function(t,e){var r=this.getKeyFrameData(t);r.res&&e.setTo(0|r.x,0|r.y)},r.prototype.getTextureByResName=function(t){if(null==this.spriteSheet)return null;var e=this.spriteSheet.getTexture(t);if(!e){var r=this.textureData[t];e=this.spriteSheet.createTexture(t,r.x,r.y,r.w,r.h)}return e},r.prototype.$isDataValid=function(){return this.frames.length>0},r.prototype.$isTextureValid=function(){return null!=this.textureData&&null!=this.spriteSheet},r.prototype.$fillMCData=function(t){this.frameRate=t.frameRate||24,this.fillFramesData(t.frames),this.fillFrameLabelsData(t.labels),this.fillFrameEventsData(t.events)},r.prototype.fillFramesData=function(t){for(var e,r=this.frames,i=t?t.length:0,o=0;i>o;o++){var n=t[o];if(r.push(n),n.duration){var s=parseInt(n.duration);if(s>1){e=r.length;for(var a=1;s>a;a++)r.push({frame:e})}}}this.numFrames=r.length},r.prototype.fillFrameLabelsData=function(e){if(e){var r=e.length;if(r>0){this.labels=[];for(var i=0;r>i;i++){var o=e[i];this.labels.push(new t.FrameLabel(o.name,o.frame,o.end))}}}},r.prototype.fillFrameEventsData=function(t){if(t){var e=t.length;if(e>0){this.events=[];for(var r=0;e>r;r++){var i=t[r];this.events[i.frame]=i.name}}}},Object.defineProperty(r.prototype,"mcData",{get:function(){return this.$mcData},set:function(t){this.setMCData(t)},enumerable:!0,configurable:!0}),r.prototype.setMCData=function(t){this.$mcData!=t&&(this.$mcData=t,t&&this.$fillMCData(t))},r}(t.HashObject);t.MovieClipData=e,__reflect(e.prototype,"egret.MovieClipData")}(egret||(egret={}));var egret;!function(t){var e=function(e){function r(t,r){var i=e.call(this)||this;return i.enableCache=!0,i.$mcDataCache={},i.$mcDataSet=t,i.setTexture(r),i}return __extends(r,e),r.prototype.clearCache=function(){this.$mcDataCache={}},r.prototype.generateMovieClipData=function(e){if(void 0===e&&(e=""),""==e&&this.$mcDataSet)for(e in this.$mcDataSet.mc)break;if(""==e)return null;var r=this.findFromCache(e,this.$mcDataCache);return r||(r=new t.MovieClipData,this.fillData(e,r,this.$mcDataCache)),r},r.prototype.findFromCache=function(t,e){return this.enableCache&&e[t]?e[t]:null},r.prototype.fillData=function(t,e,r){if(this.$mcDataSet){var i=this.$mcDataSet.mc[t];i&&(e.$init(i,this.$mcDataSet.res,this.$spriteSheet),this.enableCache&&(r[t]=e))}},Object.defineProperty(r.prototype,"mcDataSet",{get:function(){return this.$mcDataSet},set:function(t){this.$mcDataSet=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"texture",{set:function(t){this.setTexture(t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"spriteSheet",{get:function(){return this.$spriteSheet},enumerable:!0,configurable:!0}),r.prototype.setTexture=function(e){this.$spriteSheet=e?new t.SpriteSheet(e):null},r}(t.EventDispatcher);t.MovieClipDataFactory=e,__reflect(e.prototype,"egret.MovieClipDataFactory")}(egret||(egret={}));var egret;!function(t){var e=function(e){function r(t,r,i,o){void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o=null);var n=e.call(this,t,r,i)||this;return n.frameLabel=null,n.frameLabel=o,n}return __extends(r,e),r.dispatchMovieClipEvent=function(e,i,o){void 0===o&&(o=null);var n=t.Event.create(r,i);n.frameLabel=o;var s=e.dispatchEvent(n);return t.Event.release(n),s},r.FRAME_LABEL="frame_label",r}(t.Event);t.MovieClipEvent=e,__reflect(e.prototype,"egret.MovieClipEvent")}(egret||(egret={}));var egret;!function(t){var e=function(){function e(){t.$error(1014)}return e.get=function(t){return-1>t&&(t=-1),t>1&&(t=1),function(e){return 0==t?e:0>t?e*(e*-t+1+t):e*((2-e)*t+(1-t))}},e.getPowOut=function(t){return function(e){return 1-Math.pow(1-e,t)}},e.quintOut=e.getPowOut(5),e.quartOut=e.getPowOut(4),e}();t.ScrollEase=e,__reflect(e.prototype,"egret.ScrollEase");var r=function(e){function r(t,r,i){var o=e.call(this)||this;return o._target=null,o._useTicks=!1,o.ignoreGlobalPause=!1,o.loop=!1,o.pluginData=null,o._steps=null,o._actions=null,o.paused=!1,o.duration=0,o._prevPos=-1,o.position=null,o._prevPosition=0,o._stepPosition=0,o.passive=!1,o.initialize(t,r,i),o}return __extends(r,e),r.get=function(t,e,i,o){return void 0===e&&(e=null),void 0===i&&(i=null),void 0===o&&(o=!1),o&&r.removeTweens(t),new r(t,e,i)},r.removeTweens=function(t){if(t.tween_count){for(var e=r._tweens,i=e.length-1;i>=0;i--)e[i]._target==t&&(e[i].paused=!0,e.splice(i,1));t.tween_count=0}},r.tick=function(t,e){void 0===e&&(e=!1);var i=t-r._lastTime;r._lastTime=t;for(var o=r._tweens.concat(),n=o.length-1;n>=0;n--){var s=o[n];e&&!s.ignoreGlobalPause||s.paused||s.tick(s._useTicks?1:i)}return!1},r._register=function(e,i){var o=e._target,n=r._tweens;if(i)o&&(o.tween_count=o.tween_count>0?o.tween_count+1:1),n.push(e),r._inited||(r._lastTime=t.getTimer(),t.ticker.$startTick(r.tick,null),r._inited=!0);else{o&&o.tween_count--;for(var s=n.length;s--;)if(n[s]==e)return void n.splice(s,1)}},r.prototype.initialize=function(t,e,i){this._target=t,e&&(this._useTicks=e.useTicks,this.ignoreGlobalPause=e.ignoreGlobalPause,this.loop=e.loop,e.onChange&&this.addEventListener("change",e.onChange,e.onChangeObj),e.override&&r.removeTweens(t)),this.pluginData=i||{},this._curQueueProps={},this._initQueueProps={},this._steps=[],this._actions=[],e&&e.paused?this.paused=!0:r._register(this,!0),e&&null!=e.position&&this.setPosition(e.position)},r.prototype.setPosition=function(t,e){void 0===e&&(e=1),0>t&&(t=0);var r=t,i=!1;if(r>=this.duration&&(this.loop?r%=this.duration:(r=this.duration,i=!0)),r==this._prevPos)return i;var o=this._prevPos;if(this.position=this._prevPos=r,this._prevPosition=t,this._target)if(i)this._updateTargetProps(null,1);else if(this._steps.length>0){var n=void 0,s=this._steps.length;for(n=0;s>n&&!(this._steps[n].t>r);n++);var a=this._steps[n-1];this._updateTargetProps(a,(this._stepPosition=r-a.t)/a.d)}return i&&this.setPaused(!0),0!=e&&this._actions.length>0&&(this._useTicks?this._runActions(r,r):1==e&&o>r?(o!=this.duration&&this._runActions(o,this.duration),this._runActions(0,r,!0)):this._runActions(o,r)),this.dispatchEventWith("change"),i},r.prototype._runActions=function(t,e,r){void 0===r&&(r=!1);var i=t,o=e,n=-1,s=this._actions.length,a=1;for(t>e&&(i=e,o=t,n=s,s=a=-1);(n+=a)!=s;){var c=this._actions[n],l=c.t;(l==o||l>i&&o>l||r&&l==t)&&c.f.apply(c.o,c.p)}},r.prototype._updateTargetProps=function(t,e){var i,o,n,s,a,c;if(t||1!=e){if(this.passive=!!t.v,this.passive)return;t.e&&(e=t.e(e,0,1,1)),i=t.p0,o=t.p1}else this.passive=!1,i=o=this._curQueueProps;for(var l in this._initQueueProps){null==(s=i[l])&&(i[l]=s=this._initQueueProps[l]),null==(a=o[l])&&(o[l]=a=s),n=s==a||0==e||1==e||"number"!=typeof s?1==e?a:s:s+(a-s)*e;var h=!1;if(c=r._plugins[l])for(var u=0,p=c.length;p>u;u++){var _=c[u].tween(this,l,n,i,o,e,!!t&&i==o,!t);_==r.IGNORE?h=!0:n=_}h||(this._target[l]=n)}},r.prototype.setPaused=function(t){return this.paused=t,r._register(this,!t),this},r.prototype._cloneProps=function(t){var e={};for(var r in t)e[r]=t[r];return e},r.prototype._addStep=function(t){return t.d>0&&(this._steps.push(t),t.t=this.duration,this.duration+=t.d),this},r.prototype._appendQueueProps=function(t){var e,i,o,n,s;for(var a in t)if(void 0===this._initQueueProps[a]){if(i=this._target[a],e=r._plugins[a])for(o=0,n=e.length;n>o;o++)i=e[o].init(this,a,i);this._initQueueProps[a]=this._curQueueProps[a]=void 0===i?null:i}else i=this._curQueueProps[a];for(var a in t){if(i=this._curQueueProps[a],e=r._plugins[a])for(s=s||{},o=0,n=e.length;n>o;o++)e[o].step&&e[o].step(this,a,i,t[a],s);this._curQueueProps[a]=t[a]}return s&&this._appendQueueProps(s),this._curQueueProps},r.prototype._addAction=function(t){return t.t=this.duration,this._actions.push(t),this},r.prototype.to=function(t,e,r){return void 0===r&&(r=void 0),(isNaN(e)||0>e)&&(e=0),this._addStep({d:e||0,p0:this._cloneProps(this._curQueueProps),e:r,p1:this._cloneProps(this._appendQueueProps(t))})},r.prototype.call=function(t,e,r){return void 0===e&&(e=void 0),void 0===r&&(r=void 0),this._addAction({f:t,p:r?r:[],o:e?e:this._target})},r.prototype.tick=function(t){this.paused||this.setPosition(this._prevPosition+t)},r._tweens=[],r.IGNORE={},r._plugins={},r._inited=!1,r._lastTime=0,r}(t.EventDispatcher);t.ScrollTween=r,__reflect(r.prototype,"egret.ScrollTween")}(egret||(egret={}));var egret;!function(t){var e=function(e){function r(r){void 0===r&&(r=null);var i=e.call(this)||this;return i.scrollBeginThreshold=10,i.scrollSpeed=1,i._content=null,i.delayTouchBeginEvent=null,i.touchBeginTimer=null,i.touchEnabled=!0,i._ScrV_Props_=new t.ScrollViewProperties,r&&i.setContent(r),i}return __extends(r,e),Object.defineProperty(r.prototype,"bounces",{get:function(){return this._ScrV_Props_._bounces},set:function(t){this._ScrV_Props_._bounces=!!t},enumerable:!0,configurable:!0}),r.prototype.setContent=function(t){this._content!==t&&(this.removeContent(),t&&(this._content=t,e.prototype.addChild.call(this,t),this._addEvents()))},r.prototype.removeContent=function(){this._content&&(this._removeEvents(),e.prototype.removeChildAt.call(this,0)),this._content=null},Object.defineProperty(r.prototype,"verticalScrollPolicy",{get:function(){return this._ScrV_Props_._verticalScrollPolicy},set:function(t){t!=this._ScrV_Props_._verticalScrollPolicy&&(this._ScrV_Props_._verticalScrollPolicy=t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"horizontalScrollPolicy",{get:function(){return this._ScrV_Props_._horizontalScrollPolicy},set:function(t){t!=this._ScrV_Props_._horizontalScrollPolicy&&(this._ScrV_Props_._horizontalScrollPolicy=t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollLeft",{get:function(){return this._ScrV_Props_._scrollLeft},set:function(t){t!=this._ScrV_Props_._scrollLeft&&(this._ScrV_Props_._scrollLeft=t,this._validatePosition(!1,!0),this._updateContentPosition())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollTop",{get:function(){return this._ScrV_Props_._scrollTop},set:function(t){t!=this._ScrV_Props_._scrollTop&&(this._ScrV_Props_._scrollTop=t,this._validatePosition(!0,!1),this._updateContentPosition())},enumerable:!0,configurable:!0}),r.prototype.setScrollPosition=function(t,e,r){if(void 0===r&&(r=!1),(!r||0!=t||0!=e)&&(r||this._ScrV_Props_._scrollTop!=t||this._ScrV_Props_._scrollLeft!=e)){var i=this._ScrV_Props_._scrollTop,o=this._ScrV_Props_._scrollLeft;if(r){var n=this.getMaxScrollLeft(),s=this.getMaxScrollTop();(0>=i||i>=s)&&(t/=2),(0>=o||o>=n)&&(e/=2);var a=i+t,c=o+e,l=this._ScrV_Props_._bounces;l||((0>=a||a>=s)&&(a=Math.max(0,Math.min(a,s))),(0>=c||c>=n)&&(c=Math.max(0,Math.min(c,n)))),this._ScrV_Props_._scrollTop=a,this._ScrV_Props_._scrollLeft=c}else this._ScrV_Props_._scrollTop=t,this._ScrV_Props_._scrollLeft=e;this._validatePosition(!0,!0),this._updateContentPosition()}},r.prototype._validatePosition=function(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=!1),t){var r=this.height,i=this._getContentHeight();this._ScrV_Props_._scrollTop=Math.max(this._ScrV_Props_._scrollTop,(0-r)/2),this._ScrV_Props_._scrollTop=Math.min(this._ScrV_Props_._scrollTop,i>r?i-r/2:r/2)}if(e){var o=this.width,n=this._getContentWidth();this._ScrV_Props_._scrollLeft=Math.max(this._ScrV_Props_._scrollLeft,(0-o)/2),this._ScrV_Props_._scrollLeft=Math.min(this._ScrV_Props_._scrollLeft,n>o?n-o/2:o/2)}},r.prototype.$setWidth=function(t){this.$explicitWidth!=t&&(e.prototype.$setWidth.call(this,t),this._updateContentPosition())},r.prototype.$setHeight=function(t){this.$explicitHeight!=t&&(e.prototype.$setHeight.call(this,t),this._updateContentPosition())},r.prototype._updateContentPosition=function(){var e=this.height,r=this.width;this.scrollRect=new t.Rectangle(Math.round(this._ScrV_Props_._scrollLeft),Math.round(this._ScrV_Props_._scrollTop),r,e),this.dispatchEvent(new t.Event(t.Event.CHANGE))},r.prototype._checkScrollPolicy=function(){var t=this._ScrV_Props_._horizontalScrollPolicy,e=this.__checkScrollPolicy(t,this._getContentWidth(),this.width);this._ScrV_Props_._hCanScroll=e;var r=this._ScrV_Props_._verticalScrollPolicy,i=this.__checkScrollPolicy(r,this._getContentHeight(),this.height);return this._ScrV_Props_._vCanScroll=i,e||i},r.prototype.__checkScrollPolicy=function(t,e,r){return"on"==t?!0:"off"==t?!1:e>r},r.prototype._addEvents=function(){this.addEventListener(t.TouchEvent.TOUCH_BEGIN,this._onTouchBegin,this),this.addEventListener(t.TouchEvent.TOUCH_BEGIN,this._onTouchBeginCapture,this,!0),this.addEventListener(t.TouchEvent.TOUCH_END,this._onTouchEndCapture,this,!0)},r.prototype._removeEvents=function(){this.removeEventListener(t.TouchEvent.TOUCH_BEGIN,this._onTouchBegin,this),this.removeEventListener(t.TouchEvent.TOUCH_BEGIN,this._onTouchBeginCapture,this,!0),this.removeEventListener(t.TouchEvent.TOUCH_END,this._onTouchEndCapture,this,!0)},r.prototype._onTouchBegin=function(e){if(!e.$isDefaultPrevented){var r=this._checkScrollPolicy();r&&(this._ScrV_Props_._touchStartPosition.x=e.stageX,this._ScrV_Props_._touchStartPosition.y=e.stageY,(this._ScrV_Props_._isHTweenPlaying||this._ScrV_Props_._isVTweenPlaying)&&this._onScrollFinished(),this._tempStage=this.stage,this._tempStage.addEventListener(t.TouchEvent.TOUCH_MOVE,this._onTouchMove,this),this._tempStage.addEventListener(t.TouchEvent.TOUCH_END,this._onTouchEnd,this),this._tempStage.addEventListener(t.TouchEvent.LEAVE_STAGE,this._onTouchEnd,this),this.addEventListener(t.Event.ENTER_FRAME,this._onEnterFrame,this),this._logTouchEvent(e),e.preventDefault())}},r.prototype._onTouchBeginCapture=function(e){var r=this._checkScrollPolicy();if(r){for(var i=e.target;i!=this;){if("_checkScrollPolicy"in i&&(r=i._checkScrollPolicy()))return;i=i.parent}e.stopPropagation();var o=this.cloneTouchEvent(e);this.delayTouchBeginEvent=o,this.touchBeginTimer||(this.touchBeginTimer=new t.Timer(100,1),this.touchBeginTimer.addEventListener(t.TimerEvent.TIMER_COMPLETE,this._onTouchBeginTimer,this)),this.touchBeginTimer.start(),this._onTouchBegin(e)}},r.prototype._onTouchEndCapture=function(e){var r=this;if(this.delayTouchBeginEvent){this._onTouchBeginTimer(),e.stopPropagation();var i=this.cloneTouchEvent(e);t.callLater(function(){r.stage&&r.dispatchPropagationEvent(i)},this)}},r.prototype._onTouchBeginTimer=function(){this.touchBeginTimer.stop();var t=this.delayTouchBeginEvent;this.delayTouchBeginEvent=null,this.stage&&this.dispatchPropagationEvent(t)},r.prototype.dispatchPropagationEvent=function(e){for(var r=e.$target,i=this.$getPropagationList(r),o=i.length,n=.5*i.length,s=-1,a=0;o>a;a++)if(i[a]===this._content){s=a;break}i.splice(0,s+1),n-=s+1,this.$dispatchPropagationEvent(e,i,n),t.Event.release(e)},r.prototype._onTouchMove=function(t){if(this._ScrV_Props_._lastTouchPosition.x!=t.stageX||this._ScrV_Props_._lastTouchPosition.y!=t.stageY){if(!this._ScrV_Props_._scrollStarted){var e=t.stageX-this._ScrV_Props_._touchStartPosition.x,r=t.stageY-this._ScrV_Props_._touchStartPosition.y,i=Math.sqrt(e*e+r*r);if(i<this.scrollBeginThreshold)return void this._logTouchEvent(t)}this._ScrV_Props_._scrollStarted=!0,this.delayTouchBeginEvent&&(this.delayTouchBeginEvent=null,this.touchBeginTimer.stop()),this.touchChildren=!1;var o=this._getPointChange(t);this.setScrollPosition(o.y,o.x,!0),this._calcVelocitys(t),this._logTouchEvent(t)}},r.prototype._onTouchEnd=function(e){this.touchChildren=!0,this._ScrV_Props_._scrollStarted=!1,this._tempStage.removeEventListener(t.TouchEvent.TOUCH_MOVE,this._onTouchMove,this),this._tempStage.removeEventListener(t.TouchEvent.TOUCH_END,this._onTouchEnd,this),this._tempStage.removeEventListener(t.TouchEvent.LEAVE_STAGE,this._onTouchEnd,this),this.removeEventListener(t.Event.ENTER_FRAME,this._onEnterFrame,this),this._moveAfterTouchEnd()},r.prototype._onEnterFrame=function(e){var r=t.getTimer();r-this._ScrV_Props_._lastTouchTime>100&&r-this._ScrV_Props_._lastTouchTime<300&&this._calcVelocitys(this._ScrV_Props_._lastTouchEvent)},r.prototype._logTouchEvent=function(e){this._ScrV_Props_._lastTouchPosition.x=e.stageX,this._ScrV_Props_._lastTouchPosition.y=e.stageY,this._ScrV_Props_._lastTouchEvent=this.cloneTouchEvent(e),this._ScrV_Props_._lastTouchTime=t.getTimer()},r.prototype._getPointChange=function(t){return{x:this._ScrV_Props_._hCanScroll===!1?0:this._ScrV_Props_._lastTouchPosition.x-t.stageX,y:this._ScrV_Props_._vCanScroll===!1?0:this._ScrV_Props_._lastTouchPosition.y-t.stageY}},r.prototype._calcVelocitys=function(e){var r=t.getTimer();if(0==this._ScrV_Props_._lastTouchTime)return void(this._ScrV_Props_._lastTouchTime=r);var i=this._getPointChange(e),o=r-this._ScrV_Props_._lastTouchTime;i.x/=o,i.y/=o,this._ScrV_Props_._velocitys.push(i),this._ScrV_Props_._velocitys.length>5&&this._ScrV_Props_._velocitys.shift(),this._ScrV_Props_._lastTouchPosition.x=e.stageX,this._ScrV_Props_._lastTouchPosition.y=e.stageY},r.prototype._getContentWidth=function(){return this._content.$explicitWidth||this._content.width},r.prototype._getContentHeight=function(){return this._content.$explicitHeight||this._content.height},r.prototype.getMaxScrollLeft=function(){var t=this._getContentWidth()-this.width;return Math.max(0,t)},r.prototype.getMaxScrollTop=function(){var t=this._getContentHeight()-this.height;return Math.max(0,t)},r.prototype._moveAfterTouchEnd=function(){if(0!=this._ScrV_Props_._velocitys.length){for(var t={x:0,y:0},e=0,i=0;i<this._ScrV_Props_._velocitys.length;i++){var o=this._ScrV_Props_._velocitys[i],n=r.weight[i];t.x+=o.x*n,t.y+=o.y*n,e+=n}this._ScrV_Props_._velocitys.length=0,this.scrollSpeed<=0&&(this.scrollSpeed=1);var s=t.x/e*this.scrollSpeed,a=t.y/e*this.scrollSpeed,c=Math.abs(s),l=Math.abs(a),h=this.getMaxScrollLeft(),u=this.getMaxScrollTop(),p=c>.02?this.getAnimationDatas(s,this._ScrV_Props_._scrollLeft,h):{position:this._ScrV_Props_._scrollLeft,duration:1},_=l>.02?this.getAnimationDatas(a,this._ScrV_Props_._scrollTop,u):{position:this._ScrV_Props_._scrollTop,duration:1};this.setScrollLeft(p.position,p.duration),this.setScrollTop(_.position,_.duration)}},r.prototype.onTweenFinished=function(t){t==this._ScrV_Props_._vScrollTween&&(this._ScrV_Props_._isVTweenPlaying=!1),t==this._ScrV_Props_._hScrollTween&&(this._ScrV_Props_._isHTweenPlaying=!1),0==this._ScrV_Props_._isHTweenPlaying&&0==this._ScrV_Props_._isVTweenPlaying&&this._onScrollFinished()},r.prototype._onScrollStarted=function(){},r.prototype._onScrollFinished=function(){t.ScrollTween.removeTweens(this),this._ScrV_Props_._hScrollTween=null,this._ScrV_Props_._vScrollTween=null,this._ScrV_Props_._isHTweenPlaying=!1,this._ScrV_Props_._isVTweenPlaying=!1,this.dispatchEvent(new t.Event(t.Event.COMPLETE))},r.prototype.setScrollTop=function(e,r){void 0===r&&(r=0);var i=Math.min(this.getMaxScrollTop(),Math.max(e,0));if(0==r)return void(this.scrollTop=i);0==this._ScrV_Props_._bounces&&(e=i);var o=t.ScrollTween.get(this).to({scrollTop:e},r,t.ScrollEase.quartOut);i!=e&&o.to({scrollTop:i},300,t.ScrollEase.quintOut),this._ScrV_Props_._isVTweenPlaying=!0,this._ScrV_Props_._vScrollTween=o,o.call(this.onTweenFinished,this,[o]),this._ScrV_Props_._isHTweenPlaying||this._onScrollStarted()},r.prototype.setScrollLeft=function(e,r){void 0===r&&(r=0);var i=Math.min(this.getMaxScrollLeft(),Math.max(e,0));if(0==r)return void(this.scrollLeft=i);0==this._ScrV_Props_._bounces&&(e=i);var o=t.ScrollTween.get(this).to({scrollLeft:e},r,t.ScrollEase.quartOut);i!=e&&o.to({scrollLeft:i},300,t.ScrollEase.quintOut),this._ScrV_Props_._isHTweenPlaying=!0,this._ScrV_Props_._hScrollTween=o,o.call(this.onTweenFinished,this,[o]),this._ScrV_Props_._isVTweenPlaying||this._onScrollStarted()},r.prototype.getAnimationDatas=function(t,e,r){var i=Math.abs(t),o=.95,n=0,s=.998,a=.02,c=e+500*t;if(0>c||c>r)for(c=e;Math.abs(t)!=1/0&&Math.abs(t)>a;)c+=t,t*=0>c||c>r?s*o:s,n++;else n=500*-Math.log(a/i);var l={position:Math.min(r+50,Math.max(c,-50)),duration:n};return l},r.prototype.cloneTouchEvent=function(e){var r=new t.TouchEvent(e.type,e.bubbles,e.cancelable);return r.touchPointID=e.touchPointID,r.$stageX=e.stageX,r.$stageY=e.stageY,r.touchDown=e.touchDown,r.$isDefaultPrevented=!1,r.$target=e.target,r},r.prototype.throwNotSupportedError=function(){t.$error(1023)},r.prototype.addChild=function(t){return this.throwNotSupportedError(),null},r.prototype.addChildAt=function(t,e){return this.throwNotSupportedError(),null},r.prototype.removeChild=function(t){return this.throwNotSupportedError(),null},r.prototype.removeChildAt=function(t){return this.throwNotSupportedError(),null},r.prototype.setChildIndex=function(t,e){this.throwNotSupportedError()},r.prototype.swapChildren=function(t,e){this.throwNotSupportedError()},r.prototype.swapChildrenAt=function(t,e){this.throwNotSupportedError()},r.weight=[1,1.33,1.66,2,2.33],r}(t.DisplayObjectContainer);t.ScrollView=e,__reflect(e.prototype,"egret.ScrollView")}(egret||(egret={}));var egret;!function(t){var e=function(){function e(){this._verticalScrollPolicy="auto",this._horizontalScrollPolicy="auto",this._scrollLeft=0,this._scrollTop=0,this._hCanScroll=!1,this._vCanScroll=!1,this._lastTouchPosition=new t.Point(0,0),this._touchStartPosition=new t.Point(0,0),this._scrollStarted=!1,this._lastTouchTime=0,this._lastTouchEvent=null,this._velocitys=[],this._isHTweenPlaying=!1,this._isVTweenPlaying=!1,this._hScrollTween=null,this._vScrollTween=null,this._bounces=!0}return e}();t.ScrollViewProperties=e,__reflect(e.prototype,"egret.ScrollViewProperties")}(egret||(egret={}));var egret;!function(t){function e(e){var r=e.url;return-1==r.indexOf("?")&&e.method==t.URLRequestMethod.GET&&e.data&&e.data instanceof t.URLVariables&&(r=r+"?"+e.data.toString()),r}var r=function(r){function i(e){void 0===e&&(e=null);var i=r.call(this)||this;return i.dataFormat=t.URLLoaderDataFormat.TEXT,i.data=null,i._request=null,i._status=-1,e&&i.load(e),i}return __extends(i,r),i.prototype.load=function(r){this._request=r,this.data=null;var i=this;if(i.dataFormat==t.URLLoaderDataFormat.TEXTURE)return void this.loadTexture(i);if(i.dataFormat==t.URLLoaderDataFormat.SOUND)return void this.loadSound(i);var o=e(r),n=new t.HttpRequest;n.open(o,r.method==t.URLRequestMethod.POST?t.HttpMethod.POST:t.HttpMethod.GET);var s;if(r.method!=t.URLRequestMethod.GET&&r.data)if(r.data instanceof t.URLVariables){n.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var a=r.data;s=a.toString()}else n.setRequestHeader("Content-Type","multipart/form-data"),s=r.data;else;for(var c=r.requestHeaders.length,l=0;c>l;l++){var h=r.requestHeaders[l];n.setRequestHeader(h.name,h.value)}n.addEventListener(t.Event.COMPLETE,function(){i.data=n.response,t.Event.dispatchEvent(i,t.Event.COMPLETE)},this),n.addEventListener(t.IOErrorEvent.IO_ERROR,function(){t.IOErrorEvent.dispatchIOErrorEvent(i)},this),n.responseType=i.dataFormat==t.URLLoaderDataFormat.BINARY?t.HttpResponseType.ARRAY_BUFFER:t.HttpResponseType.TEXT,n.send(s)},i.prototype.getResponseType=function(e){switch(e){case t.URLLoaderDataFormat.TEXT:case t.URLLoaderDataFormat.VARIABLES:return t.URLLoaderDataFormat.TEXT;case t.URLLoaderDataFormat.BINARY:return"arraybuffer";default:return e}},i.prototype.loadSound=function(e){function r(t){e.dispatchEvent(t)}function i(t){n(),e.dispatchEvent(t)}function o(r){n(),e.data=c,window.setTimeout(function(){e.dispatchEventWith(t.Event.COMPLETE)},0)}function n(){c.removeEventListener(t.Event.COMPLETE,o,s),c.removeEventListener(t.IOErrorEvent.IO_ERROR,i,s),c.removeEventListener(t.ProgressEvent.PROGRESS,r,s)}var s=this,a=e._request.url,c=new t.Sound;c.addEventListener(t.Event.COMPLETE,o,s),c.addEventListener(t.IOErrorEvent.IO_ERROR,i,s),c.addEventListener(t.ProgressEvent.PROGRESS,r,s),c.load(a)},i.prototype.loadTexture=function(e){function r(t){e.dispatchEvent(t)}function i(t){n(),e.dispatchEvent(t)}function o(r){n();var i=c.data;i.source.setAttribute("bitmapSrc",a);var o=new t.Texture;o._setBitmapData(i),e.data=o,window.setTimeout(function(){e.dispatchEventWith(t.Event.COMPLETE)},s)}function n(){c.removeEventListener(t.Event.COMPLETE,o,s),c.removeEventListener(t.IOErrorEvent.IO_ERROR,i,s),c.removeEventListener(t.ProgressEvent.PROGRESS,r,s)}var s=this,a=e._request.url,c=new t.ImageLoader;c.addEventListener(t.Event.COMPLETE,o,s),c.addEventListener(t.IOErrorEvent.IO_ERROR,i,s),c.addEventListener(t.ProgressEvent.PROGRESS,r,s),c.load(a)},i.prototype.__recycle=function(){this._request=null,this.data=null},i}(t.EventDispatcher);t.URLLoader=r,__reflect(r.prototype,"egret.URLLoader")}(egret||(egret={}));var egret;!function(t){var e=function(e){function r(r){var i=e.call(this)||this;return i.$texture=null,i.offsetPoint=t.Point.create(0,0),i.$movieClipData=null,i.frames=null,i.$totalFrames=0,i.frameLabels=null,i.$frameLabelStart=0,i.$frameLabelEnd=0,i.frameEvents=null,i.frameIntervalTime=0,i.$eventPool=null,i.$isPlaying=!1,i.isStopped=!0,i.playTimes=0,i.$currentFrameNum=0,i.$nextFrameNum=1,i.displayedKeyFrameNum=0,i.passedTime=0,i.$frameRate=0/0,i.lastTime=0,i.$smoothing=t.Bitmap.defaultSmoothing,i.setMovieClipData(r),t.nativeRender||(i.$renderNode=new t.sys.NormalBitmapNode),i}return __extends(r,e),r.prototype.createNativeDisplayObject=function(){this.$nativeDisplayObject=new egret_native.NativeDisplayObject(11)},Object.defineProperty(r.prototype,"smoothing",{get:function(){return this.$smoothing},set:function(t){t!=this.$smoothing&&(this.$smoothing=t)},enumerable:!0,configurable:!0}),r.prototype.$init=function(){this.$reset();var t=this.$movieClipData;t&&t.$isDataValid()&&(this.frames=t.frames,this.$totalFrames=t.numFrames,this.frameLabels=t.labels,this.frameEvents=t.events,this.$frameRate=t.frameRate,this.frameIntervalTime=1e3/this.$frameRate,this._initFrame())},r.prototype.$reset=function(){this.frames=null,this.playTimes=0,this.$isPlaying=!1,this.setIsStopped(!0),this.$currentFrameNum=0,this.$nextFrameNum=1,this.displayedKeyFrameNum=0,this.passedTime=0,this.$eventPool=[]},r.prototype._initFrame=function(){this.$movieClipData.$isTextureValid()&&(this.advanceFrame(),this.constructFrame())},r.prototype.$updateRenderNode=function(){var e=this.$texture;if(e){var r=Math.round(this.offsetPoint.x),i=Math.round(this.offsetPoint.y),o=e.$bitmapWidth,n=e.$bitmapHeight,s=e.$getTextureWidth(),a=e.$getTextureHeight(),c=Math.round(e.$getScaleBitmapWidth()),l=Math.round(e.$getScaleBitmapHeight()),h=e.$sourceWidth,u=e.$sourceHeight;t.sys.BitmapNode.$updateTextureData(this.$renderNode,e.$bitmapData,e.$bitmapX,e.$bitmapY,o,n,r,i,s,a,c,l,h,u,t.BitmapFillMode.SCALE,this.$smoothing)}},r.prototype.$measureContentBounds=function(t){var e=this.$texture;if(e){var r=this.offsetPoint.x,i=this.offsetPoint.y,o=e.$getTextureWidth(),n=e.$getTextureHeight();t.setTo(r,i,o,n)}else t.setEmpty()},r.prototype.$onAddToStage=function(t,r){e.prototype.$onAddToStage.call(this,t,r),this.$isPlaying&&this.$totalFrames>1&&this.setIsStopped(!1)},r.prototype.$onRemoveFromStage=function(){e.prototype.$onRemoveFromStage.call(this),this.setIsStopped(!0)},r.prototype.getFrameLabelByName=function(t,e){void 0===e&&(e=!1),e&&(t=t.toLowerCase());var r=this.frameLabels;if(r)for(var i=null,o=0;o<r.length;o++)if(i=r[o],e?i.name.toLowerCase()==t:i.name==t)return i;return null},r.prototype.getFrameStartEnd=function(t){var e=this.frameLabels;if(e)for(var r=null,i=0;i<e.length;i++)if(r=e[i],t==r.name){this.$frameLabelStart=r.frame,this.$frameLabelEnd=r.end;break}},r.prototype.getFrameLabelByFrame=function(t){var e=this.frameLabels;if(e)for(var r=null,i=0;i<e.length;i++)if(r=e[i],r.frame==t)return r;return null},r.prototype.getFrameLabelForFrame=function(t){var e=null,r=null,i=this.frameLabels;if(i)for(var o=0;o<i.length;o++){if(r=i[o],r.frame>t)return e;e=r}return e},r.prototype.play=function(e){void 0===e&&(e=0),this.lastTime=t.getTimer(),this.passedTime=0,this.$isPlaying=!0,this.setPlayTimes(e),this.$totalFrames>1&&this.$stage&&this.setIsStopped(!1)},r.prototype.stop=function(){this.$isPlaying=!1,this.setIsStopped(!0)},r.prototype.prevFrame=function(){this.gotoAndStop(this.$currentFrameNum-1)},r.prototype.nextFrame=function(){this.gotoAndStop(this.$currentFrameNum+1)},r.prototype.gotoAndPlay=function(e,r){void 0===r&&(r=0),(0==arguments.length||arguments.length>2)&&t.$error(1022,"MovieClip.gotoAndPlay()"),"string"==typeof e?this.getFrameStartEnd(e):(this.$frameLabelStart=0,this.$frameLabelEnd=0),this.play(r),this.gotoFrame(e)},r.prototype.gotoAndStop=function(e){1!=arguments.length&&t.$error(1022,"MovieClip.gotoAndStop()"),this.stop(),this.gotoFrame(e)},r.prototype.gotoFrame=function(e){var r;"string"==typeof e?r=this.getFrameLabelByName(e).frame:(r=parseInt(e+"",10),r!=e&&t.$error(1022,"Frame Label Not Found")),1>r?r=1:r>this.$totalFrames&&(r=this.$totalFrames),r!=this.$nextFrameNum&&(this.$nextFrameNum=r,this.advanceFrame(),this.constructFrame(),this.handlePendingEvent())},r.prototype.advanceTime=function(e){var r=this,i=e-r.lastTime;r.lastTime=e;var o=r.frameIntervalTime,n=r.passedTime+i;r.passedTime=n%o;var s=n/o;if(1>s)return!1;for(;s>=1;){if(s--,r.$nextFrameNum++,r.$nextFrameNum>r.$totalFrames||r.$frameLabelStart>0&&r.$nextFrameNum>r.$frameLabelEnd)if(-1==r.playTimes)r.$eventPool.push(t.Event.LOOP_COMPLETE),r.$nextFrameNum=1;else{if(r.playTimes--,!(r.playTimes>0)){r.$nextFrameNum=r.$totalFrames,r.$eventPool.push(t.Event.COMPLETE),r.stop();break}r.$eventPool.push(t.Event.LOOP_COMPLETE),r.$nextFrameNum=1}r.$currentFrameNum==r.$frameLabelEnd&&(r.$nextFrameNum=r.$frameLabelStart),r.advanceFrame()}return r.constructFrame(),r.handlePendingEvent(),!1},r.prototype.advanceFrame=function(){this.$currentFrameNum=this.$nextFrameNum;var e=this.frameEvents[this.$nextFrameNum];e&&""!=e&&t.MovieClipEvent.dispatchMovieClipEvent(this,t.MovieClipEvent.FRAME_LABEL,e)},r.prototype.constructFrame=function(){var e=this,r=e.$currentFrameNum;if(e.displayedKeyFrameNum!=r){var i=e.$movieClipData.getTextureByFrame(r);if(e.$texture=i,e.$movieClipData.$getOffsetByFrame(r,e.offsetPoint),e.displayedKeyFrameNum=r,e.$renderDirty=!0,t.nativeRender)e.$nativeDisplayObject.setDataToBitmapNode(e.$nativeDisplayObject.id,i,[i.$bitmapX,i.$bitmapY,i.$bitmapWidth,i.$bitmapHeight,e.offsetPoint.x,e.offsetPoint.y,i.$getScaleBitmapWidth(),i.$getScaleBitmapHeight(),i.$sourceWidth,i.$sourceHeight]),e.$nativeDisplayObject.setWidth(i.$getTextureWidth()+e.offsetPoint.x),e.$nativeDisplayObject.setHeight(i.$getTextureHeight()+e.offsetPoint.y);else{var o=e.$parent;o&&!o.$cacheDirty&&(o.$cacheDirty=!0,o.$cacheDirtyUp());
var n=e.$maskedObject;n&&!n.$cacheDirty&&(n.$cacheDirty=!0,n.$cacheDirtyUp())}}},r.prototype.$renderFrame=function(){var t=this;t.$texture=t.$movieClipData.getTextureByFrame(t.$currentFrameNum),t.$renderDirty=!0;var e=t.$parent;e&&!e.$cacheDirty&&(e.$cacheDirty=!0,e.$cacheDirtyUp());var r=t.$maskedObject;r&&!r.$cacheDirty&&(r.$cacheDirty=!0,r.$cacheDirtyUp())},r.prototype.handlePendingEvent=function(){if(0!=this.$eventPool.length){this.$eventPool.reverse();for(var e=this.$eventPool,r=e.length,i=!1,o=!1,n=0;r>n;n++){var s=e.pop();s==t.Event.LOOP_COMPLETE?o=!0:s==t.Event.COMPLETE?i=!0:this.dispatchEventWith(s)}o&&this.dispatchEventWith(t.Event.LOOP_COMPLETE),i&&this.dispatchEventWith(t.Event.COMPLETE)}},Object.defineProperty(r.prototype,"totalFrames",{get:function(){return this.$totalFrames},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentFrame",{get:function(){return this.$currentFrameNum},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentFrameLabel",{get:function(){var t=this.getFrameLabelByFrame(this.$currentFrameNum);return t&&t.name},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentLabel",{get:function(){var t=this.getFrameLabelForFrame(this.$currentFrameNum);return t?t.name:null},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"frameRate",{get:function(){return this.$frameRate},set:function(t){t!=this.$frameRate&&(this.$frameRate=t,this.frameIntervalTime=1e3/this.$frameRate)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isPlaying",{get:function(){return this.$isPlaying},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"movieClipData",{get:function(){return this.$movieClipData},set:function(t){this.setMovieClipData(t)},enumerable:!0,configurable:!0}),r.prototype.setMovieClipData=function(t){this.$movieClipData!=t&&(this.$movieClipData=t,this.$init())},r.prototype.setPlayTimes=function(t){(0>t||t>=1)&&(this.playTimes=0>t?-1:Math.floor(t))},r.prototype.setIsStopped=function(e){this.isStopped!=e&&(this.isStopped=e,e?t.ticker.$stopTick(this.advanceTime,this):(this.playTimes=0==this.playTimes?1:this.playTimes,this.lastTime=t.getTimer(),t.ticker.$startTick(this.advanceTime,this)))},r}(t.DisplayObject);t.MovieClip=e,__reflect(e.prototype,"egret.MovieClip")}(egret||(egret={}));var egret;!function(t){var e=function(e){function r(r){void 0===r&&(r=null);var i=e.call(this)||this;return i.data=null,i.method=t.URLRequestMethod.GET,i.url="",i.requestHeaders=[],i.url=r,i}return __extends(r,e),r}(t.HashObject);t.URLRequest=e,__reflect(e.prototype,"egret.URLRequest")}(egret||(egret={}));var egret;!function(t){var e=function(){function t(t,e){this.name="",this.value="",this.name=t,this.value=e}return t}();t.URLRequestHeader=e,__reflect(e.prototype,"egret.URLRequestHeader")}(egret||(egret={}));var egret;!function(t){var e=function(){function t(){}return t.GET="get",t.POST="post",t}();t.URLRequestMethod=e,__reflect(e.prototype,"egret.URLRequestMethod")}(egret||(egret={}));var egret;!function(t){var e=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this)||this;return r.variables=null,null!==e&&r.decode(e),r}return __extends(e,t),e.prototype.decode=function(t){this.variables||(this.variables={}),t=t.split("+").join(" ");for(var e,r=/[?&]?([^=]+)=([^&]*)/g;e=r.exec(t);){var i=decodeURIComponent(e[1]),o=decodeURIComponent(e[2]);if(i in this.variables!=0){var n=this.variables[i];n instanceof Array?n.push(o):this.variables[i]=[n,o]}else this.variables[i]=o}},e.prototype.toString=function(){if(!this.variables)return"";var t=this.variables,e=[];for(var r in t)e.push(this.encodeValue(r,t[r]));return e.join("&")},e.prototype.encodeValue=function(t,e){return e instanceof Array?this.encodeArray(t,e):encodeURIComponent(t)+"="+encodeURIComponent(e)},e.prototype.encodeArray=function(t,e){return t?0==e.length?encodeURIComponent(t)+"=":e.map(function(e){return encodeURIComponent(t)+"="+encodeURIComponent(e)}).join("&"):""},e}(t.HashObject);t.URLVariables=e,__reflect(e.prototype,"egret.URLVariables")}(egret||(egret={}));var egret;!function(t){var e=function(e){function r(){var i=e.call(this)||this;return i._timeScale=1,i._paused=!1,i._callIndex=-1,i._lastTime=0,i.callBackList=[],null!=r.instance,t.ticker.$startTick(i.update,i),i._lastTime=t.getTimer(),i}return __extends(r,e),r.prototype.update=function(t){var e=t-this._lastTime;if(this._lastTime=t,this._paused)return!1;var r=e*this._timeScale;for(this._callList=this.callBackList.concat(),this._callIndex=0;this._callIndex<this._callList.length;this._callIndex++){var i=this._callList[this._callIndex];i.listener.call(i.thisObject,r)}return this._callIndex=-1,this._callList=null,!1},r.prototype.register=function(t,e,r){void 0===r&&(r=0),this.$insertEventBin(this.callBackList,"",t,e,!1,r,!1)},r.prototype.unregister=function(t,e){this.$removeEventBin(this.callBackList,t,e)},r.prototype.setTimeScale=function(t){this._timeScale=t},r.prototype.getTimeScale=function(){return this._timeScale},r.prototype.pause=function(){this._paused=!0},r.prototype.resume=function(){this._paused=!1},r.getInstance=function(){return null==r.instance&&(r.instance=new r),r.instance},r}(t.EventDispatcher);t.Ticker=e,__reflect(e.prototype,"egret.Ticker")}(egret||(egret={}));var egret;!function(t){var e=function(e){function r(){return e.call(this)||this}return __extends(r,e),Object.defineProperty(r.prototype,"stage",{get:function(){return t.sys.$TempStage},enumerable:!0,configurable:!0}),Object.defineProperty(r,"instance",{get:function(){return null==r._instance&&(r._instance=new r),r._instance},enumerable:!0,configurable:!0}),r.deviceType=null,r.DEVICE_PC="web",r.DEVICE_MOBILE="native",r}(t.EventDispatcher);t.MainContext=e,__reflect(e.prototype,"egret.MainContext")}(egret||(egret={})),egret.testDeviceType1=function(){if(!window.navigator)return!0;var t=navigator.userAgent.toLowerCase();return-1!=t.indexOf("mobile")||-1!=t.indexOf("android")},egret.MainContext.deviceType=egret.testDeviceType1()?egret.MainContext.DEVICE_MOBILE:egret.MainContext.DEVICE_PC,delete egret.testDeviceType1;var egret;!function(t){var e=function(e){function r(t){void 0===t&&(t=300);var r=e.call(this)||this;return r.objectPool=[],r._length=0,1>t&&(t=1),r.autoDisposeTime=t,r.frameCount=0,r}return __extends(r,e),r.$init=function(){t.ticker.$startTick(r.onUpdate,r)},r.onUpdate=function(t){for(var e=r._callBackList,i=e.length-1;i>=0;i--)e[i].$checkFrame();return!1},r.prototype.$checkFrame=function(){this.frameCount--,this.frameCount<=0&&this.dispose()},Object.defineProperty(r.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),r.prototype.push=function(t){var e=this.objectPool;-1==e.indexOf(t)&&(e.push(t),t.__recycle&&t.__recycle(),this._length++,0==this.frameCount&&(this.frameCount=this.autoDisposeTime,r._callBackList.push(this)))},r.prototype.pop=function(){return 0==this._length?null:(this._length--,this.objectPool.pop())},r.prototype.dispose=function(){this._length>0&&(this.objectPool=[],this._length=0),this.frameCount=0;var t=r._callBackList,e=t.indexOf(this);-1!=e&&t.splice(e,1)},r._callBackList=[],r}(t.HashObject);t.Recycler=e,__reflect(e.prototype,"egret.Recycler"),e.$init()}(egret||(egret={}));var egret;!function(t){function e(e,r,c){for(var l=[],h=3;h<arguments.length;h++)l[h-3]=arguments[h];var u={listener:e,thisObject:r,delay:c,originDelay:c,params:l};return s++,1==s&&(a=t.getTimer(),t.ticker.$startTick(i,null)),n++,o[n]=u,n}function r(e){o[e]&&(s--,delete o[e],0==s&&t.ticker.$stopTick(i,null))}function i(t){var e=t-a;a=t;for(var r in o){var i=o[r];i.delay-=e,i.delay<=0&&(i.delay=i.originDelay,i.listener.apply(i.thisObject,i.params))}return!1}var o={},n=0,s=0,a=0;t.setInterval=e,t.clearInterval=r}(egret||(egret={}));var egret;!function(t){function e(e,r,c){for(var l=[],h=3;h<arguments.length;h++)l[h-3]=arguments[h];var u={listener:e,thisObject:r,delay:c,params:l};return s++,1==s&&t.ticker&&(a=t.getTimer(),t.ticker.$startTick(i,null)),n++,o[n]=u,n}function r(e){o[e]&&(s--,delete o[e],0==s&&t.ticker&&t.ticker.$stopTick(i,null))}function i(t){var e=t-a;a=t;for(var i in o){var n=i,s=o[n];s.delay-=e,s.delay<=0&&(s.listener.apply(s.thisObject,s.params),r(n))}return!1}var o={},n=0,s=0,a=0;t.setTimeout=e,t.clearTimeout=r}(egret||(egret={}));
\ No newline at end of file
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version 4.0.5
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.ES6Promise = factory());
}(this, (function () { 'use strict';
function objectOrFunction(x) {
return typeof x === 'function' || typeof x === 'object' && x !== null;
}
function isFunction(x) {
return typeof x === 'function';
}
var _isArray = undefined;
if (!Array.isArray) {
_isArray = function (x) {
return Object.prototype.toString.call(x) === '[object Array]';
};
} else {
_isArray = Array.isArray;
}
var isArray = _isArray;
var len = 0;
var vertxNext = undefined;
var customSchedulerFn = undefined;
var asap = function asap(callback, arg) {
queue[len] = callback;
queue[len + 1] = arg;
len += 2;
if (len === 2) {
// If len is 2, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
if (customSchedulerFn) {
customSchedulerFn(flush);
} else {
scheduleFlush();
}
}
};
function setScheduler(scheduleFn) {
customSchedulerFn = scheduleFn;
}
function setAsap(asapFn) {
asap = asapFn;
}
var browserWindow = typeof window !== 'undefined' ? window : undefined;
var browserGlobal = browserWindow || {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
// test for web worker but not in IE10
var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
// node
function useNextTick() {
// node version 0.10.x displays a deprecation warning when nextTick is used recursively
// see https://github.com/cujojs/when/issues/410 for details
return function () {
return process.nextTick(flush);
};
}
// vertx
function useVertxTimer() {
if (typeof vertxNext !== 'undefined') {
return function () {
vertxNext(flush);
};
}
return useSetTimeout();
}
function useMutationObserver() {
var iterations = 0;
var observer = new BrowserMutationObserver(flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function () {
node.data = iterations = ++iterations % 2;
};
}
// web worker
function useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = flush;
return function () {
return channel.port2.postMessage(0);
};
}
function useSetTimeout() {
// Store setTimeout reference so es6-promise will be unaffected by
// other code modifying setTimeout (like sinon.useFakeTimers())
var globalSetTimeout = setTimeout;
return function () {
return globalSetTimeout(flush, 1);
};
}
var queue = new Array(1000);
function flush() {
for (var i = 0; i < len; i += 2) {
var callback = queue[i];
var arg = queue[i + 1];
callback(arg);
queue[i] = undefined;
queue[i + 1] = undefined;
}
len = 0;
}
function attemptVertx() {
try {
var r = require;
var vertx = r('vertx');
vertxNext = vertx.runOnLoop || vertx.runOnContext;
return useVertxTimer();
} catch (e) {
return useSetTimeout();
}
}
var scheduleFlush = undefined;
// Decide what async method to use to triggering processing of queued callbacks:
if (isNode) {
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else if (isWorker) {
scheduleFlush = useMessageChannel();
} else if (browserWindow === undefined && typeof require === 'function') {
scheduleFlush = attemptVertx();
} else {
scheduleFlush = useSetTimeout();
}
function then(onFulfillment, onRejection) {
var _arguments = arguments;
var parent = this;
var child = new this.constructor(noop);
if (child[PROMISE_ID] === undefined) {
makePromise(child);
}
var _state = parent._state;
if (_state) {
(function () {
var callback = _arguments[_state - 1];
asap(function () {
return invokeCallback(_state, child, callback, parent._result);
});
})();
} else {
subscribe(parent, child, onFulfillment, onRejection);
}
return child;
}
/**
`Promise.resolve` returns a promise that will become resolved with the
passed `value`. It is shorthand for the following:
```javascript
let promise = new Promise(function(resolve, reject){
resolve(1);
});
promise.then(function(value){
// value === 1
});
```
Instead of writing the above, your code now simply becomes the following:
```javascript
let promise = Promise.resolve(1);
promise.then(function(value){
// value === 1
});
```
@method resolve
@static
@param {Any} value value that the returned promise will be resolved with
Useful for tooling.
@return {Promise} a promise that will become fulfilled with the given
`value`
*/
function resolve(object) {
/*jshint validthis:true */
var Constructor = this;
if (object && typeof object === 'object' && object.constructor === Constructor) {
return object;
}
var promise = new Constructor(noop);
_resolve(promise, object);
return promise;
}
var PROMISE_ID = Math.random().toString(36).substring(16);
function noop() {}
var PENDING = void 0;
var FULFILLED = 1;
var REJECTED = 2;
var GET_THEN_ERROR = new ErrorObject();
function selfFulfillment() {
return new TypeError("You cannot resolve a promise with itself");
}
function cannotReturnOwn() {
return new TypeError('A promises callback cannot return that same promise.');
}
function getThen(promise) {
try {
return promise.then;
} catch (error) {
GET_THEN_ERROR.error = error;
return GET_THEN_ERROR;
}
}
function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
try {
then.call(value, fulfillmentHandler, rejectionHandler);
} catch (e) {
return e;
}
}
function handleForeignThenable(promise, thenable, then) {
asap(function (promise) {
var sealed = false;
var error = tryThen(then, thenable, function (value) {
if (sealed) {
return;
}
sealed = true;
if (thenable !== value) {
_resolve(promise, value);
} else {
fulfill(promise, value);
}
}, function (reason) {
if (sealed) {
return;
}
sealed = true;
_reject(promise, reason);
}, 'Settle: ' + (promise._label || ' unknown promise'));
if (!sealed && error) {
sealed = true;
_reject(promise, error);
}
}, promise);
}
function handleOwnThenable(promise, thenable) {
if (thenable._state === FULFILLED) {
fulfill(promise, thenable._result);
} else if (thenable._state === REJECTED) {
_reject(promise, thenable._result);
} else {
subscribe(thenable, undefined, function (value) {
return _resolve(promise, value);
}, function (reason) {
return _reject(promise, reason);
});
}
}
function handleMaybeThenable(promise, maybeThenable, then$$) {
if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
handleOwnThenable(promise, maybeThenable);
} else {
if (then$$ === GET_THEN_ERROR) {
_reject(promise, GET_THEN_ERROR.error);
} else if (then$$ === undefined) {
fulfill(promise, maybeThenable);
} else if (isFunction(then$$)) {
handleForeignThenable(promise, maybeThenable, then$$);
} else {
fulfill(promise, maybeThenable);
}
}
}
function _resolve(promise, value) {
if (promise === value) {
_reject(promise, selfFulfillment());
} else if (objectOrFunction(value)) {
handleMaybeThenable(promise, value, getThen(value));
} else {
fulfill(promise, value);
}
}
function publishRejection(promise) {
if (promise._onerror) {
promise._onerror(promise._result);
}
publish(promise);
}
function fulfill(promise, value) {
if (promise._state !== PENDING) {
return;
}
promise._result = value;
promise._state = FULFILLED;
if (promise._subscribers.length !== 0) {
asap(publish, promise);
}
}
function _reject(promise, reason) {
if (promise._state !== PENDING) {
return;
}
promise._state = REJECTED;
promise._result = reason;
asap(publishRejection, promise);
}
function subscribe(parent, child, onFulfillment, onRejection) {
var _subscribers = parent._subscribers;
var length = _subscribers.length;
parent._onerror = null;
_subscribers[length] = child;
_subscribers[length + FULFILLED] = onFulfillment;
_subscribers[length + REJECTED] = onRejection;
if (length === 0 && parent._state) {
asap(publish, parent);
}
}
function publish(promise) {
var subscribers = promise._subscribers;
var settled = promise._state;
if (subscribers.length === 0) {
return;
}
var child = undefined,
callback = undefined,
detail = promise._result;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
if (child) {
invokeCallback(settled, child, callback, detail);
} else {
callback(detail);
}
}
promise._subscribers.length = 0;
}
function ErrorObject() {
this.error = null;
}
var TRY_CATCH_ERROR = new ErrorObject();
function tryCatch(callback, detail) {
try {
return callback(detail);
} catch (e) {
TRY_CATCH_ERROR.error = e;
return TRY_CATCH_ERROR;
}
}
function invokeCallback(settled, promise, callback, detail) {
var hasCallback = isFunction(callback),
value = undefined,
error = undefined,
succeeded = undefined,
failed = undefined;
if (hasCallback) {
value = tryCatch(callback, detail);
if (value === TRY_CATCH_ERROR) {
failed = true;
error = value.error;
value = null;
} else {
succeeded = true;
}
if (promise === value) {
_reject(promise, cannotReturnOwn());
return;
}
} else {
value = detail;
succeeded = true;
}
if (promise._state !== PENDING) {
// noop
} else if (hasCallback && succeeded) {
_resolve(promise, value);
} else if (failed) {
_reject(promise, error);
} else if (settled === FULFILLED) {
fulfill(promise, value);
} else if (settled === REJECTED) {
_reject(promise, value);
}
}
function initializePromise(promise, resolver) {
try {
resolver(function resolvePromise(value) {
_resolve(promise, value);
}, function rejectPromise(reason) {
_reject(promise, reason);
});
} catch (e) {
_reject(promise, e);
}
}
var id = 0;
function nextId() {
return id++;
}
function makePromise(promise) {
promise[PROMISE_ID] = id++;
promise._state = undefined;
promise._result = undefined;
promise._subscribers = [];
}
function Enumerator(Constructor, input) {
this._instanceConstructor = Constructor;
this.promise = new Constructor(noop);
if (!this.promise[PROMISE_ID]) {
makePromise(this.promise);
}
if (isArray(input)) {
this._input = input;
this.length = input.length;
this._remaining = input.length;
this._result = new Array(this.length);
if (this.length === 0) {
fulfill(this.promise, this._result);
} else {
this.length = this.length || 0;
this._enumerate();
if (this._remaining === 0) {
fulfill(this.promise, this._result);
}
}
} else {
_reject(this.promise, validationError());
}
}
function validationError() {
return new Error('Array Methods must be provided an Array');
};
Enumerator.prototype._enumerate = function () {
var length = this.length;
var _input = this._input;
for (var i = 0; this._state === PENDING && i < length; i++) {
this._eachEntry(_input[i], i);
}
};
Enumerator.prototype._eachEntry = function (entry, i) {
var c = this._instanceConstructor;
var resolve$$ = c.resolve;
if (resolve$$ === resolve) {
var _then = getThen(entry);
if (_then === then && entry._state !== PENDING) {
this._settledAt(entry._state, i, entry._result);
} else if (typeof _then !== 'function') {
this._remaining--;
this._result[i] = entry;
} else if (c === Promise) {
var promise = new c(noop);
handleMaybeThenable(promise, entry, _then);
this._willSettleAt(promise, i);
} else {
this._willSettleAt(new c(function (resolve$$) {
return resolve$$(entry);
}), i);
}
} else {
this._willSettleAt(resolve$$(entry), i);
}
};
Enumerator.prototype._settledAt = function (state, i, value) {
var promise = this.promise;
if (promise._state === PENDING) {
this._remaining--;
if (state === REJECTED) {
_reject(promise, value);
} else {
this._result[i] = value;
}
}
if (this._remaining === 0) {
fulfill(promise, this._result);
}
};
Enumerator.prototype._willSettleAt = function (promise, i) {
var enumerator = this;
subscribe(promise, undefined, function (value) {
return enumerator._settledAt(FULFILLED, i, value);
}, function (reason) {
return enumerator._settledAt(REJECTED, i, reason);
});
};
/**
`Promise.all` accepts an array of promises, and returns a new promise which
is fulfilled with an array of fulfillment values for the passed promises, or
rejected with the reason of the first passed promise to be rejected. It casts all
elements of the passed iterable to promises as it runs this algorithm.
Example:
```javascript
let promise1 = resolve(1);
let promise2 = resolve(2);
let promise3 = resolve(3);
let promises = [ promise1, promise2, promise3 ];
Promise.all(promises).then(function(array){
// The array here would be [ 1, 2, 3 ];
});
```
If any of the `promises` given to `all` are rejected, the first promise
that is rejected will be given as an argument to the returned promises's
rejection handler. For example:
Example:
```javascript
let promise1 = resolve(1);
let promise2 = reject(new Error("2"));
let promise3 = reject(new Error("3"));
let promises = [ promise1, promise2, promise3 ];
Promise.all(promises).then(function(array){
// Code here never runs because there are rejected promises!
}, function(error) {
// error.message === "2"
});
```
@method all
@static
@param {Array} entries array of promises
@param {String} label optional string for labeling the promise.
Useful for tooling.
@return {Promise} promise that is fulfilled when all `promises` have been
fulfilled, or rejected if any of them become rejected.
@static
*/
function all(entries) {
return new Enumerator(this, entries).promise;
}
/**
`Promise.race` returns a new promise which is settled in the same way as the
first passed promise to settle.
Example:
```javascript
let promise1 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 1');
}, 200);
});
let promise2 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 2');
}, 100);
});
Promise.race([promise1, promise2]).then(function(result){
// result === 'promise 2' because it was resolved before promise1
// was resolved.
});
```
`Promise.race` is deterministic in that only the state of the first
settled promise matters. For example, even if other promises given to the
`promises` array argument are resolved, but the first settled promise has
become rejected before the other promises became fulfilled, the returned
promise will become rejected:
```javascript
let promise1 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 1');
}, 200);
});
let promise2 = new Promise(function(resolve, reject){
setTimeout(function(){
reject(new Error('promise 2'));
}, 100);
});
Promise.race([promise1, promise2]).then(function(result){
// Code here never runs
}, function(reason){
// reason.message === 'promise 2' because promise 2 became rejected before
// promise 1 became fulfilled
});
```
An example real-world use case is implementing timeouts:
```javascript
Promise.race([ajax('foo.json'), timeout(5000)])
```
@method race
@static
@param {Array} promises array of promises to observe
Useful for tooling.
@return {Promise} a promise which settles in the same way as the first passed
promise to settle.
*/
function race(entries) {
/*jshint validthis:true */
var Constructor = this;
if (!isArray(entries)) {
return new Constructor(function (_, reject) {
return reject(new TypeError('You must pass an array to race.'));
});
} else {
return new Constructor(function (resolve, reject) {
var length = entries.length;
for (var i = 0; i < length; i++) {
Constructor.resolve(entries[i]).then(resolve, reject);
}
});
}
}
/**
`Promise.reject` returns a promise rejected with the passed `reason`.
It is shorthand for the following:
```javascript
let promise = new Promise(function(resolve, reject){
reject(new Error('WHOOPS'));
});
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
Instead of writing the above, your code now simply becomes the following:
```javascript
let promise = Promise.reject(new Error('WHOOPS'));
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
@method reject
@static
@param {Any} reason value that the returned promise will be rejected with.
Useful for tooling.
@return {Promise} a promise rejected with the given `reason`.
*/
function reject(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(noop);
_reject(promise, reason);
return promise;
}
function needsResolver() {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
function needsNew() {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
/**
Promise objects represent the eventual result of an asynchronous operation. The
primary way of interacting with a promise is through its `then` method, which
registers callbacks to receive either a promise's eventual value or the reason
why the promise cannot be fulfilled.
Terminology
-----------
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
- `thenable` is an object or function that defines a `then` method.
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
- `exception` is a value that is thrown using the throw statement.
- `reason` is a value that indicates why a promise was rejected.
- `settled` the final resting state of a promise, fulfilled or rejected.
A promise can be in one of three states: pending, fulfilled, or rejected.
Promises that are fulfilled have a fulfillment value and are in the fulfilled
state. Promises that are rejected have a rejection reason and are in the
rejected state. A fulfillment value is never a thenable.
Promises can also be said to *resolve* a value. If this value is also a
promise, then the original promise's settled state will match the value's
settled state. So a promise that *resolves* a promise that rejects will
itself reject, and a promise that *resolves* a promise that fulfills will
itself fulfill.
Basic Usage:
------------
```js
let promise = new Promise(function(resolve, reject) {
// on success
resolve(value);
// on failure
reject(reason);
});
promise.then(function(value) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Advanced Usage:
---------------
Promises shine when abstracting away asynchronous interactions such as
`XMLHttpRequest`s.
```js
function getJSON(url) {
return new Promise(function(resolve, reject){
let xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = handler;
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', 'application/json');
xhr.send();
function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
}
}
};
});
}
getJSON('/posts.json').then(function(json) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Unlike callbacks, promises are great composable primitives.
```js
Promise.all([
getJSON('/posts'),
getJSON('/comments')
]).then(function(values){
values[0] // => postsJSON
values[1] // => commentsJSON
return values;
});
```
@class Promise
@param {function} resolver
Useful for tooling.
@constructor
*/
function Promise(resolver) {
this[PROMISE_ID] = nextId();
this._result = this._state = undefined;
this._subscribers = [];
if (noop !== resolver) {
typeof resolver !== 'function' && needsResolver();
this instanceof Promise ? initializePromise(this, resolver) : needsNew();
}
}
Promise.all = all;
Promise.race = race;
Promise.resolve = resolve;
Promise.reject = reject;
Promise._setScheduler = setScheduler;
Promise._setAsap = setAsap;
Promise._asap = asap;
Promise.prototype = {
constructor: Promise,
/**
The primary way of interacting with a promise is through its `then` method,
which registers callbacks to receive either a promise's eventual value or the
reason why the promise cannot be fulfilled.
```js
findUser().then(function(user){
// user is available
}, function(reason){
// user is unavailable, and you are given the reason why
});
```
Chaining
--------
The return value of `then` is itself a promise. This second, 'downstream'
promise is resolved with the return value of the first promise's fulfillment
or rejection handler, or rejected if the handler throws an exception.
```js
findUser().then(function (user) {
return user.name;
}, function (reason) {
return 'default name';
}).then(function (userName) {
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
});
findUser().then(function (user) {
throw new Error('Found user, but still unhappy');
}, function (reason) {
throw new Error('`findUser` rejected and we're unhappy');
}).then(function (value) {
// never reached
}, function (reason) {
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
});
```
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
```js
findUser().then(function (user) {
throw new PedagogicalException('Upstream error');
}).then(function (value) {
// never reached
}).then(function (value) {
// never reached
}, function (reason) {
// The `PedgagocialException` is propagated all the way down to here
});
```
Assimilation
------------
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously. This can be achieved by returning a promise in the
fulfillment or rejection handler. The downstream promise will then be pending
until the returned promise is settled. This is called *assimilation*.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// The user's comments are now available
});
```
If the assimliated promise rejects, then the downstream promise will also reject.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// If `findCommentsByAuthor` fulfills, we'll have the value here
}, function (reason) {
// If `findCommentsByAuthor` rejects, we'll have the reason here
});
```
Simple Example
--------------
Synchronous Example
```javascript
let result;
try {
result = findResult();
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
findResult(function(result, err){
if (err) {
// failure
} else {
// success
}
});
```
Promise Example;
```javascript
findResult().then(function(result){
// success
}, function(reason){
// failure
});
```
Advanced Example
--------------
Synchronous Example
```javascript
let author, books;
try {
author = findAuthor();
books = findBooksByAuthor(author);
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
function foundBooks(books) {
}
function failure(reason) {
}
findAuthor(function(author, err){
if (err) {
failure(err);
// failure
} else {
try {
findBoooksByAuthor(author, function(books, err) {
if (err) {
failure(err);
} else {
try {
foundBooks(books);
} catch(reason) {
failure(reason);
}
}
});
} catch(error) {
failure(err);
}
// success
}
});
```
Promise Example;
```javascript
findAuthor().
then(findBooksByAuthor).
then(function(books){
// found books
}).catch(function(reason){
// something went wrong
});
```
@method then
@param {Function} onFulfilled
@param {Function} onRejected
Useful for tooling.
@return {Promise}
*/
then: then,
/**
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
as the catch block of a try/catch statement.
```js
function findAuthor(){
throw new Error('couldn't find that author');
}
// synchronous
try {
findAuthor();
} catch(reason) {
// something went wrong
}
// async with promises
findAuthor().catch(function(reason){
// something went wrong
});
```
@method catch
@param {Function} onRejection
Useful for tooling.
@return {Promise}
*/
'catch': function _catch(onRejection) {
return this.then(null, onRejection);
}
};
function polyfill() {
var local = undefined;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof self !== 'undefined') {
local = self;
} else {
try {
local = Function('return this')();
} catch (e) {
throw new Error('polyfill failed because global object is unavailable in this environment');
}
}
var P = local.Promise;
if (typeof egret_native != "undefined" && egret_native.capability && !egret_native.capability("Promise")) {
P = undefined;
}
if (P) {
var promiseToString = null;
try {
promiseToString = Object.prototype.toString.call(P.resolve());
} catch (e) {
// silently ignored
}
if (promiseToString === '[object Promise]' && !P.cast) {
return;
}
}
local.Promise = Promise;
}
// Strange compat..
Promise.polyfill = polyfill;
Promise.Promise = Promise;
return Promise;
})));
ES6Promise.polyfill();
\ No newline at end of file
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function e(t){return"function"==typeof t}function n(t){I=t}function r(t){J=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof H?function(){H(a)}:c()}function s(){var t=0,e=new V(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;G>t;t+=2){var e=$[t],n=$[t+1];e(n),$[t]=void 0,$[t+1]=void 0}G=0}function f(){try{var t=require,e=t("vertx");return H=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=arguments,r=this,o=new this.constructor(p);void 0===o[ee]&&k(o);var i=r._state;return i?!function(){var t=n[i-1];J(function(){return x(i,o,t,r._result)})}():E(r,o,t,e),o}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return w(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return ie.error=e,ie}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){J(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?w(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===re?S(t,e._result):e._state===oe?j(t,e._result):E(e,void 0,function(e){return w(t,e)},function(e){return j(t,e)})}function g(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===ie?j(t,ie.error):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function w(e,n){e===n?j(e,v()):t(n)?g(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),P(t)}function S(t,e){t._state===ne&&(t._result=e,t._state=re,0!==t._subscribers.length&&J(P,t))}function j(t,e){t._state===ne&&(t._state=oe,t._result=e,J(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+re]=n,o[i+oe]=r,0===i&&t._state&&J(P,t)}function P(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?x(n,r,o,i):o(i);t._subscribers.length=0}}function T(){this.error=null}function M(t,e){try{return t(e)}catch(n){return se.error=n,se}}function x(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=M(r,o),s===se?(a=!0,u=s.error,s=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==ne||(i&&c?w(n,s):a?j(n,u):t===re?S(n,s):t===oe&&j(n,s))}function C(t,e){try{e(function(e){w(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function O(){return ue++}function k(t){t[ee]=ue++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[ee]||k(this.promise),B(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):j(this.promise,q())}function q(){return new Error("Array Methods must be provided an Array")}function F(t){return new Y(this,t).promise}function D(t){var e=this;return new e(B(t)?function(n,r){for(var o=t.length,i=0;o>i;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function K(t){var e=this,n=new e(p);return j(n,t),n}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this[ee]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&L(),this instanceof U?C(this,t):N())}function W(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if("undefined"!=typeof egret_native&&egret_native.capability&&!egret_native.capability("Promise")&&(n=void 0),n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=U}var z=void 0;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B=z,G=0,H=void 0,I=void 0,J=function(t,e){$[G]=t,$[G+1]=e,G+=2,2===G&&(I?I(a):te())},Q="undefined"!=typeof window?window:void 0,R=Q||{},V=R.MutationObserver||R.WebKitMutationObserver,X="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3),te=void 0;te=X?o():V?s():Z?u():void 0===Q&&"function"==typeof require?f():c();var ee=Math.random().toString(36).substring(16),ne=void 0,re=1,oe=2,ie=new T,se=new T,ue=0;return Y.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ne&&t>n;n++)this._eachEntry(e[n],n)},Y.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==ne)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===U){var i=new n(p);g(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},Y.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ne&&(this._remaining--,t===oe?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},Y.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(re,e,t)},function(t){return n._settledAt(oe,e,t)})},U.all=F,U.race=D,U.resolve=h,U.reject=K,U._setScheduler=n,U._setAsap=r,U._asap=J,U.prototype={constructor:U,then:l,"catch":function(t){return this.then(null,t)}},U.polyfill=W,U.Promise=U,U}),ES6Promise.polyfill();
\ No newline at end of file
/**
* 判断操作系统
* @returns {Array|{index: number, input: string}}
*/
const getIsIOS = () => {
return navigator.userAgent.match(/iphone|ipod|ipad/gi) != null;
}
export default getIsIOS
\ No newline at end of file
/**
* Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
* @see http://edn.egret.com/cn/docs/page/146 Text mixed in a variety of style
* @version Egret 2.4
* @platform Web,Native
* @includeExample egret/text/HtmlTextParser.ts
* @language en_US
*/
/**
* 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
* @see http://edn.egret.com/cn/docs/page/146 多种样式文本混合
* @version Egret 2.4
* @platform Web,Native
* @includeExample egret/text/HtmlTextParser.ts
* @language zh_CN
*/
export class HtmlTextParser {
/**
* @version Egret 2.4
* @platform Web,Native
*/
constructor() {
this.initReplaceArr();
this.initPreReplaceArr();
}
private replaceArr: any[] = [];
private initReplaceArr(): void {
const arr = this.replaceArr = [];
arr.push([/&lt;/g, "<"]);
arr.push([/&gt;/g, ">"]);
arr.push([/&amp;/g, "&"]);
arr.push([/&quot;/g, "\""]);
arr.push([/&apos;/g, "\'"]);
}
private preReplaceArr: any[] = [];
private initPreReplaceArr() {
const arr = this.preReplaceArr = [];
arr.push([/\\\"/g, "\""]);
arr.push([/<br>/g, "\n"]);
}
/**
* @private
*
* @param value
* @returns
*/
private replaceSpecial(value: string): string {
// tslint:disable-next-line:prefer-for-of
for (let i = 0; i < this.replaceArr.length; i++) {
const k = this.replaceArr[i][0];
const v = this.replaceArr[i][1];
value = value.replace(k, v);
}
return value;
}
/**
* @private
*/
private resutlArr: Array<egret.ITextElement> = [];
/**
* Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
* @param htmltext {string} Text in html
* @returns {Array<egret.ITextElement>} 可赋值给 egret.TextField#textFlow Object that can be assigned to the egret.TextField#textFlow property
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
* @param htmltext {string} html文本
* @returns {Array<egret.ITextElement>} 可赋值给 egret.TextField#textFlow 属性的对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
public parse(htmltext: string): egret.ITextElement[] {
this.preReplaceArr.forEach(p => {
htmltext = htmltext.replace(p[0], p[1]);
});
this.stackArray = [];
this.resutlArr = [];
let firstIdx = 0;//文本段开始位置
const length: number = htmltext.length;
while (firstIdx < length) {
const starIdx: number = htmltext.indexOf("<", firstIdx);
if (starIdx < 0) {
this.addToResultArr(htmltext.substring(firstIdx));
firstIdx = length;
}
else {
this.addToResultArr(htmltext.substring(firstIdx, starIdx));
let fontEnd = htmltext.indexOf(">", starIdx);
if (fontEnd == -1) {
egret.$error(1038);
fontEnd = starIdx;
}
else if (htmltext.charAt(starIdx + 1) == "\/") {//关闭
this.stackArray.pop();
}
else {
this.addToArray(htmltext.substring(starIdx + 1, fontEnd));
}
firstIdx = fontEnd + 1;
}
}
return this.resutlArr;
}
public parser(htmltext: string): Array<egret.ITextElement> {
return this.parse(htmltext);
}
/**
* @private
*
* @param value
*/
private addToResultArr(value: string): void {
if (value == "") {
return;
}
value = this.replaceSpecial(value);
if (this.stackArray.length > 0) {
this.resutlArr.push({ text: value, style: this.stackArray[this.stackArray.length - 1] })
}
else {
this.resutlArr.push(<egret.ITextElement>{ text: value });
}
}
//将字符数据转成Json数据
private changeStringToObject(str: string): egret.ITextStyle {
str = this.replaceSpecial(str.trim());
const info: any = {};
let header = [];
if (str.charAt(0) == "i" || str.charAt(0) == "b" || str.charAt(0) == "u") {
this.addProperty(info, str, "true");
}
// tslint:disable-next-line:no-conditional-assignment
else if (header = str.match(/^(font|a)\s/)) {
str = str.substring(header[0].length).trim();
let next = 0;
let titles;
// tslint:disable-next-line:no-conditional-assignment
while (titles = str.match(this.getHeadReg())) {
const title = titles[0];
let value = "";
str = str.substring(title.length).trim();
if (str.charAt(0) == "\"") {
next = str.indexOf("\"", 1);
value = str.substring(1, next);
next += 1;
}
else if (str.charAt(0) == "\'") {
next = str.indexOf("\'", 1);
value = str.substring(1, next);
next += 1;
}
else {
value = str.match(/(\S)+/)[0];
next = value.length;
}
this.addProperty(info, title.substring(0, title.length - 1).trim(), value.trim());
str = str.substring(next).trim();
}
}
return info;
}
/**
* @private
*
* @returns
*/
private getHeadReg(): RegExp {
return /^(color|textcolor|strokecolor|stroke|b|bold|i|italic|u|size|fontfamily|href|target)(\s)*=/;
}
/**
* @private
*
* @param info
* @param head
* @param value
*/
private addProperty(info: egret.ITextStyle, head: string, value: string): void {
switch (head.toLowerCase()) {
case "color":
case "textcolor":
value = value.replace(/#/, "0x");
info.textColor = parseInt(value);
break;
case "strokecolor":
value = value.replace(/#/, "0x");
info.strokeColor = parseInt(value);
break;
case "stroke":
info.stroke = parseInt(value);
break;
case "b":
case "bold":
info.bold = value == "true";
break;
case "u":
info.underline = value == "true";
break;
case "i":
case "italic":
info.italic = value == "true";
break;
case "size":
info.size = parseInt(value);
break;
case "fontfamily":
info.fontFamily = value;
break;
case "href":
info.href = this.replaceSpecial(value);
break;
case "target":
info.target = this.replaceSpecial(value);
break;
}
}
/**
* @private
*/
private stackArray: Array<egret.ITextStyle>;
/**
* @private
*
* @param infoStr
*/
private addToArray(infoStr: string): void {
const info: egret.ITextStyle = this.changeStringToObject(infoStr);
if (this.stackArray.length == 0) {
this.stackArray.push(info);
}
else {
const lastInfo: Object = this.stackArray[this.stackArray.length - 1];
for (const key in lastInfo) {
if (info[key] == null) {
info[key] = lastInfo[key];
}
}
this.stackArray.push(info);
}
}
}
const parser = new HtmlTextParser();
export const parseHtmlText = (content) => {
return parser.parse(content);
}
import PanelCtrl from "../../src/ctrls/panelCtrl";
import SceneCtrl from "../../src/ctrls/sceneCtrl";
import Loading from "../../src/loading/Loading";
import { getResPath } from "../../src/utils";
import layers from "../../src/views/layers";
import { getResPath } from "../new_tc/utils";
import { check_webp_feature } from "../tc/util/GFun";
import { DataManager } from "../tw/manager/DataManager";
import AssetAdapter from "./adapter/AssetAdapter";
import ThemeAdapter from "./adapter/ThemeAdapter";
import layers from "./views/layers";
import Loading from "./components/Loading";
import PanelCtrl from "./ctrls/panelCtrl";
import SceneCtrl from "./ctrls/sceneCtrl";
export default class MainBase extends eui.UILayer {
constructor() {
......
import { getSkinPath } from "../utils";
import { getSkinPath } from "../../new_tc/utils";
export default class ComponentBase extends eui.Component {
protected data: any;
......
import { DataManager } from "../../tw/manager/DataManager";
import { NetManager } from "../../tw/manager/NetManager";
import Panel from "../views/Panel";
export default class HTMLRulePanel extends Panel {
public labContent: eui.Label;
public scroller: eui.Scroller;
start() {
if (!DataManager.ins.getRuleData)
NetManager.ins.getRule(() => {
this.addRule();
});
else
this.addRule();
}
group: eui.Group;
protected config = {
x: 15.5,
y: "50%",
width: 70,
marginTop: -18,
height: 56,
lineHeight: 7,
fontSize: 3.5,
color: "#ffffff"
}
private htmlNode;
private clearTime;
private addRule() {
// alert()
const text = DataManager.ins.getRuleData.ruleText;
console.log(DataManager.ins.getRuleData.ruleText)
this.htmlNode = document.createElement("DIV")
this.htmlNode.setAttribute("style", `position: fixed;overflow-x: hidden;margin-top:${this.config.marginTop}vw ;overflow-y: auto;top: ${this.config.y}; left: ${this.config.x}vw;width: ${this.config.width}vw;height: ${this.config.height}vw;line-height: ${this.config.lineHeight}vw;font-size: ${this.config.fontSize}vw;color: ${this.config.color}`)
this.htmlNode.setAttribute("id", `htmlNode`)
this.htmlNode.innerHTML = text
clearTimeout(this.clearTime)
this.clearTime = setTimeout(() => {
document.body.appendChild(this.htmlNode)
}, 500)
}
hidePanel() {
super.hidePanel()
console.log(document.body)
if (document.getElementById("htmlNode")) {
document.body.removeChild(this.htmlNode)
}
}
protected get skinKey() { return 'Rule' }
}
\ No newline at end of file
import ComponentBase from "../components/ComponentBase";
import ComponentBase from "./ComponentBase";
export default class Loading extends ComponentBase {
private static _parent: egret.Sprite;
......
import { IGameOptionData } from "../../libs/tw/data/game/getOptions/IGameOptionData";
import { getSkinPath } from "../utils";
import { getSkinPath } from "../../new_tc/utils";
export default class ItemRenderder extends eui.ItemRenderer {
constructor() {
super();
......
import { DataManager } from '../../libs/tw/manager/DataManager';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Panel from "../views/Panel";
import ItemRenderder from './ItemRenderder';
import { IGameOptionData } from '../../libs/tw/data/game/getOptions/IGameOptionData';
import { DataManager } from "../../tw/manager/DataManager";
import { NetManager } from "../../tw/manager/NetManager";
import ItemRenderder from "./OptionsItemRenderder";
import { IGameOptionData } from "../../tw/data/game/getOptions/IGameOptionData";
export default class OptionsPanel extends Panel {
start() {
if (!DataManager.ins.getOptionsData)
......
import showLog from "../../new_tw/ctrls/showLog";
import { LotteryType } from "../../tw/enum/LotteryType";
import { DataManager } from "../../tw/manager/DataManager";
import { NetManager } from "../../tw/manager/NetManager";
import Panel from "../views/Panel";
import { DataManager } from "../../libs/tw/manager/DataManager";
import getOptionImgSize from "./data/getOptionImgSize";
import ImgSizeType from "./data/ImgSizeType";
import { LotteryType } from "../../libs/tw/enum/LotteryType";
import { NetManager } from "../../libs/tw/manager/NetManager";
import showLog from "./ctrl/showLog";
export default class PrizePanel extends Panel {
start(data) {
const lottery = DataManager.ins.gameGetSubmitResultData.lottery;
this.data = lottery;
const sizeType = getOptionImgSize(lottery);
if (ImgSizeType.BIG === sizeType) {
this.img.width = this.picBigWidth;
this.img.height = this.picBigWidth / this.bigPicRatio;
} else {
this.img.width = this.img.height = this.picWidth;
}
this.img.width = this.picBigWidth;
this.img.height = this.picBigWidth / this.bigPicRatio;
showLog(lottery);
}
get picWidth() { return 240 };
get picBigWidth() { return 510 };
get bigPicRatio() { return 640 / 300 }
......
import { DataManager } from "../../tw/manager/DataManager";
import { NetManager } from "../../tw/manager/NetManager";
import { HtmlTextParser } from "../HtmlTextParser";
import Panel from "../views/Panel";
import { NetManager } from '../../libs/tw/manager/NetManager';
import { DataManager } from "../../libs/tw/manager/DataManager";
export default class RulePanel extends Panel {
public labContent: eui.Label;
public scroller: eui.Scroller;
......@@ -13,30 +15,10 @@ export default class RulePanel extends Panel {
this.addRule();
}
group:eui.Group;
group: eui.Group;
private addRule() {
let text: string = DataManager.ins.getRuleData.ruleText;
text = text.replace('/<div>/g', '');
text = text.replace('/</div>/g', '');
text = text.replace('/<br>/g', '<br> ');
const textlist = text.split('<br>');
console.log(text);
// this.labContent.textFlow = (new egret.HtmlTextParser).parser(DataManager.ins.getRuleData.ruleText);
for (const textItem of textlist) {
// }
// for (let i = 0; i < textlist.length; i++) {
const l = new eui.Label();
l.textColor=this.labContent.textColor;
l.size=this.labContent.size;
l.width=this.labContent.width;
l.minHeight=20;
l.textFlow = (new egret.HtmlTextParser).parser(textItem+'');
this.group.addChild(l)
}
const text = DataManager.ins.getRuleData.ruleText;
this.labContent.textFlow = (new HtmlTextParser).parser(DataManager.ins.getRuleData.ruleText);
}
protected get skinKey() { return 'Rule' }
......
......@@ -18,5 +18,5 @@ class Layers extends eui.UILayer {
}
const instance = new Layers();
export default instance
\ No newline at end of file
const layers = new Layers();
export default layers
\ No newline at end of file
......@@ -8,8 +8,8 @@ import { DataManager } from "../../../libs/tw/manager/DataManager";
* @param credits
* @param customizedType
*/
const doStart = (callback: Function, isAgain = false, credits?: number, customizedType?: number) => {
if (window['requirelogin'] && window['config_notrequirelogin'] === undefined) {
const doStart = (callback?: Function, isAgain = false, credits?: number, customizedType?: number) => {
if (window['requirelogin']) {
window['requirelogin']();
return;
}
......
import { DataManager } from "../../tw/manager/DataManager";
/**
* 剩余次数
* 为了按钮字体的美观,不展示开始游戏之外的文案,非常规状态由业务文案代替展示。
*/
const getCountTxt = () => {
let txt: string;
if (DataManager.ins.getInfoData.status.code != 0) {
txt = DataManager.ins.getInfoData.status.btnText;
} else {
txt = DataManager.ins.getInfoData.status.text;
}
return txt;
}
export default getCountTxt;
\ No newline at end of file
import { DataManager } from "../../tw/manager/DataManager";
/**
* 开始游戏按钮状态
*/
const getStartBtnEnable = () => {
let enable: boolean;
if (DataManager.ins.getInfoData.status.btnDisable || DataManager.ins.getInfoData.status.code == 6) {
enable = false;
} else {
enable = true;
}
return enable;
}
export default getStartBtnEnable;
\ No newline at end of file
{"file":"coin.png","frames":{
"00":{"x":852,"y":163,"w":109,"h":111,"offX":64,"offY":10,"sourceW":246,"sourceH":181},
"01":{"x":856,"y":0,"w":109,"h":161,"offX":61,"offY":11,"sourceW":246,"sourceH":181},
"03":{"x":637,"y":311,"w":189,"h":158,"offX":24,"offY":14,"sourceW":246,"sourceH":181},
"02":{"x":828,"y":311,"w":186,"h":160,"offX":25,"offY":12,"sourceW":246,"sourceH":181},
"06":{"x":435,"y":158,"w":200,"h":153,"offX":19,"offY":19,"sourceW":246,"sourceH":181},
"07":{"x":647,"y":156,"w":203,"h":153,"offX":18,"offY":19,"sourceW":246,"sourceH":181},
"11":{"x":0,"y":0,"w":217,"h":160,"offX":12,"offY":12,"sourceW":246,"sourceH":181},
"05":{"x":0,"y":162,"w":196,"h":155,"offX":21,"offY":18,"sourceW":246,"sourceH":181},
"04":{"x":219,"y":161,"w":193,"h":158,"offX":22,"offY":16,"sourceW":246,"sourceH":181},
"10":{"x":219,"y":0,"w":214,"h":159,"offX":13,"offY":14,"sourceW":246,"sourceH":181},
"09":{"x":435,"y":0,"w":210,"h":156,"offX":15,"offY":16,"sourceW":246,"sourceH":181},
"08":{"x":647,"y":0,"w":207,"h":154,"offX":16,"offY":18,"sourceW":246,"sourceH":181}}}
\ No newline at end of file
{"file":"gift.png","frames":{
"00":{"x":0,"y":615,"w":152,"h":148,"offX":40,"offY":20,"sourceW":237,"sourceH":239},
"01":{"x":194,"y":811,"w":152,"h":209,"offX":40,"offY":20,"sourceW":237,"sourceH":239},
"03":{"x":200,"y":405,"w":189,"h":205,"offX":23,"offY":24,"sourceW":237,"sourceH":239},
"02":{"x":0,"y":406,"w":186,"h":207,"offX":24,"offY":21,"sourceW":237,"sourceH":239},
"06":{"x":0,"y":207,"w":198,"h":197,"offX":20,"offY":32,"sourceW":237,"sourceH":239},
"07":{"x":210,"y":204,"w":202,"h":199,"offX":19,"offY":30,"sourceW":237,"sourceH":239},
"05":{"x":188,"y":612,"w":195,"h":197,"offX":21,"offY":31,"sourceW":237,"sourceH":239},
"04":{"x":0,"y":811,"w":192,"h":200,"offX":22,"offY":28,"sourceW":237,"sourceH":239},
"09":{"x":0,"y":0,"w":208,"h":205,"offX":17,"offY":24,"sourceW":237,"sourceH":239},
"08":{"x":210,"y":0,"w":205,"h":202,"offX":18,"offY":27,"sourceW":237,"sourceH":239}}}
\ No newline at end of file
{"file":"gift2.png","frames":{
"00":{"x":347,"y":320,"w":156,"h":157,"offX":42,"offY":7,"sourceW":244,"sourceH":184},
"01":{"x":189,"y":320,"w":156,"h":157,"offX":42,"offY":7,"sourceW":244,"sourceH":184},
"03":{"x":817,"y":160,"w":191,"h":158,"offX":27,"offY":10,"sourceW":244,"sourceH":184},
"02":{"x":0,"y":319,"w":187,"h":157,"offX":29,"offY":8,"sourceW":244,"sourceH":184},
"06":{"x":211,"y":160,"w":204,"h":158,"offX":20,"offY":18,"sourceW":244,"sourceH":184},
"07":{"x":0,"y":159,"w":209,"h":158,"offX":17,"offY":18,"sourceW":244,"sourceH":184},
"11":{"x":0,"y":0,"w":225,"h":157,"offX":8,"offY":8,"sourceW":244,"sourceH":184},
"05":{"x":417,"y":160,"w":200,"h":158,"offX":22,"offY":16,"sourceW":244,"sourceH":184},
"04":{"x":619,"y":160,"w":196,"h":158,"offX":24,"offY":13,"sourceW":244,"sourceH":184},
"10":{"x":227,"y":0,"w":222,"h":158,"offX":10,"offY":10,"sourceW":244,"sourceH":184},
"09":{"x":451,"y":0,"w":217,"h":158,"offX":13,"offY":13,"sourceW":244,"sourceH":184},
"08":{"x":670,"y":0,"w":213,"h":158,"offX":15,"offY":16,"sourceW":244,"sourceH":184}}}
\ No newline at end of file
{"file":"goldenbox.png","frames":{
"00":{"x":208,"y":259,"w":163,"h":126,"offX":47,"offY":21,"sourceW":260,"sourceH":170},
"01":{"x":848,"y":258,"w":163,"h":126,"offX":47,"offY":21,"sourceW":260,"sourceH":170},
"03":{"x":444,"y":258,"w":202,"h":127,"offX":29,"offY":24,"sourceW":260,"sourceH":170},
"02":{"x":648,"y":258,"w":198,"h":127,"offX":31,"offY":22,"sourceW":260,"sourceH":170},
"06":{"x":682,"y":129,"w":213,"h":127,"offX":23,"offY":30,"sourceW":260,"sourceH":170},
"07":{"x":463,"y":129,"w":217,"h":127,"offX":21,"offY":30,"sourceW":260,"sourceH":170},
"11":{"x":0,"y":0,"w":231,"h":132,"offX":14,"offY":22,"sourceW":260,"sourceH":170},
"05":{"x":233,"y":130,"w":209,"h":127,"offX":25,"offY":28,"sourceW":260,"sourceH":170},
"04":{"x":0,"y":134,"w":206,"h":127,"offX":27,"offY":26,"sourceW":260,"sourceH":170},
"10":{"x":233,"y":0,"w":228,"h":128,"offX":15,"offY":24,"sourceW":260,"sourceH":170},
"09":{"x":463,"y":0,"w":224,"h":127,"offX":17,"offY":26,"sourceW":260,"sourceH":170},
"08":{"x":689,"y":0,"w":221,"h":127,"offX":19,"offY":28,"sourceW":260,"sourceH":170}}}
\ No newline at end of file
{"file":"kids.png","frames":{
"kidschair":{"x":0,"y":286,"w":750,"h":229,"offX":0,"offY":2,"sourceW":750,"sourceH":231},
"kids":{"x":0,"y":0,"w":744,"h":284,"offX":0,"offY":0,"sourceW":744,"sourceH":284},
"girlhand":{"x":827,"y":0,"w":79,"h":60,"offX":0,"offY":0,"sourceW":79,"sourceH":60},
"girl_eye":{"x":946,"y":0,"w":36,"h":40,"offX":0,"offY":0,"sourceW":36,"sourceH":40},
"boyhand":{"x":746,"y":0,"w":79,"h":60,"offX":0,"offY":0,"sourceW":79,"sourceH":60},
"boy_eye":{"x":908,"y":0,"w":36,"h":41,"offX":0,"offY":0,"sourceW":36,"sourceH":41}}}
\ No newline at end of file
{"file":"monkey.png","frames":{
"monkey":{"x":0,"y":0,"w":265,"h":525,"offX":0,"offY":0,"sourceW":265,"sourceH":525},
"eyeright":{"x":267,"y":0,"w":51,"h":47,"offX":0,"offY":0,"sourceW":51,"sourceH":47},
"eyeleft":{"x":320,"y":0,"w":48,"h":47,"offX":0,"offY":0,"sourceW":48,"sourceH":47}}}
\ No newline at end of file
{"file":"net.png","frames":{
"00":{"x":0,"y":430,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558},
"01":{"x":1222,"y":0,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558},
"03":{"x":611,"y":855,"w":610,"h":383,"offX":68,"offY":59,"sourceW":750,"sourceH":558},
"02":{"x":1223,"y":430,"w":610,"h":414,"offX":68,"offY":81,"sourceW":750,"sourceH":558},
"06":{"x":0,"y":1240,"w":610,"h":372,"offX":68,"offY":39,"sourceW":750,"sourceH":558},
"07":{"x":1223,"y":846,"w":610,"h":389,"offX":68,"offY":84,"sourceW":750,"sourceH":558},
"05":{"x":612,"y":1610,"w":610,"h":371,"offX":68,"offY":19,"sourceW":750,"sourceH":558},
"04":{"x":1223,"y":1237,"w":612,"h":371,"offX":65,"offY":32,"sourceW":750,"sourceH":558},
"10":{"x":611,"y":0,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558},
"09":{"x":0,"y":0,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558},
"08":{"x":611,"y":430,"w":610,"h":423,"offX":68,"offY":100,"sourceW":750,"sourceH":558}}}
\ No newline at end of file
{"file":"openstate.png","frames":{
"silverboxOpenState":{"x":0,"y":0,"w":292,"h":222,"offX":0,"offY":0,"sourceW":292,"sourceH":222},
"woodboxOpenState":{"x":762,"y":0,"w":220,"h":209,"offX":0,"offY":0,"sourceW":220,"sourceH":209},
"coinOpenState":{"x":294,"y":216,"w":148,"h":151,"offX":2,"offY":3,"sourceW":150,"sourceH":154},
"gift2OpenState":{"x":543,"y":0,"w":217,"h":232,"offX":0,"offY":0,"sourceW":217,"sourceH":232},
"goldenboxOpenState":{"x":294,"y":0,"w":247,"h":214,"offX":0,"offY":0,"sourceW":247,"sourceH":214},
"giftOpenState":{"x":762,"y":211,"w":206,"h":218,"offX":0,"offY":0,"sourceW":206,"sourceH":218}}}
\ No newline at end of file
{"file":"river.png","frames":{
"river4":{"x":28,"y":0,"w":26,"h":128,"offX":0,"offY":0,"sourceW":26,"sourceH":128},
"river3":{"x":56,"y":0,"w":18,"h":121,"offX":0,"offY":0,"sourceW":18,"sourceH":121},
"river2":{"x":0,"y":0,"w":26,"h":128,"offX":0,"offY":0,"sourceW":26,"sourceH":128},
"river1":{"x":76,"y":0,"w":22,"h":81,"offX":0,"offY":0,"sourceW":22,"sourceH":81}}}
\ No newline at end of file
{"file":"silverbox.png","frames":{
"00":{"x":750,"y":266,"w":160,"h":130,"offX":67,"offY":12,"sourceW":273,"sourceH":166},
"01":{"x":588,"y":266,"w":160,"h":130,"offX":67,"offY":12,"sourceW":273,"sourceH":166},
"03":{"x":0,"y":266,"w":213,"h":131,"offX":36,"offY":15,"sourceW":273,"sourceH":166},
"02":{"x":215,"y":266,"w":209,"h":131,"offX":38,"offY":13,"sourceW":273,"sourceH":166},
"06":{"x":231,"y":133,"w":225,"h":131,"offX":30,"offY":23,"sourceW":273,"sourceH":166},
"12":{"x":426,"y":266,"w":160,"h":130,"offX":67,"offY":12,"sourceW":273,"sourceH":166},
"07":{"x":0,"y":133,"w":229,"h":131,"offX":28,"offY":23,"sourceW":273,"sourceH":166},
"11":{"x":0,"y":0,"w":245,"h":131,"offX":20,"offY":13,"sourceW":273,"sourceH":166},
"05":{"x":458,"y":133,"w":221,"h":131,"offX":32,"offY":21,"sourceW":273,"sourceH":166},
"04":{"x":681,"y":133,"w":217,"h":131,"offX":34,"offY":18,"sourceW":273,"sourceH":166},
"10":{"x":247,"y":0,"w":241,"h":131,"offX":22,"offY":15,"sourceW":273,"sourceH":166},
"09":{"x":490,"y":0,"w":237,"h":131,"offX":24,"offY":18,"sourceW":273,"sourceH":166},
"08":{"x":729,"y":0,"w":233,"h":131,"offX":26,"offY":21,"sourceW":273,"sourceH":166}}}
\ No newline at end of file
{"file":"woodbox.png","frames":{
"00":{"x":0,"y":301,"w":147,"h":148,"offX":44,"offY":5,"sourceW":230,"sourceH":180},
"01":{"x":149,"y":301,"w":146,"h":148,"offX":44,"offY":5,"sourceW":230,"sourceH":180},
"03":{"x":564,"y":151,"w":177,"h":148,"offX":28,"offY":8,"sourceW":230,"sourceH":180},
"02":{"x":743,"y":151,"w":173,"h":148,"offX":30,"offY":6,"sourceW":230,"sourceH":180},
"06":{"x":0,"y":150,"w":190,"h":149,"offX":21,"offY":14,"sourceW":230,"sourceH":180},
"07":{"x":826,"y":0,"w":194,"h":149,"offX":18,"offY":14,"sourceW":230,"sourceH":180},
"11":{"x":0,"y":0,"w":211,"h":148,"offX":9,"offY":6,"sourceW":230,"sourceH":180},
"05":{"x":192,"y":150,"w":186,"h":149,"offX":23,"offY":13,"sourceW":230,"sourceH":180},
"04":{"x":380,"y":151,"w":182,"h":149,"offX":25,"offY":10,"sourceW":230,"sourceH":180},
"10":{"x":213,"y":0,"w":207,"h":148,"offX":11,"offY":8,"sourceW":230,"sourceH":180},
"09":{"x":422,"y":0,"w":202,"h":149,"offX":14,"offY":10,"sourceW":230,"sourceH":180},
"08":{"x":626,"y":0,"w":198,"h":149,"offX":16,"offY":13,"sourceW":230,"sourceH":180}}}
\ No newline at end of file
......@@ -5,11 +5,7 @@
"name": "rule"
},
{
"keys": "guide_tips_png,guide_hand_png,guide_dialog_png",
"name": "guide"
},
{
"keys": "ruleBtn_png,optionBtn_png",
"keys": "ruleBtn_png,optionBtn_png,bg1_jpg,recordbtn_png",
"name": "startscene"
},
{
......@@ -25,8 +21,8 @@
"name": "prize"
},
{
"keys": "river4_png,river3_png,river2_png,river1_png,river5_png,river6_png,river7_png",
"name": "river"
"name": "preload",
"keys": "bg2_jpg,guide1_png,guide2_png,发弹雾气_png,大炮板子_png,大炮的头_png,火_png,火箭_png,轮子1_png,音乐关闭_png,音乐开启_png"
}
],
"resources": [
......@@ -40,63 +36,6 @@
"type": "image",
"name": "ruleBg_png"
},
{
"url": "assets/startScene/bg.jpg",
"type": "image",
"name": "bg_jpg"
},
{
"url": "assets/startScene/gift2.png",
"type": "image",
"name": "gift2_png"
},
{
"url": "assets/startScene/coin.png",
"type": "image",
"name": "coin_png"
},
{
"url": "assets/startScene/gift.png",
"type": "image",
"name": "gift_png"
},
{
"url": "assets/startScene/goldenbox.png",
"type": "image",
"name": "goldenbox_png"
},
{
"url": "assets/startScene/silverbox.png",
"type": "image",
"name": "silverbox_png"
},
{
"url": "assets/startScene/woodbox.json",
"type": "sheet",
"name": "woodbox_json",
"subkeys": "00,01,02,03,04,05,06,07,08,09,10,11"
},
{
"url": "assets/startScene/net.json",
"type": "sheet",
"name": "net_json",
"subkeys": "00,01,02,03,04,05,06,07,08,09,10"
},
{
"url": "assets/startScene/guide/guide_tips.png",
"type": "image",
"name": "guide_tips_png"
},
{
"url": "assets/startScene/guide/guide_hand.png",
"type": "image",
"name": "guide_hand_png"
},
{
"url": "assets/startScene/guide/guide_dialog.png",
"type": "image",
"name": "guide_dialog_png"
},
{
"url": "assets/startScene/optionBtn.png",
"type": "image",
......@@ -148,57 +87,79 @@
"name": "prizePanelUseBtn_png"
},
{
"url": "assets/startScene/monkey.json",
"type": "sheet",
"name": "monkey_json",
"subkeys": "eyeleft,eyeright,monkey"
"url": "assets/startScene/bg1.jpg",
"type": "image",
"name": "bg1_jpg"
},
{
"url": "assets/startScene/start_btn_gray.png",
"type": "image",
"name": "start_btn_gray_png"
},
{
"url": "assets/startScene/kids.json",
"type": "sheet",
"name": "kids_json",
"subkeys": "boy_eye,boyhand,girl_eye,girlhand,kids,kidschair"
"url": "assets/startScene/start_btn.png",
"type": "image",
"name": "start_btn_png"
},
{
"url": "assets/startScene/river.json",
"type": "sheet",
"name": "river_json",
"subkeys": "river1,river2,river3,river4"
"url": "assets/startScene/recordbtn.png",
"type": "image",
"name": "recordbtn_png"
},
{
"name": "bg2_jpg",
"type": "image",
"url": "assets/playscene/bg2.jpg"
},
{
"name": "guide1_png",
"type": "image",
"url": "assets/playscene/guide1.png"
},
{
"name": "guide2_png",
"type": "image",
"url": "assets/playscene/guide2.png"
},
{
"name": "发弹雾气_png",
"type": "image",
"url": "assets/playscene/发弹雾气.png"
},
{
"url": "assets/startScene/river/river4.png",
"name": "大炮板子_png",
"type": "image",
"name": "river4_png"
"url": "assets/playscene/大炮板子.png"
},
{
"url": "assets/startScene/river/river3.png",
"name": "大炮的头_png",
"type": "image",
"name": "river3_png"
"url": "assets/playscene/大炮的头.png"
},
{
"url": "assets/startScene/river/river2.png",
"name": "火_png",
"type": "image",
"name": "river2_png"
"url": "assets/playscene/火.png"
},
{
"url": "assets/startScene/river/river1.png",
"name": "火箭_png",
"type": "image",
"name": "river1_png"
"url": "assets/playscene/火箭.png"
},
{
"url": "assets/startScene/river/river5.png",
"name": "轮子1_png",
"type": "image",
"name": "river5_png"
"url": "assets/playscene/轮子1.png"
},
{
"url": "assets/startScene/river/river7.png",
"name": "音乐关闭_png",
"type": "image",
"name": "river7_png"
"url": "assets/playscene/音乐关闭.png"
},
{
"url": "assets/startScene/river/river6.png",
"name": "音乐开启_png",
"type": "image",
"name": "river6_png"
"url": "assets/playscene/音乐开启.png"
}
]
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="PlaySkin" width="750" height="1663" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image horizontalCenter="0" source="bg2_jpg" top="0"/>
<e:Group x="0" top="20" width="100%">
<e:Group y="0" right="20">
<e:Button id="musicon" label="" x="0" y="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="音乐开启_png" source.down="音乐开启_png" source.disabled="音乐开启_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="musicoff" label="">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="音乐关闭_png" source.down="音乐关闭_png" source.disabled="音乐关闭_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Group>
<e:Group x="201" y="0">
<e:Image source="火_png" x="0" y="0"/>
<e:Label text="20%" x="41" y="0" verticalAlign="middle" textAlign="center" width="96" height="100%" fontFamily="Helvetica"/>
</e:Group>
<e:Group x="22" top="0">
<e:Image source="火箭_png" left="0" top="0"/>
<e:Label text="10" x="41" verticalCenter="0" height="100%" verticalAlign="middle" textAlign="center" width="96" fontFamily="Helvetica"/>
</e:Group>
<e:Label id="score" text="123456789" y="63" verticalAlign="middle" textAlign="center" width="100%" size="65" bold="true" fontFamily="Helvetica"/>
</e:Group>
<e:Group id="car" x="329" width="93" verticalCenter="418">
<e:Image source="大炮板子_png" y="125" anchorOffsetX="46.5" x="46.5"/>
<e:Image source="大炮的头_png" y="51" anchorOffsetX="35" width="70" horizontalCenter="0"/>
<e:Image id="lunzi1" source="轮子1_png" anchorOffsetX="22.5" anchorOffsetY="22.5" x="10" y="142.5"/>
<e:Image id="lunzi2" source="轮子1_png" anchorOffsetX="22.5" anchorOffsetY="22.5" x="82" y="142.5"/>
<e:Image id="fireEffect" source="发弹雾气_png" y="29" horizontalCenter="0"/>
</e:Group>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="StartSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Button id="ruleBtn" label="" x="29.27" y="42">
<e:Skin class="StartSkin" width="750" height="1594" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="bg1_jpg" scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0"/>
<e:Button id="startBtn" label="" scaleX="1" scaleY="1" y="780" horizontalCenter="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="ruleBtn_png" source.down="ruleBtn_png" source.disabled="ruleBtn_png"/>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="start_btn_png" source.down="start_btn_png" source.disabled="start_btn_gray_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="optionBtn" label="" x="632.57" y="42">
<e:skinName>
<e:Label id="countTxt" text="Label" width="100%" verticalAlign="middle" textAlign="center" y="901" horizontalCenter="0"/>
<e:Label id="exemptionTxt" text="*兑换项与活动均与设备制造商Apple Inc.公司无关*" width="100%" horizontalCenter="0" bottom="5" verticalAlign="middle" textAlign="center" textColor="0x333333" size="18"/>
<e:Group x="0" y="17">
<e:Button id="recordBtn" label="" x="611" y="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="optionBtn_png" source.down="optionBtn_png" source.disabled="optionBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
<e:Image width="100%" height="100%" source="recordbtn_png" source.down="recordbtn_png" source.disabled="recordbtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:skinName>
</e:Button>
<e:Button id="ruleBtn" label="" x="10" y="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="ruleBtn_png" source.down="ruleBtn_png" source.disabled="ruleBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="optionBtn" label="" x="329" y="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="optionBtn_png" source.down="optionBtn_png" source.disabled="optionBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Group>
</e:Skin>
\ No newline at end of file
import MainBase from "../libs/tl/MainBase";
import Alert from "../libs/new_tl/components/Alert";
import OptionsPanel from "../libs/new_tl/components/OptionsPanel";
import PrizePanel from "../libs/new_tl/components/PrizePanel";
import RulePanel from "../libs/new_tl/components/RulePanel";
import PanelCtrl from "../libs/new_tl/ctrls/panelCtrl";
import SceneCtrl from "../libs/new_tl/ctrls/sceneCtrl";
import showAlertPanel from "../libs/new_tl/ctrls/showAlertPanel";
import MainBase from "../libs/new_tl/MainBase";
import { ModuleTypes } from "../libs/new_tl/types/sceneTypes";
import { NetManager } from "../libs/tw/manager/NetManager";
import Alert from "./alert/Alert";
import PanelCtrl from "./ctrls/panelCtrl";
import SceneCtrl from "./ctrls/sceneCtrl";
import OptionsPanel from "./optionsPanel/OptionsPanel";
import RulePanel from "./rulePanel/RulePanel";
import StartScene from "./startScene/StartScene";
import { ModuleTypes } from "./types/sceneTypes";
import PrizePanel from "./prizePanel/PrizePanel";
import showAlertPanel from "./ctrls/showAlertPanel";
import PlayScene from "./playScene/PlayScene";
class Main extends MainBase {
protected registerModules() {
......@@ -18,7 +19,8 @@ class Main extends MainBase {
PanelCtrl.instance.registerPanelClass(ModuleTypes.PRIZE_PANEL, PrizePanel);
SceneCtrl.instance.registerSceneClass(ModuleTypes.START_SCENE, StartScene);
NetManager.ins.onNotSuccess=(msg)=>{
SceneCtrl.instance.registerSceneClass(ModuleTypes.PALY_SCENE, PlayScene);
NetManager.ins.onNotSuccess = (msg) => {
showAlertPanel(msg)
}
}
......@@ -32,11 +34,9 @@ class Main extends MainBase {
SceneCtrl.instance.change(ModuleTypes.START_SCENE);
}
}
window['Main'] = Main;
egret.runEgret({
renderMode: "webgl", audioType: 0, calculateCanvasScaleFactor: (context:any)=> {
renderMode: "webgl", audioType: 0, calculateCanvasScaleFactor: (context: any) => {
const backingStore = context.backingStorePixelRatio ||
context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
......
// ∏import { DataManager, NetManager } from "duiba-tw";
import { DataManager } from "../../../libs/tw/manager/DataManager";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import Loading from "../../loading/Loading";
export default
() => new Promise((resolve) => {
const _callback = (data) => {
Loading.instace.hide();
resolve(data);
}
Loading.instace.show();
if (DataManager.ins.getRuleData) {
_callback(true);
} else {
NetManager.ins.getRule(_callback);
}
})
// import { NetManager } from "../../../libs/tw/manager/NetManager";
import Loading from "../../loading/Loading";
import { NetManager } from "../../../libs/tw/manager/NetManager";
/**
* 实时排行榜
* @param {number} type 0总排行榜 1今日排行榜 2 多游戏总排行榜 3 昨日排行榜
* @param {number} count 返回榜单长度 最大50
*/
export default (callback, type, count) => {
const _callback = (data) => {
Loading.instace.hide();
callback(data);
}
Loading.instace.show();
NetManager.ins.realtimerank(_callback, type, count);
}
\ No newline at end of file
import Scene from "../../libs/new_tl/views/Scene";
export default class PlayScene extends Scene {
async start(data?) {
}
initEvents() {
}
protected get skinKey() { return 'Play' }
}
\ No newline at end of file
class ImgSizeType {
static BIG = 'big';
static SMALL = 'small';
}
export default ImgSizeType
\ No newline at end of file
import { LotteryData } from "../../../libs/tw/data/common/lottery/LotteryData";
import ImgSizeType from "./ImgSizeType";
const getOptionImgSize = (lottery: LotteryData) => {
return ImgSizeType.BIG
}
// const getOptionImgSize = (lottery: LotteryData) => {
// let size:string;
// if (
// lottery.type == LotteryType.VIRTUAL ||
// lottery.type == LotteryType.OBJECT) {
// size = ImgSizeType.SMALL
// } else {
// size = ImgSizeType.BIG;
// }
// return size;
// }
export default getOptionImgSize
\ No newline at end of file
import SheetAnimation from "../components/SheetAnimation";
export default class Box extends egret.Sprite {
private _pic: SheetAnimation;
private _type: string;
private START_SCALE = 0.5;
private START_X = 375;
private START_Y = 350;
private END_Y = 1100;
static MIDDLE_Y = 800+100+30;
speed = 0;
static hashCounter = 0
hash;
constructor(type) {
super();
this.hash = Box.hashCounter++;
this._type = type;
this._pic = new SheetAnimation();
this.addChild(this._pic);
}
private _passMiddleTag: boolean;
onEnterFrame() {
this.y += this.speed;
let distance = this.y - this.START_Y;
const totalDistance = (Box.MIDDLE_Y - this.START_Y);
if (distance > totalDistance) {
distance = totalDistance;
}
if (this.y > Box.MIDDLE_Y && !this._passMiddleTag) {
this._passMiddleTag = true;
this.dispatchEvent(new egret.Event('onPassMiddle'));
}
const scale = this.START_SCALE + (1 - this.START_SCALE) * (distance / totalDistance);
this.scaleX = this.scaleY = scale;
if (this.y > this.END_Y && !this._onDisappear) {
this.disappear();
}
}
move() {
this._pic.play();
if (!this._isPausing)
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
private _onDisappear: boolean;
disappear() {
if (!this._onDisappear)
this.dispatchEvent(new egret.Event('onDisappear'));
this._onDisappear = true;
this._pic.destroy();
egret.Tween.get(this).to({ alpha: 0 }, 500).call(this.destroy, this);
}
destroy() {
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.parent.removeChild(this);
}
private _isPausing: boolean;
pause() {
this._isPausing = true;
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
resume() {
this._isPausing = false;
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
async createBg() {
const url = this.boxData.skin;
return new Promise((resolve) => {
RES.getResByUrl(url, (sheet: egret.SpriteSheet) => {
this._pic.sheet = sheet;
this._pic.fps = 10;
egret.Tween.get(this)
.set({ alpha: 0, scaleX: 0, scaleY: 0, x: this.START_X, y: this.START_Y })
.to({ alpha: 1, scaleX: this.START_SCALE, scaleY: this.START_SCALE }, 500, egret.Ease.getBackInOut(2))
.call(this.move, this);
this.anchorOffsetX = this.boxData.offset[0];
this.anchorOffsetY = this.boxData.offset[1];
resolve(this);
}, this, RES.ResourceItem.TYPE_SHEET);
});
}
async createFirstBg() {
const url = this.boxData.skin;
return new Promise((resolve) => {
RES.getResByUrl(url, (sheet: egret.SpriteSheet) => {
this._pic.sheet = sheet;
this._pic.fps = 10;
this.x = this.START_X;
this.y = this.START_Y
this.scaleX = this.scaleY = this.START_SCALE;
this.move();
this.anchorOffsetX = this.boxData.offset[0];
this.anchorOffsetY = this.boxData.offset[1];
resolve(this);
}, this, RES.ResourceItem.TYPE_SHEET);
});
}
private _vyStart = 25;
private _vy: number;
private _gy: number;
private _throwStartVY: number;
private _scaleMax = 2;
onThrowTick() {
this._vy += this._gy;
this.y += this._vy;
const scale = (this._vyStart * this._scaleMax - Math.abs(this._vy)) / this._vyStart;
this.scaleX = this.scaleY = scale;
}
doThrow() {
this._pic.stopAtIdleFrame();
this._throwStartVY = this._vy;
this._vy = -this._vyStart;
this._gy = .55;
this.y = Box.MIDDLE_Y;
}
get vy() { return this._vy }
get type() { return this._type }
get boxData() { return __boxmap__[this._type] }
}
\ No newline at end of file
import Box from "./Box";
import { getBoxKeyList } from "./data/getBoxKeyList";
export default class BoxListCtrl extends egret.EventDispatcher {
private _parent: egret.Sprite;
private _boxKeys: string[];
private _boxs: Box[];
private _boxSpeed: number;
constructor(parent: egret.Sprite) {
super();
this._parent = parent;
this._boxs = [];
this.init();
this._boxSpeed = __boxMoveSpeed__;
}
init() {
this._boxKeys = getBoxKeyList();
}
private _timer: number;
private _currentBoxIndex = 0;
private _frameCounter = 0;
/** 创建其他的boxs */
resume() {
this._parent.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this._boxs.forEach(box => box.resume());
}
pause() {
this._parent.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this._boxs.forEach(box => box.pause());
}
onEnterFrame() {
this._frameCounter++;
if (this._frameCounter > __BOX_CREATE_INTERVAL__) {
this._frameCounter = 0;
this.createBox();
this._currentBoxIndex++;
if (this._currentBoxIndex >= this._boxKeys.length)
this._currentBoxIndex = 0;
}
}
createBox() {
const box = new Box(this._boxKeys[this._currentBoxIndex]);
box.speed = this._boxSpeed;
box.addEventListener('onDisappear', this.onDisappear, this);
this._parent.addChild(box);
box.createBg();
this._boxs.push(box);
}
onDisappear(e: egret.Event) {
const currentBox = e.target as Box;
this.removeBoxFromList(currentBox);
}
removeBoxFromList(currentBox: Box) {
const index = this._boxs.indexOf(currentBox);
if (index != -1) this._boxs.splice(index, 1);
}
reset() {
clearInterval(this._timer);
this._timer = 0;
this._currentBoxIndex = 0;
}
createFirstBox() {
return new Promise(async (resolve) => {
const box = new Box(this._boxKeys[this._currentBoxIndex]);
box.speed = this._boxSpeed;
box.addEventListener('onDisappear', this.onDisappear, this);
this._boxs.push(box);
this._parent.addChild(box);
this._currentBoxIndex++;
await box.createFirstBg();
this.dispatchEvent(new egret.Event(egret.Event.COMPLETE));
resolve();
})
}
updateSpeed(val: number) {
this._boxSpeed = val;
this._boxs.forEach((box) => {
box.speed = this._boxSpeed;
});
}
get boxs() { return this._boxs }
}
\ No newline at end of file
export default class Guide extends egret.Sprite {
destroy(): any {
this.parent.removeChild(this);
}
constructor(parent: egret.Sprite) {
super();
this.touchEnabled=true;
this.graphics.beginFill(0, .7);
this.graphics.drawRect(0, 0, parent.stage.stageWidth, parent.stage.stageHeight);
this.graphics.endFill();
parent.addChild(this);
}
}
\ No newline at end of file
import StartScene from "./StartScene";
import Monkey from "./Monkey";
export default class GuideCtrl extends egret.EventDispatcher {
private _main: StartScene;
private _tag: boolean;
private _guideTop: egret.Sprite;
constructor(view: StartScene) {
super();
this._main = view;
this.init();
}
start() {
if (this._tag) {
this._main.guideView.destroy();
this._main.addTouchEvent();
this.doComplete();
}
else {
this.startGuide();
}
}
private startGuide() {
this._guideTop = new egret.Sprite();
this._main.topLay.addChild(this._guideTop);
this._main.monkey.once('onStartShaking', this.onMonkeyStartShaking, this);
this._main.boxListCtrl.boxs[0].once('onPassMiddle', this.onPassMiddle, this);
this._main.boxListCtrl.updateSpeed(__boxMoveSpeed__ * 10);
}
onPassMiddle() {
this._main.boxListCtrl.pause();
this.addGuide();
}
tips;
async addGuide() {
const hand = await RES.getResAsync('guide_hand_png');
const tips = await RES.getResAsync('guide_tips_png');
const guide_dialog = await RES.getResAsync('guide_dialog_png');
this.doComplete();
await this.showtipsAni(tips);
await this.showhandAni(hand);
await this.showguideAni(guide_dialog);
}
private doComplete() {
this.dispatchEvent(new egret.Event(egret.Event.COMPLETE));
}
enableInteract() {
if (!this._tag)
this._main.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
}
async showtipsAni(texture) {
const pic = new egret.Bitmap(texture);
pic.anchorOffsetX = pic.width >> 1;
pic.anchorOffsetY = pic.height >> 1;
this._guideTop.addChild(pic);
return new Promise((r) => {
egret.Tween.get(pic).set({ x: 0, y: 710 + 130 })
.to({ x: 750 / 2 }, 200, egret.Ease.getBackOut(3)).wait(200)
.call(() => r(pic));
});
}
async showhandAni(texture) {
const pic = new egret.Bitmap(texture);
pic.anchorOffsetX = pic.width >> 1;
pic.anchorOffsetY = pic.height >> 1;
this._guideTop.addChild(pic);
return new Promise((r) => {
egret.Tween.get(pic).set({ x: 750, y: 930 + 130 }).to({ x: 750 / 2 }, 200, egret.Ease.getBackOut(3))
.wait(200).call(() => r(pic));
});
}
async showguideAni(texture) {
const pic = new egret.Bitmap(texture);
pic.anchorOffsetX = pic.width >> 1;
pic.anchorOffsetY = pic.height >> 1;
this._guideTop.addChild(pic);
return new Promise((r) => {
egret.Tween.get(pic).set({ x: 750, y: 200 }).to({ x: 200 }, 200, egret.Ease.getBackOut(3))
.wait(200).call(() => r(pic));
});
}
onTouch() {
if (!this._main.checkCanDoAtion()) return;
this._main.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
this._main.boxListCtrl.updateSpeed(__boxMoveSpeed__);
this.setTag();
this._main.guideView.destroy();
egret.Tween.get(this._guideTop).to({ alpha: 0 }, 200).call(() => {
this._main.topLay.removeChild(this._guideTop);
}, this);
this._main.doAction();
this._main.addTouchEvent();
}
onMonkeyStartShaking() {
this._main.monkey.stop(Monkey.RANGE / 3)
}
private init() {
this._tag = localStorage.getItem('guide') === '1';
}
setTag() {
localStorage.setItem('guide', '1');
}
}
\ No newline at end of file
export default class Monkey extends egret.Sprite {
private h = 525;
private w = 265;
private h0 = 8;
private w0 = 118;
private h1 = 23;
private w1 = 29;
private r1;
private len;
private targetY = 70;
private targetX = 369;
static RANGE = 60;
private _shakeSpeed = .5;
constructor() {
super();
this.anchorOffsetX = 113;
this.anchorOffsetY = 8;
const a = this.w0 - this.w1;
const b = this.h - this.h0 - this.h1;
this.r1 = Math.tan(a / b) / Math.PI * 180;
this.len = Math.sqrt(a * a + b * b);
this.start();
}
private async start() {
await this.createBg();
this.dispatchEvent(new egret.Event(egret.Event.COMPLETE));
egret.Tween.get(this)
.set({ scaleX: 0.1, scaleY: 0.1, alpha: .5, rotation: Monkey.RANGE / 3, x: this.targetX })
.to({ y: this.targetY, x: this.targetX, scaleX: 1, scaleY: 1, alpha: 1 }, 1000, egret.Ease.getBackOut(.9))
.wait(500)
.call(this.startShaking, this);
}
startShaking() {
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.dispatchEvent(new egret.Event('onStartShaking'));
}
stopShaking() {
if (this.hasEventListener(egret.Event.ENTER_FRAME))
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
stop(rotation = 0) {
this.stopShaking();
this._dir = 1;
this.rotation = rotation;
}
private _dir = 1;
onEnterFrame() {
this.rotation += this._shakeSpeed * this._dir;
if (this.rotation > Monkey.RANGE)
this._dir = -1;
if (this.rotation < -Monkey.RANGE)
this._dir = 1;
this.dispatchEvent(new egret.Event('pointUpdate', false, false, this.getPoint()))
}
getPoint() {
const r = (this.r1 + this.rotation) / 180 * Math.PI;
const a = Math.sin(r) * this.len;
const b = Math.cos(r) * this.len;
const y = b;
const x = -a;
return new egret.Point(x, y);
}
async createBg() {
return new Promise(async (resolve) => {
const picData: egret.SpriteSheet = await RES.getResAsync('monkey_json');
const pic = new egret.Bitmap(picData.getTexture('monkey'));
this.addChild(pic);
const eye_left = picData.getTexture('eyeleft');
const eye_right = picData.getTexture('eyeright');
this.addAnimation(eye_left, 63, 344);
this.addAnimation(eye_right, 127, 343);
resolve(pic)
});
}
addAnimation(texture: egret.Texture, x: number, y: number) {
const pic = new egret.Bitmap(texture);
this.addChild(pic);
pic.anchorOffsetX = texture.textureWidth >> 1;
pic.anchorOffsetY = texture.textureHeight >> 1;
pic.x = x;
pic.y = y;
egret.Tween.get(pic, { loop: true })
.to({ scaleY: 0 }, 200)
.to({ scaleY: 1 }, 200).wait(5000);
}
}
\ No newline at end of file
import SheetAnimation from "../components/SheetAnimation";
import { getResPath } from "../utils";
export default class Net extends egret.Sprite {
private _pic: SheetAnimation;
constructor() {
super();
this._pic = new SheetAnimation();
this.addChild(this._pic);
this.createBg();
this.y = 600+30;
}
doAction() {
if (!this._pic.sheet) return;
this._pic.play();
this._pic.addEventListener('frameUpdate', this.onEnterFrame, this);
}
onEnterFrame(e: egret.Event) {
if (e.data == this._pic.totalFrames) {
this._pic.removeEventListener('frameUpdate', this.onEnterFrame, this);
this._pic.stopAtFirstFrame();
}
}
createBg() {
const url = getResPath() + `resource/assets/startScene/net.json`;
RES.getResByUrl(url, (sheet: egret.SpriteSheet) => {
this._pic.sheet = sheet;
this._pic.fps = 20;
this.alpha = 0;
egret.Tween.get(this).to({ alpha: 1 }, 500);
// setInterval(() => {
// this.doAction()
// }, 5000);
this.dispatchEvent(new egret.Event(egret.Event.COMPLETE));
}, this, RES.ResourceItem.TYPE_SHEET);
}
}
\ No newline at end of file
import { GamePlayModel } from "../../libs/tw/model/game/GamePlayModel";
import Scene from "../views/Scene";
import Box from "./Box";
import BoxListCtrl from "./BoxListCtrl";
import LayerTypes from "./data/LayerTypes";
import debug from "./debug";
import Guide from "./Guide";
import GuideCtrl from "./GuideCtrl";
import Monkey from "./Monkey";
import Net from "./Net";
import BoxOpenState from "./view/BoxOpenState";
import { NetManager } from "../../libs/tw/manager/NetManager";
import PanelCtrl from "../../libs/new_tl/ctrls/panelCtrl";
import { ModuleTypes } from "../../libs/new_tl/types/sceneTypes";
import Scene from "../../libs/new_tl/views/Scene";
import doStart from "../../libs/new_tw/ctrls/doStart";
import SceneCtrl from "../../libs/new_tl/ctrls/sceneCtrl";
import { DataManager } from "../../libs/tw/manager/DataManager";
import submitAfterDostart from "../../libs/new_tw/ctrls/submitAfterDostart";
import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import showAlertPanel from "../ctrls/showAlertPanel";
import Panel from "../views/Panel";
import Tips from "./view/Tips";
import DeclareTextTips from "./view/DeclareText";
import Kids from "./view/Kids";
import River from "./view/River";
import getStartBtnEnable from "../../libs/new_tw/datas/getStartBtnEnable";
import getCountTxt from "../../libs/new_tw/datas/getCountTxt";
import getIsIOS from "../../libs/new_tc/getIsIOS";
const { TouchEvent } = egret;
export default class StartScene extends Scene {
private _net: Net;
private _kids: Kids;
private _monkey: Monkey;
private _boxListCtrl: BoxListCtrl;
private _guideView: Guide;
private _guideCtrl: GuideCtrl;
static NET_RANGE = 200;
private _debug: debug;
private _keyResCounter = 0;
async start(data?) {
this.initUI();
const t1 = Date.now() - __t0__; console.log(`startScene添加到stage:${t1 / 1000}s`)
const picData: any = await this.getBg();
const pic = new egret.Bitmap(picData);
egret.Tween.get(pic).set({ alpha: 0 }).to({ alpha: 1 }, 200);
this.getLayer(LayerTypes.bg).addChild(pic);
const t2 = Date.now() - __t0__; console.log(`首屏(背景显示)时间:${t2 / 1000}s`);
this.getLayer(LayerTypes.ui).visible = true;
this._boxListCtrl = new BoxListCtrl(this.getLayer(LayerTypes.box));
await this._boxListCtrl.createFirstBox();
this._boxListCtrl.resume();
this.canInteract();
const monkey = new Monkey();
this.getLayer(LayerTypes.monkey).addChild(monkey);
monkey.addEventListener('pointUpdate', this.onPointUpdate, this)
this._monkey = monkey;
this._keyResCounter++;
monkey.addEventListener(egret.Event.COMPLETE, this.checkKeyResource, this);
this._guideView = new Guide(this.getLayer(LayerTypes.guide));
this._guideCtrl = new GuideCtrl(this);
this._keyResCounter++;
this._guideCtrl.addEventListener(egret.Event.COMPLETE, this.checkKeyResource, this);
this._guideCtrl.start();
if (__debug__) {
this._debug = new debug(this.getLayer(LayerTypes.top));
}
}
canInteract() {
this.getLayer(LayerTypes.bg).touchEnabled = true;
const t = Date.now() - __t0__; console.log(`可交互时间:${t / 1000}s`);
}
checkKeyResource() {
this._keyResCounter--;
if (this._keyResCounter != 0) return;
const t = Date.now() - __t0__; console.log(`关键元素完全时间:${t / 1000}s`);
this._guideCtrl.enableInteract();
this._kids = new Kids();
this.getLayer(LayerTypes.kids).addChild(this._kids);
this.getLayer(LayerTypes.river).addChild(new River());
const net = new Net();
this.getLayer(LayerTypes.net).addChild(net);
this._net = net;
}
ruleBtn: eui.Button;
optionBtn: eui.Button;
recordBtn: eui.Button;
startBtn: eui.Button;
addTouchEvent() {
this.getLayer(LayerTypes.bg).addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
}
countTxt: eui.Label;
exemptionTxt: eui.Label;
removeTouchEvent() {
this.getLayer(LayerTypes.bg).removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
async start(data?) {
this.updateGetInfoView();
this.updateExemptionTxt();
}
private _catchedBox: Box;
private _cathchedBoxOpenState: BoxOpenState;
onTouch() {
if (!this.checkCanDoAtion()) return;
this.doAction();
private updateGetInfoView() {
if (DataManager.ins.getInfoData) {
this.updateStartBtnStatus();
this.updateCountTxt();
} else {
DataManager.ins.once('dataUpdate', this.updateGetInfoView, this);
}
}
_isBoxFlying: boolean;
doAction() {
this._net && this._net.doAction();
if (this._kids) this._kids.doAction();
const catchedBoxs = this._boxListCtrl.boxs.filter(
box => Math.abs(box.y - Box.MIDDLE_Y) < StartScene.NET_RANGE);
const catchedBox = catchedBoxs[0];
if (catchedBox) { //抓住了,box没有办法再过线消失
this._boxListCtrl.pause();
//先从boxlist中移除,使之不再受到boxlistCtrl的控制
this._boxListCtrl.removeBoxFromList(catchedBox);
this._catchedBox = catchedBox;
catchedBox.doThrow();
this._isBoxFlying = true;
this.addThrowTick();
} else {//没有抓住,不需要处理,如果过网了就会自动消失。如果没有过网,下次还能抓。
this.checkmode1();
}
updateStartBtnStatus() {
if (!this.startBtn) return;
this.startBtn.visible = true;
this.startBtn.enabled = getStartBtnEnable();
egret.Tween.get(this.startBtn).set({ horizontalCenter: 750 }).to({ horizontalCenter: 0 }, 400, egret.Ease.elasticOut);
}
private _mode1DostartTag = true;
private checkmode1() {
if (__mode__ == 1) { //发一个空的
this._mode1DostartTag = false;
submitAfterDostart(() => {
NetManager.ins.getInfo(() => { this._mode1DostartTag = true; console.log('小孩儿休息完毕.') });
}, __award_thanks_score__);
}
updateCountTxt() {
if (!this.countTxt) return;
this.countTxt.visible = true;
this.countTxt.text = getCountTxt();
egret.Tween.get(this.countTxt).set({ horizontalCenter: 750 }).wait(400).to({ horizontalCenter: 0 }, 300, egret.Ease.backOut);
}
openBox() {
submitAfterDostart(() => {
this._cathchedBoxOpenState.destroy();
this._cathchedBoxOpenState = null;
this._isBoxFlying = false;
let panel: Panel;
if (DataManager.ins.gameGetSubmitResultData.lottery) {
panel = PanelCtrl.instance.show(ModuleTypes.PRIZE_PANEL)
updateExemptionTxt() {
if (this.exemptionTxt) {
if (getIsIOS()) {
this.exemptionTxt.visible = true;
} else {
panel = showAlertPanel('手气不佳 \n 再试一次吧~');
this.exemptionTxt.visible = false;
}
panel.once('onDestroy', this.onPanelDestroy, this);
NetManager.ins.getInfo(() => { this._mode1DostartTag = true; console.log('小孩儿休息完毕.') });
}, this._cathchedBoxOpenState.boxData.award);
}
onPanelDestroy() {
this.boxListCtrl.resume();
this._monkey.startShaking();
}
checkCanDoAtion() {
if (!DataManager.ins.getInfoData) {
console.log('getinfo接口没有返回');
return false;
}
if (this._isBoxFlying) {
console.log('box还在飞呢');
return false;
}
if (!this._mode1DostartTag && __mode__ == 1) {
console.log('mode1,submitAfterDostart没有执行完成');
return false;
}
if (DataManager.ins.getInfoData.status.code == 2) {//积分不足
showAlertPanel('积分不足 \n 多赚点积分再来吧');
return false;
}
if (DataManager.ins.getInfoData.status.code == 3) {//参与次数用完
showAlertPanel('参与次数用完 \n 请明天再来吧');
return false;
}
return true;
}
addThrowTick() {
this.addEventListener(egret.Event.ENTER_FRAME, this.onThrowTick, this);
}
removeThrowTick() {
this.removeEventListener(egret.Event.ENTER_FRAME, this.onThrowTick, this);
}
onThrowTick() {
this._catchedBox.onThrowTick();
const disX = Math.abs(this._catchedBox.x - this._handX);
const disY = Math.abs(this._catchedBox.y - this._handY);
const dis = 100 + __monkeyHandSize__;
if (disX < dis && disY < dis) {
this.onCatchedByMonkey();
} else if (this._catchedBox.vy > 0) {
this.onNotCatchedByMonkey();
}
}
private _catchedBoxByMoneky: Box;
onCatchedByMonkey() {
this.removeThrowTick();
this._catchedBoxByMoneky = this._catchedBox;
this._catchedBox = null;
this.checkmode1();
this._isBoxFlying = false;
egret.Tween.get(this._catchedBoxByMoneky)
.to({ scaleX: 1, scaleY: 1 }, 500)
.wait(500)
.to({ alpha: 0 }, 500).call(() => {
this._catchedBoxByMoneky.destroy();
this._catchedBoxByMoneky = null;
this.boxListCtrl.resume();
}, this);
}
onNotCatchedByMonkey() {
this.removeThrowTick();
this._cathchedBoxOpenState = new BoxOpenState(this._catchedBox.type);
this._cathchedBoxOpenState.x = this._catchedBox.x;
this._cathchedBoxOpenState.y = this._catchedBox.y;
this.topLay.addChild(this._cathchedBoxOpenState);
egret.Tween.get(this._catchedBox).to({ alpha: 0 }, 500);
this._catchedBox = null;
this._cathchedBoxOpenState.start();
this.openBox();
}
private _handX: number;
private _handY: number;
onPointUpdate(e: egret.Event) {
const p = e.data as egret.Point;
this._handX = p.x + this._monkey.x;
this._handY = p.y + this._monkey.y;
if (this._catchedBoxByMoneky) {
this._catchedBoxByMoneky.x = this._handX;
this._catchedBoxByMoneky.y = this._handY;
}
if (this._debug) {
this._debug.shape.x = this._handX;
this._debug.shape.y = this._handY;
}
}
async getBg() {
const url = __bgUrl__
return new Promise((resolve) => {
RES.getResByUrl(url, (picData) => {
resolve(picData)
}, this, RES.ResourceItem.TYPE_IMAGE);
});
}
initUI() {
const uiLayer = this.getLayer(LayerTypes.ui);
uiLayer.addChild(this['ruleBtn']);
uiLayer.addChild(this['optionBtn']);
this['ruleBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this['optionBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_optionBtn, this);
uiLayer.addChild(new Tips());
uiLayer.addChild(new DeclareTextTips());
uiLayer.visible = false;
initEvents() {
this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.optionBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_optionBtn, this);
this.recordBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_recordBtn, this);
this.startBtn.once(egret.TouchEvent.TOUCH_TAP, this.onTap_startBtn, this);
}
onTap_ruleBtn(e: egret.Event) {
......@@ -274,26 +70,13 @@ export default class StartScene extends Scene {
PanelCtrl.instance.show(ModuleTypes.OPTIONS_PANEL);
}
protected get layerKeys() {
return [
LayerTypes.bg,
LayerTypes.river,
LayerTypes.guide,
LayerTypes.kids,
LayerTypes.net,
LayerTypes.ui,
LayerTypes.box,
LayerTypes.monkey,
LayerTypes.top,
]
onTap_recordBtn(e: egret.Event) {
}
onTap_startBtn(e: egret.Event) {
doStart();
SceneCtrl.instance.change(ModuleTypes.PALY_SCENE);
}
ruleBtn: eui.Button;
optionBtn: eui.Button;
protected get skinKey() { return 'Start' }
get guideView() { return this._guideView }
get monkey() { return this._monkey }
get boxListCtrl() { return this._boxListCtrl }
get net() { return this._net }
get topLay() { return this.getLayer(LayerTypes.top) }
}
\ No newline at end of file
enum LayerTypes {
bg, kids, box, net, monkey, guide, top,ui,river
}
export default LayerTypes
\ No newline at end of file
export const getBoxKeyList = () => {
const list = [];
for (const key in __boxmap__) {
if (__boxmap__.hasOwnProperty(key)) {
list.push(key);
}
}
const str = 'goldenbox';
const index = list.indexOf(str);
if(index !=-1)
list.splice(index,1);
list.unshift(str);
return list;
}
\ No newline at end of file
import Box from "./Box";
import StartScene from "./StartScene";
export default class debug {
parent;
shape: egret.Shape;
constructor(parent: egret.Sprite) {
this.parent = parent;
const top = this.parent;
this.shape = new egret.Shape();
top.addChild(this.shape);
this.shape.graphics.beginFill(0xff0000);
// const size = __monkeyHandSize__;
// this.shape.graphics.drawRect(0, 0, 2, 2);
this.shape.graphics.drawCircle(0,0,4);
this.shape.graphics.endFill();
const shape1 = new egret.Shape();
shape1.graphics.beginFill(0xff0000);
shape1.graphics.drawRect(0, 0, 999, 1);
shape1.graphics.endFill();
shape1.y = Box.MIDDLE_Y;
top.addChild(shape1);
const shape2 = new egret.Shape();
shape2.graphics.beginFill(0xff0000);
shape2.graphics.drawRect(0, 0, 999, 1);
shape2.graphics.endFill();
shape2.y = Box.MIDDLE_Y - StartScene.NET_RANGE;
top.addChild(shape2);
const shape3 = new egret.Shape();
shape3.graphics.beginFill(0xff0000);
shape3.graphics.drawRect(0, 0, 999, 1);
shape3.graphics.endFill();
shape3.y = Box.MIDDLE_Y + StartScene.NET_RANGE;
top.addChild(shape3);
}
}
\ No newline at end of file
export default class BoxOpenState extends egret.Bitmap {
_type: string;
onReady: () => void;
constructor(type) {
super();
this._type = type;
}
start(): any {
RES.getResByUrl(__boxOpenState__, (sheet: egret.SpriteSheet) => {
const texture = sheet.getTexture(`${this._type}OpenState`);
this.$setBitmapData(texture);
this.anchorOffsetX = texture.textureWidth >> 1;
this.anchorOffsetY = texture.textureHeight >> 1;
this.scaleX = this.scaleY = 1.5;
egret.Tween.get(this)
.set({ alpha: 0 })
.to({ alpha: 1 }, 200)
.call(() => {
// this.onReady();
this.shake();
})
}, this, RES.ResourceItem.TYPE_SHEET);
}
get boxData() { return __boxmap__[this._type] }
destroy() {
egret.Tween.removeTweens(this);
egret.Tween.get(this).to({alpha:0},500).call(()=>{
this.parent.removeChild(this);
});
}
shake(): any {
const x0 = this.x;
const y0 = this.y;
const offset = 10;
egret.Tween.get(this, { loop: true })
.set({ y: y0 - offset, x: x0 }).wait(30)
.set({ y: y0, x: x0 + offset }).wait(30)
.set({ y: y0 + offset, x: x0 }).wait(30)
.set({ y: y0, x: x0 - offset }).wait(30)
.set({ y: y0 - offset, x: x0 }).wait(30)
.set({ y: y0, x: x0 + offset }).wait(30)
.set({ y: y0 + offset, x: x0 }).wait(30)
.set({ y: y0, x: x0 - offset }).wait(30)
.wait(500);
}
}
\ No newline at end of file
import isIPhoneX from "../../../libs/tc/utils/isIPhoneX";
export default class DeclareTextTips extends eui.Label {
constructor() {
super();
this.width = 750;
this.textAlign = "center";
this.size = 20;
this.textColor = 0x333333;
this.text = '*兑换项与活动均与设备制造商Apple Inc.公司无关';
this.once(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
}
onAddToStage() {
this.y = this.stage.stageHeight - this.textHeight - 10;
if (isIPhoneX())
this.y -= 20;
}
}
\ No newline at end of file
export default class Kids extends egret.Sprite {
constructor() {
super();
this.y = 710;
this.createBg();
}
private boyhand: egret.Bitmap;
private girlhand: egret.Bitmap;
async createBg() {
const picData: egret.SpriteSheet = await RES.getResAsync('kids_json');
this.addPic(picData, 'kidschair', 0, 160);
this.boyhand = this.addPic(picData, 'boyhand', 90, 137);
this.girlhand = this.addPic(picData, 'girlhand', 658, 138, 79, 0);
this.addPic(picData, 'kids');
this.addAnimation(picData.getTexture('boy_eye'), 122, 109);
this.addAnimation(picData.getTexture('girl_eye'), 622, 111);
egret.Tween.get(this).set({ alpha: 0 }).to({ alpha: 1 }, 200);
}
doAction() {
const speed = 200;
if (this.boyhand) {
egret.Tween.get(this.boyhand).to({ rotation: -50 }, speed).to({ rotation: 0 }, speed);
}
if (this.girlhand) {
egret.Tween.get(this.girlhand).to({ rotation: 50 }, speed).to({ rotation: 0 }, speed);
}
}
addPic(picData: egret.SpriteSheet, key: string, x = 0, y = 0, anchorOffsetX = 0, anchorOffsetY = 0) {
const pic = new egret.Bitmap(picData.getTexture(key));
pic.anchorOffsetX = anchorOffsetX;
pic.anchorOffsetY = anchorOffsetY;
pic.x = x;
pic.y = y;
this.addChild(pic);
return pic;
}
addAnimation(texture: egret.Texture, x: number, y: number) {
const pic = new egret.Bitmap(texture);
this.addChild(pic);
pic.anchorOffsetX = texture.textureWidth >> 1;
pic.anchorOffsetY = texture.textureHeight >> 1;
pic.x = x;
pic.y = y;
egret.Tween.get(pic, { loop: true })
.to({ scaleY: 0 }, 200)
.to({ scaleY: 1 }, 200).wait(3000);
}
}
\ No newline at end of file
export default class River extends egret.Sprite {
constructor() {
super();
this.start();
}
async start() {
const t1 = await RES.getResAsync('river1_png');
const pic1 = this.addpic(t1, 434, 493);
egret.Tween.get(pic1, { loop: true }).to({ alpha: 1 }, 1000).to({ alpha: 0 }, 1000).wait(100);
const t2 = await RES.getResAsync('river2_png');
const pic2 = this.addpic(t2, 475, 450);
egret.Tween.get(pic2, { loop: true }).to({ alpha: 1 }, 200)
.to({ y: 450 + 200 }, 1500).to({ alpha: 0 }, 200).wait(100);
const t3 = await RES.getResAsync('river3_png');
const pic3 = this.addpic(t3, 353, 410);
egret.Tween.get(pic3, { loop: true }).to({ alpha: 1 }, 200)
.to({ y: 410 + 100, x: 353 - 20 }, 1500).to({ alpha: 0 }, 200).wait(100);
const t4 = await RES.getResAsync('river4_png');
const pic4 = this.addpic(t4, 496, 625);
egret.Tween.get(pic4, { loop: true }).to({ alpha: 1 }, 200)
.to({ y: 625 + 400 }, 2000).to({ alpha: 0 }, 400);
const t5 = await RES.getResAsync('river5_png');
const pic5 = this.addpic(t5, 260, 564);
egret.Tween.get(pic5, { loop: true }).to({ alpha: 1 }, 100)
.to({ y: 564 + 200, x: 260 - 40 }, 700).to({ alpha: 0 }, 100).wait(100);
const t6 = await RES.getResAsync('river6_png');
const pic6 = this.addpic(t6, 235, 845);
egret.Tween.get(pic6, { loop: true }).to({ alpha: 1 }, 1000).to({ alpha: 0 }, 1000);
const t7 = await RES.getResAsync('river7_png');
const pic7 = this.addpic(t7, 419, 845);
setTimeout(() => {
egret.Tween.get(pic7, { loop: true }).to({ alpha: 1 }, 1000).to({ alpha: 0 }, 1000);
}, 1000);
}
private addpic(texture: egret.Texture, x = 0, y = 0) {
const pic = new egret.Bitmap(texture)
this.addChild(pic);
pic.x = x;
pic.y = y;
pic.alpha = 0;
return pic;
}
}
\ No newline at end of file
import { DataManager } from "../../../libs/tw/manager/DataManager";
export default class Tips extends eui.Label {
constructor() {
super();
this.horizontalCenter = "0";
this.width = 750;
this.textAlign = "center";
this.size = 22;
this.updateText();
DataManager.ins.addEventListener('dataUpdate', this.updateText, this);
this.once(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
}
onAddToStage() {
this.y = 1142;
// if (this.stage.stageHeight > 1300)
// this.y = 1206;
// if (this.stage.stageHeight < 1206)
// this.y = this.stage.stageHeight - this.textHeight - 40;
}
updateText() {
if (!DataManager.ins.getInfoData) return;
this.text = DataManager.ins.getInfoData.status.text;
}
}
\ No newline at end of file
"1<br><br>2"
\ No newline at end of file
"1<br>2"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment