├── copy_src.cmd ├── src └── com │ └── easyegret │ ├── component │ ├── DefaultGuideWin.ts │ ├── DefaultRenderer.ts │ ├── Win.ts │ ├── effect │ │ ├── IEffect.ts │ │ ├── RollerDown.ts │ │ └── BaseEffect.ts │ ├── Template.ts │ ├── LoadingViewUI.ts │ ├── LoadingWinUI.ts │ ├── DebugWin.ts │ ├── View.ts │ └── MessageTips.ts │ ├── io │ ├── IDecoder.ts │ └── IEncoder.ts │ ├── rpg │ ├── astar │ │ ├── Link.ts │ │ ├── Node.ts │ │ ├── BinaryHeap.ts │ │ ├── AStar.ts │ │ └── Grid.ts │ ├── animate │ │ ├── IAnimate.ts │ │ ├── HitAnimate.ts │ │ ├── SequenceQueue.ts │ │ ├── ParalleQueue.ts │ │ ├── DamageAnimate.ts │ │ ├── AnimateManager.ts │ │ └── EffectAnimate.ts │ ├── display │ │ ├── Npc.ts │ │ ├── Player.ts │ │ ├── Character.ts │ │ └── Actor.ts │ ├── control │ │ ├── NpcCtrl.ts │ │ └── PlayerCtrl.ts │ ├── data │ │ ├── IActorData.ts │ │ └── ActorData.ts │ └── RpgSetting.ts │ ├── packet │ ├── DefaultHeader.ts │ ├── IHeader.ts │ ├── BaseEntity.ts │ ├── IPacketFactory.ts │ ├── Packet.ts │ ├── PacketFactory.ts │ └── DefaultPacketFactory.ts │ ├── utils │ ├── DaoUtil.ts │ ├── ObjectUtil.ts │ ├── Debug.ts │ ├── Sound.ts │ ├── UUID.ts │ ├── ParabolaUtil.ts │ └── MathUtil.ts │ ├── ui │ ├── HSlider.ts │ ├── VSlider.ts │ ├── VScrollBar.ts │ ├── HScrollBar.ts │ ├── LayoutMode.ts │ ├── VGroup.ts │ ├── ScrollPane.ts │ ├── Style.ts │ ├── HGroup.ts │ └── TitleGroup.ts │ ├── framework │ ├── msghandle │ │ ├── IHandle.ts │ │ ├── MessageControler.ts │ │ └── BaseHandle.ts │ └── ViewManager.ts │ ├── animate │ ├── AnimateTexture.ts │ └── AnimateData.ts │ ├── guide │ ├── GuideChapter.ts │ └── GuideItem.ts │ ├── report │ └── bean │ │ ├── ReportLogin.ts │ │ └── ReportShop.ts │ ├── event │ ├── MyEvent.ts │ └── EventType.ts │ └── core │ └── ObjectPool.ts └── README.md /copy_src.cmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stonelu/easyegret/HEAD/copy_src.cmd -------------------------------------------------------------------------------- /src/com/easyegret/component/DefaultGuideWin.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stonelu/easyegret/HEAD/src/com/easyegret/component/DefaultGuideWin.ts -------------------------------------------------------------------------------- /src/com/easyegret/component/DefaultRenderer.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stonelu/easyegret/HEAD/src/com/easyegret/component/DefaultRenderer.ts -------------------------------------------------------------------------------- /src/com/easyegret/io/IDecoder.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy { 5 | 6 | export interface IDecoder { 7 | decode(bytePacket:egret.ByteArray):Packet; 8 | } 9 | } -------------------------------------------------------------------------------- /src/com/easyegret/io/IEncoder.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy { 5 | 6 | export interface IEncoder { 7 | encoder(packet:Packet):egret.ByteArray; 8 | } 9 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/astar/Link.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | 6 | export class Link { 7 | public node:Node = null; 8 | public cost:number = 0; 9 | 10 | public constructor(node:Node, cost:number){ 11 | this.node = node; 12 | this.cost = cost; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/com/easyegret/packet/DefaultHeader.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy { 5 | 6 | export class DefaultHeader implements IHeader{ 7 | public static HEADER_LENGTH:number = 6;//头长度 8 | public length:number = 0;//包体长度,不包含协议头 9 | public messageId:number = 0;//协议号 10 | public code:number = 0;//校验位 11 | private token:string = null;//软件唯一标示符 12 | } 13 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/animate/IAnimate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | 6 | export interface IAnimate { 7 | onHeartBeat():void; 8 | play():void; 9 | stop():void; 10 | destroy():void; 11 | getDisplay():egret.DisplayObject; 12 | runing:boolean; 13 | completed:boolean; 14 | parent:IAnimate; 15 | afterFrame:number; 16 | delayFrame:number; 17 | frozen:boolean; 18 | } 19 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Easy Egret 2 | ========= 3 | 简单易用的egret游戏框架,让游戏制作飞起来! 4 | 5 | 1.HTML5游戏制作的框架 6 | -------------------- 7 | * 框架居于egret引擎 8 | 9 | 2.我们的目的: 10 | -------------------- 11 | * 提供一整套游戏的解决方案,包括:易用的UI,页面切换,窗口,数据,事件,协议的控制 12 | 13 | * 在UI层,我们会提供一个UI工具,方便生成UI代码 14 | 15 | * 在游戏协议层,我们提供一个协议规范和协议代码生成工具,方便生成协议代码 16 | 17 | 3.为什么UI又造轮子: 18 | -------------------- 19 | * 各种skin方式的UI我们基本不看好,貌似高级,但是对游戏制作来说,绝对是梦魇.高效率的UI才是王道. 20 | * 所以我们的这个轮子可以说简单暴力,但是效率应该最高. 21 | * 不要跟我说皮肤自适应的问题,在小游戏中可以,大点的游戏行不通.在游戏制作中,叫换皮,不会是简单的源素材x2,x3的!甚至规格,尺寸,样式,布局都会改变,因此游戏中换皮基本是全换!UI层得再来一次,未避免重复劳动,总结出来的经验就是把UI独立出来,避免带入逻辑,这样换皮的代价最小. 22 | * 打包的游戏大小也是要重点考虑的问题,因此有必要打造专属游戏的UI.所以我们又造了一遍轮子! 23 | 24 | 4.目录说明: 25 | -------------------- 26 | 27 | 28 | 5.技术问题,请移步我们的网站: 29 | -------------------- 30 | * http://www.easyegret.com 31 | 32 | 6.联系我们 33 | -------------------- 34 | * stonelu 35 | * EMAIL:stonelu@126.com 36 | * QQ:1296199532 37 | 38 | * leon 39 | * EMAIL:420766818@qq.com 40 | * QQ:420766818 -------------------------------------------------------------------------------- /src/com/easyegret/utils/DaoUtil.ts: -------------------------------------------------------------------------------- 1 | module easy { 2 | export class DaoUtil { 3 | /** 4 | * 保存一条数据 5 | * @param moduleName 模块的名称 6 | * @param key 数据的标示 7 | * @param value 要存储的数据 8 | */ 9 | public static write(moduleName:string, key:string, value:string):void { 10 | egret.localStorage.setItem(moduleName+""+key,value); 11 | } 12 | /** 13 | * 保存一条数据 14 | * @param moduleName 模块的名称 15 | * @param key 数据的标示 16 | */ 17 | public static read(moduleName:string, key:string):string { 18 | return egret.localStorage.getItem(moduleName+""+key); 19 | } 20 | /** 21 | * 删除一条数据 22 | * @param moduleName 模块的名称 23 | * @param key 数据的标示 24 | */ 25 | public static delete(moduleName:string, key:string):void { 26 | egret.localStorage.removeItem(moduleName+""+key); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/astar/Node.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | 6 | export class Node { 7 | public row:number = 0;//行 8 | public column:number = 0;//列 9 | public f:number = 0; 10 | public g:number = 0; 11 | public h:number = 0; 12 | public walkable:boolean = true; 13 | public alpha:number = 1; 14 | public data:number = 0; 15 | public parent:Node = null; 16 | public version:number = 1; 17 | public links:Array; 18 | public point:egret.Point = null; 19 | 20 | public constructor(row:number, column:number, value:number = 0){ 21 | this.row = row; 22 | this.column = column; 23 | this.data = value; 24 | if (this.data == 0) { 25 | this.walkable = false; 26 | } else { 27 | this.walkable = true; 28 | } 29 | this.point = new egret.Point(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/com/easyegret/utils/ObjectUtil.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy { 5 | 6 | export class ObjectUtil { 7 | /** 8 | * 拷贝src的属性值->target的属性中 9 | * @param src 属性值来源 10 | * @param target 即将被赋值的对象 11 | */ 12 | public static copyValueToTarget(src:any, target:any):void { 13 | console.log("src=" + egret.getQualifiedClassName(src) + ", target=" + egret.getQualifiedClassName(target)); 14 | 15 | if (src && target) { 16 | for (var key in src){ 17 | //console.log("000key=" + key + ", value=" + src[key]); 18 | if (target.hasOwnProperty(key)) { 19 | target[key] = src[key]; 20 | console.log("1111key=" + key + ", value=" + src[key]); 21 | } 22 | } 23 | } 24 | } 25 | 26 | public static functionExist(thisArg:any, functionName:string):boolean{ 27 | if (thisArg && typeof(thisArg[functionName]) == "function"){ 28 | return true; 29 | } 30 | return false; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/easyegret/component/Win.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Administrator on 2014/11/5. 3 | */ 4 | module easy{ 5 | /** 6 | * win的基本类 7 | * 所有的ui组件都应该放置在ui层中 8 | * 在win中只处理view相关的逻辑,对ui成层的组件进行操作 9 | */ 10 | export class Win extends ReceiveGroup { 11 | /** 12 | * 进入的效果 13 | */ 14 | private _outerEffect:IEffect = null; 15 | /** 16 | * win成对应的ui展现 17 | * @type {null} 18 | * @private 19 | */ 20 | public constructor() { 21 | super(); 22 | this._loadingUIClz = LoadingWinUI; 23 | } 24 | public createChildren():void { 25 | super.createChildren(); 26 | } 27 | /** 28 | * enter的过渡效果 29 | */ 30 | public enterTransition():void { 31 | super.enterTransition(); 32 | } 33 | /** 34 | * enter的过渡效果结束 35 | */ 36 | public enterTransitionComplete():void { 37 | super.enterTransitionComplete(); 38 | } 39 | /** 40 | * view进入的逻辑 41 | * 可以再次根据外部数据情况做一些逻辑处理 42 | */ 43 | public enter():void { 44 | super.enter(); 45 | } 46 | 47 | /** 48 | * view退出的逻辑 49 | * 做一些数据的销毁或者初始化,保证下次进入的时候,不会残留 50 | */ 51 | public outer():void { 52 | super.outer(); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/animate/HitAnimate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | /** 6 | * 受击动画 7 | * @author Administrator 8 | * 9 | */ 10 | export class HitAnimate extends BaseAnimate { 11 | public skillId:number = 0;//技能id 12 | public actorSrc:Actor = null;//技能起始人 13 | public actorDes:Actor = null;//技能目标 14 | public constructor(){ 15 | super(); 16 | } 17 | /** 18 | * 播放动画 19 | */ 20 | public play():void { 21 | if (this.skillId > 0 ){ 22 | this._resJsonId = "skill_json_" + this.skillId; 23 | this._resImgId = "skill_img_" + this.skillId; 24 | this.jsonData = RES.getRes(this._resJsonId); 25 | } 26 | super.play();//设置runing标志 27 | this._imgDisplay.x = this.actorDes._ctrl.gameData._screenXY.x; 28 | this._imgDisplay.y = this.actorDes._ctrl.gameData._screenXY.y; 29 | } 30 | // 31 | ///** 32 | // * 心跳,呼吸, 运动的之类要覆盖该方法,做动作 33 | // */ 34 | //public onHeartBeat():void { 35 | // super.onHeartBeat(); 36 | // //if (_effectMovieClip)trace("MovieClip width=" + _effectMovieClip.width + ", height=" + _effectMovieClip.height + ", pivotX=" + this._effectMovieClip.pivotX + ", pivotY=" + this._effectMovieClip.pivotY) 37 | // if((this.runing && this._effectMovieClip && this._effectMovieClip.parent == null) || this._effectMovieClip == null){ 38 | // this.stop(); 39 | // } 40 | //} 41 | /** 42 | * 销毁数据 43 | */ 44 | public destroy():void { 45 | super.destroy(); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/com/easyegret/component/effect/IEffect.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export interface IEffect { 29 | play():void; 30 | } 31 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/HSlider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class HSlider extends Slider{ 30 | public constructor(){ 31 | super(Style.HORIZONTAL); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/VSlider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class VSlider extends Slider{ 30 | public constructor(){ 31 | super(Style.VERTICAL); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/com/easyegret/packet/IHeader.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,Egret-Labs.org 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EGRET-LABS.ORG AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export interface IHeader { 29 | length:number; 30 | messageId:number; 31 | code:number; 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/display/Npc.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy.rpg { 28 | export class Npc extends Actor{ 29 | public constructor() { 30 | super(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/display/Player.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy.rpg { 28 | export class Player extends Actor{ 29 | public constructor() { 30 | super(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/control/NpcCtrl.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy.rpg { 28 | export class NpcCtrl extends ActorCtrl{ 29 | public constructor() { 30 | super(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/easyegret/component/effect/RollerDown.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class RollerDown extends BaseEffect{ 29 | public constructor() { 30 | super(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/easyegret/framework/msghandle/IHandle.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export interface IHandle { 29 | receivePacket(packet:Packet):void; 30 | receiveEvent(event:MyEvent):void; 31 | } 32 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/control/PlayerCtrl.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy.rpg { 28 | export class PlayerCtrl extends ActorCtrl{ 29 | public constructor() { 30 | super(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/easyegret/packet/BaseEntity.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,Egret-Labs.org 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EGRET-LABS.ORG AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class BaseEntity { 29 | public define:Array = new Array();//包体 item定义数据 30 | public destory():void { 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/VScrollBar.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class VScrollBar extends ScrollBar{ 30 | public constructor(){ 31 | super(); 32 | this.direction = Style.VERTICAL; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/HScrollBar.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class HScrollBar extends ScrollBar{ 30 | public constructor(){ 31 | super(); 32 | this.direction = Style.HORIZONTAL; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/com/easyegret/packet/IPacketFactory.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,Egret-Labs.org 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EGRET-LABS.ORG AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export interface IPacketFactory { 30 | createPacket(messageId:number, clientSide:boolean):Packet; 31 | getHeader():IHeader; 32 | getHeaderLength():number; 33 | } 34 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/astar/BinaryHeap.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | 6 | export class BinaryHeap { 7 | public a:Array = new Array(); 8 | public justMinFun:Function = function(x:any, y:any):boolean { 9 | return this.x < this.y; 10 | }; 11 | 12 | public constructor(justMinFun:Function = null){ 13 | this.a.push(-1); 14 | if (justMinFun != null) 15 | this.justMinFun = justMinFun; 16 | } 17 | 18 | public ins(value:any):void { 19 | var p:number = this.a.length; 20 | this.a[p] = value; 21 | var pp:number = p >> 1; 22 | while (p > 1 && this.justMinFun(this.a[p], this.a[pp])){ 23 | var temp:any = this.a[p]; 24 | this.a[p] = this.a[pp]; 25 | this.a[pp] = temp; 26 | p = pp; 27 | pp = p >> 1; 28 | } 29 | } 30 | 31 | public pop():any { 32 | var min:any = this.a[1]; 33 | this.a[1] = this.a[this.a.length - 1]; 34 | this.a.pop(); 35 | var p:number = 1; 36 | var l:number = this.a.length; 37 | var sp1:number = p << 1; 38 | var sp2:number = sp1 + 1; 39 | while (sp1 < l){ 40 | if (sp2 < l){ 41 | var minp:number = this.justMinFun(this.a[sp2], this.a[sp1]) ? sp2 : sp1; 42 | } else { 43 | minp = sp1; 44 | } 45 | if (this.justMinFun(this.a[minp], this.a[p])){ 46 | var temp:any = this.a[p]; 47 | this.a[p] = this.a[minp]; 48 | this.a[minp] = temp; 49 | p = minp; 50 | sp1 = p << 1; 51 | sp2 = sp1 + 1; 52 | } else { 53 | break; 54 | } 55 | } 56 | return min; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/data/IActorData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy.rpg { 28 | export interface IActorData { 29 | id:number;//角色id 30 | name:string;//名称 31 | hp:number;//角色血量 32 | speed:number;//行走速度 33 | direciton:Array;//方向 34 | wing:number;//翅膀编号 (使用的时候会后缀自动加方向编号,格式::{编号}_{方向}, 例如:3000_1) 35 | mount:number;//坐骑编号 (使用的时候会后缀自动加方向编号,格式::{编号}_{方向}, 例如:4000_1) 36 | type:string;//数据类型 37 | } 38 | } -------------------------------------------------------------------------------- /src/com/easyegret/component/Template.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy{ 28 | /** 29 | * view和win的基本类 30 | * 定义了接收协议packet和event的能力,方便在已经展示的时候,通过packet和event的事件进行驱动刷新显示 31 | */ 32 | export class Template extends ReceiveGroup { 33 | public constructor() { 34 | super(); 35 | } 36 | /** 37 | * outer的过渡效果 38 | */ 39 | public outerTransition():void { 40 | //super.outerTransition();//调用父类的话,就会被移除 41 | //TODO 可以覆盖这里,写自己想要的out效果 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/com/easyegret/animate/AnimateTexture.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | /** 29 | * 动画元数据 30 | */ 31 | export class AnimateTexture { 32 | public id:string = null;//名称 33 | public frame:number = 0;//播放时长 34 | public width:number = 0;//材质宽 35 | public height:number = 0;//材质高 36 | public x:number = 0;//x值 37 | public y:number = 0;//y值 38 | public offsetX:number = 0;//offset x值 39 | public offsetY:number = 0;//offset y值 40 | public texutre:egret.Texture = null;//材质 41 | public constructor() { 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/com/easyegret/guide/GuideChapter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class GuideChapter { 30 | //ID 31 | public id:string = null; 32 | //名称 33 | public name:string = null; 34 | //类型 35 | public type:string = null; 36 | public constructor(){ 37 | } 38 | /** 39 | * 转义特殊的字符 40 | */ 41 | public escapeChars():void { 42 | //name 43 | this.name = StringUtil.replace(this.name, "{~D!}", ","); 44 | this.name = StringUtil.replace(this.name, "{~N!}", "\n"); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/com/easyegret/component/LoadingViewUI.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,Egret-Labs.org 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class LoadingViewUI extends LoadingBaseUI { 29 | public constructor() { 30 | super(); 31 | } 32 | /** 33 | * 根据waitview的ui数据,进行下载控制 34 | */ 35 | public enter():void { 36 | this._currentDisplayObject = ViewManager._waitChangeView; 37 | super.enter(); 38 | } 39 | /** 40 | * 完成下载,回调加载view 41 | */ 42 | public outer():void { 43 | super.outer(); 44 | //console.log("@@LoadingViewUI outer") 45 | ViewManager.waitViewDoEnter(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/com/easyegret/component/LoadingWinUI.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,Egret-Labs.org 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class LoadingWinUI extends LoadingBaseUI { 29 | 30 | public constructor() { 31 | super(); 32 | } 33 | /** 34 | * 根据waitview的ui数据,进行下载控制 35 | */ 36 | public enter():void { 37 | this._currentDisplayObject = PopupManager.waitShowWin; 38 | super.enter(); 39 | } 40 | /** 41 | * 完成下载,回调加载win 42 | */ 43 | public outer():void { 44 | super.outer(); 45 | PopupManager.waitWinDoEnter(); 46 | //console.log("@@LoadingWinUI outer") 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/com/easyegret/utils/Debug.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | /** 29 | * logger日志记录 30 | * 主要是输出到debugwin窗口中,一边debug信息查看 31 | */ 32 | export class Debug { 33 | /** 34 | * log日志记录 35 | */ 36 | private static _log:string = ""; 37 | 38 | public static callbackFunc:Function = null; 39 | 40 | public static set log(str:string) { 41 | if (GlobalSetting.DEV_MODEL) { 42 | console.log(str); 43 | this._log += str + "\n"; 44 | if (this.callbackFunc) this.callbackFunc.call(null); 45 | } 46 | } 47 | 48 | public static get log():string { 49 | return this._log; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/LayoutMode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class LayoutMode{ 30 | /** 31 | * Identifier for the layout renderer's default mode. 32 | * 33 | */ 34 | public static NONE:string = "none"; 35 | 36 | /** 37 | * Identifier for the layout renderer's vertical mode. 38 | * 39 | */ 40 | public static VERTICAL:string = "vertical"; 41 | 42 | /** 43 | * Identifier for the layout renderer's horizontal mode. 44 | * 45 | */ 46 | public static HORIZONTAL:string = "horizontal"; 47 | 48 | /** 49 | * Identifier for the layout renderer's tile mode. 50 | * 51 | */ 52 | public static TILE:string = "TILE"; 53 | } 54 | } -------------------------------------------------------------------------------- /src/com/easyegret/report/bean/ReportLogin.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class ReportLogin { 29 | public id:number = 0;//编号 30 | public name:string = ""; //名称 31 | public type:string = ""; //类型 32 | public isNew:boolean = false;//新玩家 33 | public constructor() { 34 | } 35 | /** 36 | * 生成统计的form数据 37 | * @param obj 38 | */ 39 | public getReportData():any { 40 | var obj:any = {}; 41 | obj.uid = this.id; //商店编号 42 | obj.un = this.name; //付费点 43 | obj.tp = this.type;//类型 44 | obj.nw = this.isNew;//新玩家 45 | for (var key in this){ 46 | if (key != "id" && key != "name" && key != "type" && key != "getReportData" && key != "__class__") { 47 | obj[key] = this[key]; 48 | } 49 | } 50 | return obj; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/animate/SequenceQueue.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | /** 6 | *

串行效果

7 | * @date :Jun 18, 2012 8 | * @author:jinyi.lu 9 | */ 10 | export class SequenceQueue extends easy.rpg.BaseAnimate { 11 | private animateList:Array = new Array();//串行动画的列表 12 | public constructor(){ 13 | super(); 14 | } 15 | /** 16 | * 心跳,呼吸, 运动的之类要覆盖该方法,做动作 17 | */ 18 | public onHeartBeat():void { 19 | if (this.runing) { 20 | if (this.animateList.length > 0) { 21 | if (this.animateList[0].completed && this.animateList[i].afterFrame <= 0){ 22 | this.removeAnimate(this.animateList[0]); 23 | } 24 | if (this.animateList.length > 0) { 25 | if (!this.animateList[0].runing && this.animateList[0].delayFrame <= 0)this.animateList[0].play(); 26 | for (var i = 0; i < this.animateList.length; i++) { 27 | if(this.animateList[i].runing) this.animateList[i].onHeartBeat(); 28 | } 29 | } 30 | } 31 | if (this.animateList.length == 0 )this.stop(); 32 | } 33 | } 34 | /** 35 | * 添加一个串行动画 36 | */ 37 | public addAnimate(animate:IAnimate):void { 38 | animate.parent = this; 39 | this.animateList.push(animate); 40 | } 41 | /** 42 | * 删除一个串行动画 43 | */ 44 | public removeAnimate(animate:IAnimate):void { 45 | for (var i = 0; i < this.animateList.length; i++) { 46 | if (this.animateList[i] == animate) { 47 | this.animateList[i].destroy(); 48 | this.animateList.splice(i, 1); 49 | break; 50 | } 51 | } 52 | } 53 | /** 54 | * 销毁数据 55 | */ 56 | public destroy():void{ 57 | super.destroy(); 58 | for (var i = 0; i < this.animateList.length; i++) { 59 | this.animateList[i].destroy(); 60 | } 61 | this.animateList.length = 0; 62 | } 63 | 64 | public set frozen(value:boolean){ 65 | super.frozen = value; 66 | for (var i:number = 0; i < this.animateList.length; i++) { 67 | this.animateList[i].frozen = value; 68 | } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/data/ActorData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy.rpg { 28 | export class ActorData implements IActorData{ 29 | public id:number = 0;//角色id 30 | public name:string = null;//名称 31 | public hp:number = 0;//角色血量 32 | public speed:number = 20;//行走速度 33 | public direciton:Array = [];//技能标号组 34 | public wing:number = 0;//翅膀编号 (使用的时候会后缀自动加方向编号,格式::{编号}_{方向}, 例如:3000_1) 35 | public mount:number = 0;//坐骑编号 (使用的时候会后缀自动加方向编号,格式::{编号}_{方向}, 例如:4000_1) 36 | 37 | public type:string = "npc"; 38 | public constructor() { 39 | } 40 | 41 | /** 42 | * 通过json数据赋值 43 | * 请保证json属性和类属性一致 44 | * @param json 45 | */ 46 | public setJsonData(json:any):void { 47 | for (var key in json){ 48 | console.log("Actor set key=" + key + ", value=" + json[key]); 49 | if (this.hasOwnProperty(key)) this[key] = json[key]; 50 | } 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/com/easyegret/packet/Packet.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,Egret-Labs.org 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EGRET-LABS.ORG AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class Packet{ 30 | public header:IHeader = null;//包头 31 | public define:Array = new Array();//包体 item定义数据 32 | 33 | public clientSide:boolean = true;//cleint 端协议 34 | public constructor(messageId:number = 0) { 35 | this.header = new PacketFactory.headerClz(); 36 | this.header.messageId = messageId; 37 | } 38 | /** 39 | * 内容成功与否标识 40 | * @return true,对应请求成功;false,对应请求失败 41 | * 42 | */ 43 | public get isSuccess():boolean{ 44 | return this.header.code == 0?true:false; 45 | } 46 | public send():void { 47 | if (this.clientSide){ 48 | MySocket.getInstance().send(this); 49 | } else { 50 | EventManager.dispactchPacket(this); 51 | } 52 | } 53 | 54 | public destory():void { 55 | this.header.code = 0; 56 | this.header.length = 0; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /src/com/easyegret/utils/Sound.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class Sound { 29 | private static _soundLoop:any = {};//循环播放的文件 30 | /** 31 | * 播放声音 32 | * @returns {string} 33 | */ 34 | public static play(name:string, loop:boolean = false):void { 35 | //console.log("sound.play=" + name + ", valume.open=" + GlobalSetting.VOLUME_OPEN) 36 | var sound:egret.Sound = RES.getRes(name); 37 | if(GlobalSetting.VOLUME_OPEN && sound) { 38 | if (loop){ 39 | Sound._soundLoop[name] = sound; 40 | } 41 | sound.play(loop); 42 | } 43 | } 44 | 45 | /** 46 | * 停止声音,对循环播放的声音有效 47 | * @param name 48 | */ 49 | public static stop(name:string):void { 50 | var sound:egret.Sound = Sound._soundLoop[name]; 51 | if (sound) { 52 | sound.pause(); 53 | Sound._soundLoop[name] = null; 54 | delete Sound._soundLoop[name]; 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/animate/ParalleQueue.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | 6 | /** 7 | *

并行效果

8 | * @date :Jun 18, 2012 9 | * @author:jinyi.lu 10 | */ 11 | export class ParalleQueue extends easy.rpg.BaseAnimate { 12 | private animateList:Array = new Array();//并行动画的列表 13 | 14 | public constructor(){ 15 | super(); 16 | } 17 | /** 18 | * 心跳,呼吸, 运动的之类要覆盖该方法,做动作 19 | */ 20 | public onHeartBeat():void { 21 | super.onHeartBeat(); 22 | if (this.runing){ 23 | if (this.animateList.length > 0) { 24 | for (var i = this.animateList.length - 1; i >= 0; i--) { 25 | if (this.animateList[i].completed && this.animateList[i].afterFrame <= 0) { 26 | this.removeAnimate(this.animateList[i]); 27 | } 28 | } 29 | var item:IAnimate = null; 30 | var length1:number = this.animateList.length; 31 | for (var i = 0; i < length1; i++) { 32 | item = this.animateList[i]; 33 | item.onHeartBeat(); 34 | if (!item.runing && item.delayFrame <= 0)item.play(); 35 | } 36 | } 37 | if (this.animateList.length == 0) this.stop(); 38 | } 39 | } 40 | /** 41 | * 添加一个并行动画 42 | */ 43 | public addAnimate(animate:IAnimate):void { 44 | animate.parent = this; 45 | this.animateList.push(animate); 46 | } 47 | /** 48 | * 删除一个串行动画 49 | */ 50 | public removeAnimate(animate:IAnimate):void { 51 | for (var i = 0; i < this.animateList.length; i++) { 52 | if (this.animateList[i] == animate) { 53 | this.animateList[i].stop(); 54 | this.animateList[i].destroy(); 55 | this.animateList.splice(i, 1); 56 | break; 57 | } 58 | } 59 | } 60 | /** 61 | * 销毁数据 62 | */ 63 | public destroy():void{ 64 | super.destroy(); 65 | for (var i = 0; i < this.animateList.length; i++) { 66 | this.animateList[i].destroy(); 67 | } 68 | this.animateList.length = 0; 69 | } 70 | 71 | public set frozen(value:boolean){ 72 | super.frozen = value; 73 | for (var i = 0; i < this.animateList.length; i++) { 74 | this.animateList[i].frozen = value; 75 | } 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /src/com/easyegret/component/effect/BaseEffect.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class BaseEffect implements IEffect{ 29 | public _outerTarget:ReceiveGroup = null; 30 | public _enterTarget:ReceiveGroup = null; 31 | public constructor() { 32 | super(); 33 | } 34 | 35 | /** 36 | * 准备数据,播放效果 37 | */ 38 | public play():void { 39 | this._enterTarget = ViewManager._waitChangeView; 40 | this._outerTarget = ViewManager.currentView; 41 | if (this._enterTarget == this._outerTarget)this._outerTarget = null; 42 | this.onPlayEffect(); 43 | } 44 | 45 | public onPlayEffect():void { 46 | if (this._outerTarget)this._outerTarget.outerTransition(); 47 | if (this._enterTarget)this._enterTarget.enterTransition(); 48 | } 49 | public onEffectComplete():void { 50 | if (this._outerTarget)this._outerTarget.outerTransitionComplete(); 51 | if (this._enterTarget)this._enterTarget.enterTransitionComplete(); 52 | this._outerTarget = null; 53 | this._enterTarget = null; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/display/Character.ts: -------------------------------------------------------------------------------- 1 | /** * Copyright (c) 2012 www.2ren.cn */ 2 | module ui { 3 | 4 | export class Character extends MovieDisplay { 5 | public hitRect:DisplayObjectContainer = new DisplayObjectContainer();//战斗攻击碰撞使用的矩形 6 | public displayBack:Bitmap = new Bitmap();//图像前图形容器 7 | public displayFront:Bitmap = new Bitmap();//图像后图形容器 8 | public constructor() { 9 | super(); 10 | } 11 | public initData():void { 12 | super.initData(); 13 | } 14 | /** 15 | * 初始化主场景的组件,加入场景时,主动调用一次 16 | * 子类覆写该方法,添加UI逻辑 17 | */ 18 | public createChildren():void { 19 | super.createChildren(); 20 | this.hitRect.graphics.clear(); 21 | this.hitRect.graphics.beginFill(0xeeeeee, 0); 22 | this.hitRect.graphics.drawRect(-5, -20, 10, 40); 23 | this.hitRect.graphics.endFill(); 24 | this.hitRect.width = 10; 25 | this.hitRect.height = 40; 26 | this.hitRect.y = -60; 27 | this.addChildAt(this.hitRect, 0); 28 | this.addChildAt(this.displayBack, 0); 29 | this.addChild(this.displayFront); 30 | } 31 | public get characterControl():CharacterControl { 32 | return (this.control); 33 | } 34 | 35 | public get direction():number { 36 | return this.characterControl.characterData.direction; 37 | } 38 | 39 | public set direction(value:number = 0) { 40 | this.characterControl.characterData.direction = value; 41 | } 42 | 43 | public get action():string { 44 | return this.characterControl.action; 45 | } 46 | 47 | /** 48 | * 设置状态 49 | */ 50 | public set action(value:string) { 51 | this.characterControl.action = value; 52 | } 53 | /** 54 | * 设置人物行走状态 55 | */ 56 | public setStateWalk():void { 57 | this.action = Const.PLAYER_MOV; 58 | } 59 | /** 60 | * 设置人物站立状态 61 | */ 62 | public setStateStand():void { 63 | this.action = Const.PLAYER_STD; 64 | } 65 | /** 66 | * 设置人物进入攻击状态 67 | */ 68 | public setStateAck():void { 69 | this.action = Const.PLAYER_ATK; 70 | } 71 | /** 72 | * 设置人物进入被攻击状态 73 | */ 74 | public setStateBak():void { 75 | this.action = Const.PLAYER_BAK; 76 | } 77 | 78 | /** 79 | * 对象销毁 80 | * 81 | */ 82 | public destroy():void{ 83 | super.destroy(); 84 | if(this.display != null){ 85 | this.display.bitmapData = null; 86 | this.display = null; 87 | } 88 | } 89 | 90 | public set visible(value:boolean){ 91 | super.visible = value; 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /src/com/easyegret/report/bean/ReportShop.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class ReportShop { 29 | public id:number = 0;//商店编号 30 | public orderId:string = "";//订单号,对账 31 | public name:string = ""; //付费点 32 | public rmb:number = 0; //费用 33 | public type:string = ""; //类型 34 | //结果 35 | public state:string = "";//订单状态 36 | public msg:string = "";//订单返回描述 37 | 38 | public ext1:string = "";//备用1 39 | public ext2:string = "";//备用2 40 | 41 | public constructor() { 42 | } 43 | /** 44 | * 生成统计的form数据 45 | * @param obj 46 | */ 47 | public getReportData():any { 48 | var obj:any = {}; 49 | obj.sid = this.id; //商店编号 50 | obj.un = this.name; //付费点 51 | obj.rmb = this.rmb;//人民币 52 | obj.tp = this.type;//类型 53 | 54 | obj.oid = this.orderId;//订单号 55 | obj.st = this.state;//订单状态 56 | obj.msg = this.msg;//订单返回描述 57 | obj.e1 = this.ext1;//备用1 58 | obj.e2 = this.ext2;//备用2 59 | for (var key in this){ 60 | if (key != "id" && key != "name" && key != "rmb" && key != "type" && key != "getReportData" && key != "__class__") { 61 | obj[key] = this[key]; 62 | } 63 | } 64 | return obj; 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /src/com/easyegret/utils/UUID.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class UUID { 29 | /** 30 | * 生成一个36位长度的uuid标识 31 | * @returns {string} 32 | */ 33 | public static newUUID():string { 34 | var new4Data = () => { 35 | var max:number = Math.pow(16, 4) - 1; 36 | var newNum:number = Math.floor(Math.random() * max); 37 | var newNumToStr:string = newNum.toString(16); 38 | while (newNumToStr.length < 4) { 39 | newNumToStr = "0" + newNumToStr; 40 | } 41 | return newNumToStr; 42 | }; 43 | 44 | var data1:string = new4Data() + new4Data(); 45 | var data2:string = new4Data(); 46 | var data3:string = new4Data(); 47 | var data4:string = new4Data(); 48 | var data5:string = new4Data() + new4Data() + new4Data(); 49 | 50 | return data1 + "-" + data2 + "-" + data3 + "-" + data4 + "-" + data5; 51 | } 52 | 53 | /** 54 | * 获取url中的参数值 55 | * @param name 56 | * @returns {*} 57 | */ 58 | public static getUrlByName(name:string):string { 59 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 60 | if (location) { 61 | var r = location.search.substr(1).match(reg); 62 | if (r != null) { 63 | return decodeURI(decodeURIComponent(decodeURI(r[2]))); 64 | } 65 | } 66 | return ""; 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /src/com/easyegret/utils/ParabolaUtil.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | /** 29 | * 抛物线计算公式 30 | */ 31 | export class ParabolaUtil { 32 | private static _instance:ParabolaUtil = null; 33 | 34 | private startPt:egret.Point = null; 35 | private endPt:egret.Point = null; 36 | private vertexPt:egret.Point = null; 37 | private a:number = 0 ; 38 | private b:number = 0 ; 39 | private c:number = 0 ; 40 | public getInstance() { 41 | if (ParabolaUtil._instance == null) ParabolaUtil._instance = new easy.ParabolaUtil(); 42 | return ParabolaUtil._instance; 43 | } 44 | 45 | /** 46 | * 给定两个点和定点高 47 | * @param start 开始点 48 | * @param end 结束点 49 | * @param waveHeight 定点高 50 | */ 51 | public init(start:egret.Point, end:egret.Point, waveHeight:number = 240):void { 52 | this.startPt = start; 53 | this.endPt = end; 54 | this.vertexPt = new egret.Point(this.startPt.x + (this.endPt.x - this.startPt.x) / 2, this.endPt.y - waveHeight); 55 | 56 | var x1:number = this.startPt.x; 57 | var x2:number = this.endPt.x; 58 | var x3:number = this.vertexPt.x; 59 | 60 | var y1:number = this.startPt.y; 61 | var y2:number = this.endPt.y; 62 | var y3:number = this.vertexPt.y; 63 | 64 | this.b = ((y1 - y3) * (x1 * x1 - x2 * x2) - (y1 - y2) * (x1 * x1 - x3 * x3)) / ((x1 - x3) * (x1 * x1 - x2 * x2) - (x1 - x2) * (x1 * x1 - x3 * x3)); 65 | this.a = ((y1 - y2) - this.b * (x1 - x2)) / (x1 * x1 - x2 * x2); 66 | this.c = y1 - this.a * x1 * x1 - this.b * x1; 67 | } 68 | /** 69 | * 抛物线运动(必须要先初始化abc参数) 70 | * 给x轴值,得到Y轴值 71 | */ 72 | public getY(posX:number):number { 73 | return this.a * posX * posX + this.b * posX + this.c; 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /src/com/easyegret/framework/msghandle/MessageControler.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class MessageControler { 29 | private static _handles:Array = []; 30 | private static _eventHandles:Array = []; 31 | 32 | /** 33 | * 添加数据处理的Handle 34 | * 逻辑处理模块,需要添加Handle,以便方便的在view刷新前,有限得到数据,预先处理数据 35 | * @param handle 36 | */ 37 | public static addHandle(handle:IHandle):void { 38 | if (handle != null && MessageControler._handles.indexOf(handle) < 0 )MessageControler._handles.push(handle); 39 | } 40 | 41 | /** 42 | * 添加弱事件处理 43 | * 只有注册的时间,当前的view才能收到 44 | * @param eventName 45 | */ 46 | public static addEvent(eventName:string):void { 47 | if (MessageControler._eventHandles.indexOf(eventName) < 0) MessageControler._eventHandles.push(eventName); 48 | } 49 | 50 | /** 51 | * MyEvent事件派发 52 | * @param event 53 | */ 54 | public static receiveEvent(event:MyEvent):void { 55 | //console.log("MessageControl onEventData=" + event.type) 56 | if (MessageControler._eventHandles.indexOf(event.type) >= 0){ 57 | ViewManager.receiveEvent(event); 58 | var i:number = 0; 59 | for (i = 0; i < MessageControler._handles.length; i++) { 60 | MessageControler._handles[i].receiveEvent(event); 61 | } 62 | } 63 | } 64 | 65 | /** 66 | * 协议事件派发 67 | * @param pkt 68 | */ 69 | public static receivePacket(pkt:Packet):void { 70 | //console.log("MessageHandle onPacketData=" + egret.getQualifiedClassName(pkt)); 71 | //优先处理数据的handle 72 | var i:number = 0; 73 | for (i = 0; i < MessageControler._handles.length; i++) { 74 | MessageControler._handles[i].receivePacket(pkt); 75 | } 76 | //界面刷新 77 | ViewManager.receivePacket(pkt); 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /src/com/easyegret/guide/GuideItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EGRET-LABS.ORG AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class GuideItem { 30 | //ID编号 31 | public id:string = null; 32 | //节点名称 33 | public name:string = null; 34 | //描述 35 | public desc:string = null; 36 | //节点类型 37 | public type:string = null; 38 | //章节 39 | public chapter:string = null; 40 | //目标 41 | public target:string = null; 42 | //下一帧 43 | public next_frame:string = null; 44 | //下一帧延迟 45 | public next_delay:number = 0; 46 | //对话内容 47 | public text:string = null; 48 | //点击次数 49 | public click_num:number = 0; 50 | //任意点击 51 | public click_stage:number = 1; 52 | //水平对齐 53 | public h_align:string = null; 54 | //水平偏移量 55 | public h_pos:number = 0; 56 | //竖直对齐 57 | public v_align:string = null; 58 | //竖直偏移量 59 | public v_pos:number = 0; 60 | //肖像id 61 | public icon:string = null; 62 | //icon偏移x 63 | public oxIcon:number = 0; 64 | //icon偏移y 65 | public oyIcon:number = 0; 66 | //肖像k=v数据 67 | public data:string = null; 68 | //显示名称 69 | public nick:string = null; 70 | //头像镜像 71 | public mirror:number = 0; 72 | //显示方式 73 | public txt_model:string = null; 74 | //显示速度 75 | public txt_frame:number = 0; 76 | //遮罩方式 77 | public mask:string = null; 78 | //选项 79 | public opts:string = null; 80 | public constructor(){ 81 | } 82 | 83 | /** 84 | * 转义特殊的字符 85 | */ 86 | public escapeChars():void { 87 | //name 88 | this.name = StringUtil.replace(this.name, "{~D!}", ","); 89 | this.name = StringUtil.replace(this.name, "{~N!}", "\n"); 90 | //nick 91 | this.nick = StringUtil.replace(this.nick, "{~D!}", ","); 92 | this.nick = StringUtil.replace(this.nick, "{~N!}", "\n"); 93 | //text 94 | this.text = StringUtil.replace(this.text, "{~D!}", ","); 95 | this.text = StringUtil.replace(this.text, "{~N!}", "\n"); 96 | } 97 | } 98 | } -------------------------------------------------------------------------------- /src/com/easyegret/packet/PacketFactory.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,Egret-Labs.org 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EGRET-LABS.ORG AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class PacketFactory { 30 | public static TYPE_BOOLEAN:string = "boolean";//CHAR 1 单字节字符 31 | public static TYPE_NUMBER:string = "number";//数字 32 | public static TYPE_STRING:string = "string";//String 字符串 33 | public static TYPE_ARRAY:string = "array";//ARRAY 变长 某种数据结构的数组 34 | public static TYPE_ARRAY_CONST:string = "array_const";//ARRAY 定长 某种数据结构的数组 35 | public static TYPE_BYTEARRAY:string = "bytearray"; 36 | public static TYPE_ENTITY:string = "entity";//实体类 37 | 38 | public static CHARSET: string = PacketFactory.CHARSET_UNICODE; 39 | public static CHARSET_ASCII : string = "ASCII"; 40 | public static CHARSET_UNICODE : string = "Unicode"; 41 | public static MATH_POW_2_32:number = 4294967296;// 2^32. 42 | 43 | public static headerClz:any = DefaultHeader;//协议头的;类名 44 | 45 | private static _factory:IPacketFactory = null; 46 | 47 | /** 48 | * 初始化协议工厂 49 | * @param factory 50 | */ 51 | public static initFactory(factory:IPacketFactory):void { 52 | PacketFactory._factory = factory; 53 | } 54 | public static createPacket(messageId:number, clientSide:boolean = true):Packet{ 55 | if (PacketFactory._factory) { 56 | return PacketFactory._factory.createPacket(messageId, clientSide); 57 | } else { 58 | Debug.log = "@@ ---error!! packet factory not init!!--"; 59 | return null; 60 | } 61 | } 62 | public static getHeader():IHeader { 63 | if (PacketFactory._factory) { 64 | return PacketFactory._factory.getHeader(); 65 | } else { 66 | Debug.log = "@@ ---error!! packet factory not init!!--"; 67 | return null; 68 | } 69 | } 70 | public static getHeaderLength():number { 71 | if (PacketFactory._factory) { 72 | return PacketFactory._factory.getHeaderLength(); 73 | } else { 74 | Debug.log = "@@ ---error!! packet factory not init!!--"; 75 | return 0; 76 | } 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/VGroup.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class VGroup extends Group{ 30 | public _verticalGap:number = 2; 31 | public constructor(){ 32 | super(); 33 | this.layout = LayoutMode.VERTICAL; 34 | } 35 | /** 36 | * 设置或获取参与布局元素间垂直像素间隔 37 | */ 38 | public get verticalGap():number{ 39 | return this._verticalGap; 40 | } 41 | 42 | public set verticalGap(value:number){ 43 | if(this._verticalGap != value){ 44 | this._verticalGap = value; 45 | this.invalidate(); 46 | } 47 | } 48 | public _verticalAlign:string = egret.VerticalAlign.TOP; 49 | /** 50 | * 垂直方向布局方式 51 | */ 52 | public get verticalAlign():string{ 53 | return this._verticalAlign; 54 | } 55 | 56 | public set verticalAlign(value:string){ 57 | if(this._verticalAlign != value){ 58 | this._verticalAlign = value; 59 | this.invalidate(); 60 | } 61 | } 62 | /** 63 | * 更新容器垂直布局 64 | */ 65 | public updateVerticalLayout():void{ 66 | //var i:number = 0; 67 | //var child:egret.DisplayObject = null; 68 | //var childLast:egret.DisplayObject = null; 69 | //var hElements:number = 0; 70 | // 71 | //for(i = 0; i < this.numChildren; i++){ 72 | // hElements += this.getChildAt(i).height; 73 | //} 74 | //hElements += (this.numChildren - 1) * this._verticalGap; 75 | //for(i = 0; i < this.numChildren; i++){ 76 | // child = this.getChildAt(i); 77 | // if(i == 0){ 78 | // if(this._verticalAlign == egret.VerticalAlign.TOP){ 79 | // child.y = 0; 80 | // }else if(this._verticalAlign == egret.VerticalAlign.BOTTOM){ 81 | // child.y = this._height - hElements; 82 | // }else if(this._verticalAlign == egret.VerticalAlign.MIDDLE){ 83 | // child.y = (this._height - hElements)/2; 84 | // } 85 | // }else { 86 | // childLast = this.getChildAt(i - 1); 87 | // child.y = childLast.y + childLast.height + this._verticalGap; 88 | // } 89 | // if(this._horizontalAlign == egret.HorizontalAlign.LEFT){ 90 | // child.x = 0; 91 | // }else if(this._horizontalAlign == egret.HorizontalAlign.CENTER){ 92 | // child.x = (this._width - child.width)/2; 93 | // }else if(this._horizontalAlign == egret.HorizontalAlign.RIGHT){ 94 | // child.x = this._width - child.width; 95 | // } 96 | //} 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /src/com/easyegret/framework/msghandle/BaseHandle.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | /** 29 | * 数据集中处理 30 | */ 31 | export class BaseHandle implements IHandle{ 32 | public METHOD_DEF:Object = {};//消息和方法的映射关系表 33 | public EVENT_DEF:Array = []; 34 | public constructor() { 35 | this.initWeekListener(); 36 | } 37 | 38 | /** 39 | * 初始化弱监听 40 | * 子类可以覆写这个,添加数据 41 | */ 42 | public initWeekListener():void { 43 | 44 | } 45 | 46 | /** 47 | * 添加事件的处理 48 | * 如果没有对应的的类型在此出现,则改Handle对Event事件到此为止,不再派发,防止造成事件死循环 49 | * @param type MyEvent事件的类型 50 | */ 51 | public addHandleEvent(type:string, funcName:string):void { 52 | if (this.EVENT_DEF.indexOf(type) < 0) { 53 | this.EVENT_DEF.push(type); 54 | this.METHOD_DEF[type] = funcName; 55 | } 56 | } 57 | 58 | /** 59 | * 添加协议处理的Handle,注意,functName的名称,前缀onPacket不包含 60 | * @param msgId packet协议号 61 | * @param func 对应的call back function,不包含onPacket前缀 62 | */ 63 | public addHandlePacket(msgId:number, funcName:string):void { 64 | this.METHOD_DEF[""+msgId] = funcName; 65 | //console.log("BaseHandle ADD METHOD_DEF=" + msgId + ", funcName=" + funcName); 66 | } 67 | 68 | /** 69 | * 接收到服务器的控制信号 70 | * call function的时候,会自动前缀onPacket 71 | * @param packet 72 | */ 73 | public receivePacket(packet:Packet):void { 74 | //console.log("BaseHandle onPacketData=" + egret.getQualifiedClassName(this) + ", has=" + this.METHOD_DEF.hasOwnProperty("" + packet.header.messageId)); 75 | if (this.METHOD_DEF.hasOwnProperty("" + packet.header.messageId))this["onPacket" + this.METHOD_DEF["" + packet.header.messageId]].call(this, packet); 76 | } 77 | 78 | /** 79 | * 事件派发 80 | * call function的时候,会自动前缀onEvent 81 | * @param event 82 | */ 83 | public receiveEvent(event:MyEvent):void { 84 | if (this.EVENT_DEF.indexOf(event.type) >= 0) { 85 | if (this.METHOD_DEF.hasOwnProperty(event.type)) this["onEvent" + this.METHOD_DEF[event.type]].call(this, event); 86 | } 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /src/com/easyegret/event/MyEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class MyEvent { 29 | public callStack:string = null; 30 | public type:string = null; 31 | public datas:Object = {}; 32 | 33 | /** 34 | *

事件基类构造函数,包含一个参数

35 | * @param type 事件类型 36 | */ 37 | public constructor(typeValue:string) { 38 | this.type = typeValue; 39 | } 40 | 41 | /** 42 | *

添加单个对象到结果集中

43 | * @param value 要添加的对象 44 | */ 45 | 46 | public addItem(property:string, value:any):void { 47 | this.datas[property] = value; 48 | } 49 | 50 | /** 51 | * 获取property对应的内容 52 | * @param property 53 | * @returns {null} 54 | */ 55 | public getItem(property:string):any { 56 | if (this.datas.hasOwnProperty(property)){ 57 | return this.datas[property]; 58 | } 59 | return null; 60 | } 61 | 62 | /** 63 | * 查询是否携带了proprty名称的数据 64 | * @param property 65 | * @returns {boolean} 66 | */ 67 | public hasItem(property:string):any { 68 | return this.datas.hasOwnProperty(property); 69 | } 70 | 71 | /** 72 | * 回收对象到对象池中 73 | */ 74 | public destory():void { 75 | this.callStack = null; 76 | for (var item in this.datas) { 77 | delete this.datas[item]; 78 | } 79 | } 80 | 81 | /** 82 | * 删除property名称的数据 83 | * @param proprty 84 | */ 85 | public removeItem(property:string):boolean { 86 | if (this.datas.hasOwnProperty(property)){ 87 | delete this.datas[property]; 88 | return true; 89 | } 90 | return false; 91 | } 92 | 93 | /** 94 | * 派发event对象 95 | */ 96 | public send():void { 97 | EventManager.dispatchEvent(this); 98 | } 99 | 100 | /** 101 | * 从对象池中获取一个type类型的event对象 102 | * @param type 103 | * @returns {MyEvent} 104 | */ 105 | public static getEvent(type:string):MyEvent { 106 | return EventManager.getEvent(type); 107 | } 108 | 109 | /** 110 | * 快捷发送一个type类型的event事件 111 | * @param type 112 | */ 113 | public static sendEvent(type:string):void { 114 | EventManager.dispatch(type); 115 | } 116 | } 117 | } -------------------------------------------------------------------------------- /src/com/easyegret/event/EventType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,Egret-Labs.org 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EGRET-LABS.ORG AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class EventType { 30 | public static SOCKET_CONNECT:string = "SOCKET_CONNECT";//socket连接完成 31 | public static SOCKET_DISCONNECT_ERROR:string = "SOCKET_DISCONNECT_ERROR";//socket异常 32 | public static SOCKET_DISCONNECT:string = "SOCKET_DISCONNECT";//socket连接断开 33 | public static SOCKET_SEND_SHOW:string = "SOCKET_SEND_SHOW";//socket发送数据显示等待框 34 | public static SOCKET_SEND_HIDE:string = "SOCKET_SEND_HIDE";//socket发送数据隐藏等待框 35 | public static SOCKET_SEND_TIMEOUT:string = "SOCKET_SEND_TIMEOUT";//socket发送超时 36 | 37 | public static STAGE_RESIZE:string = "STAGE_RESIZE";//屏幕尺寸变化 38 | public static UI_CONFIG_VOLUME:string = "UI_CONFIG_VOLUME";//声音开关 39 | public static UI_CONFIG_FULLSCREEN:string = "UI_CONFIG_FULLSCREEN";//全屏信号 40 | public static UI_LOADER_COMPLETED:string = "UI_LOADER_COMPLETED";//loader下载完成事件 41 | //动画播放事件 42 | public static MOVIEWCLIP_PLAY:string = "MOVIEWCLIP_PLAY";//动画播放事件 43 | public static MOVIEWCLIP_PLAY_END:string = "MOVIEWCLIP_PLAY_END";//动画播放事件 44 | //debug模式事件 45 | public static UI_DEBUG_OPEN:string="DEBUG_UI_OPEN"; //debug ui的开启 46 | public static UI_DEBUG_CLOSE:string="DEBUG_UI_CLOSE"; //debug ui的关闭 47 | 48 | public static VOLUME_CHANGED:string = "VOLUME_CHANGED";//音乐开关改变 49 | 50 | public static RESOURCE_DOWNLOADED:string = "RESOURCE_DOWNLOADED";//资源下载完成{id:id, group:group} 51 | public static RESOURCE_PROGRESS:string = "RESOURCE_PROGRESS";//资源下载进度通知 52 | 53 | public static GUIDE_EVENT:string="GUIDE_EVENT"; //新手导航向外通知专用 54 | public static GUIDE_FREEDBACK:string="GUIDE_FREEDBACK"; //通知新手导航管理器专用 55 | public static GUIDE_END:string="GUIDE_END"; //新手导航向结束 56 | public static GUIDE_SIMULATE:string="GUIDE_SIMULATE"; //新手导航模拟 57 | 58 | /** 59 | * 新手引导-{"type":0,可接受任务;1,可完成任务。} 60 | */ 61 | public static GUIDE_TASK_TALKING_NOTIFY:string = "GUIDE_TASK_TALKING_NOTIFY";//任务对话通知 62 | /** 63 | * 新手导航参数通知,参数为定制内容 64 | */ 65 | public static GUIDE_PARAM_NOTIFY:string = "GUIDE_PARAM_NOTIFY";//新手导航参数通知 66 | /** 67 | * 新手引导-对话面板关闭. 68 | */ 69 | public static GUIDE_WIN_CLOSE_NOTIFY:string = "GUIDE_WIN_CLOSE_NOTIFY"; 70 | public static GUIDE_TASK_CLOSE_NOTIFY:string = "GUIDE_TASK_CLOSE_NOTIFY"; 71 | /** 72 | * 停止新手引导播放 73 | */ 74 | public static GUIDE_STOP_ITEM:string = "GUIDE_STOP_ITEM"; 75 | 76 | 77 | /** 78 | * 剧情模式 {"action":value} 79 | */ 80 | public static STORY_TALKING:string = "STORY_TALKING"; 81 | /** 82 | * 剧情结束. 83 | */ 84 | public static STORY_END:string = "STORY_END"; 85 | } 86 | } -------------------------------------------------------------------------------- /src/com/easyegret/packet/DefaultPacketFactory.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,Egret-Labs.org 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EGRET-LABS.ORG AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class DefaultPacketFactory implements IPacketFactory{ 30 | public static packetDefineDic:Object = {};//packet字典 31 | public constructor(){ 32 | this.initData(); 33 | } 34 | /** 35 | * 初始化协议包定义 36 | */ 37 | public initData():void { 38 | } 39 | public initPacketDefine(packetClass:any):void { 40 | var instance:Packet = new packetClass(); 41 | EventManager.releasePacket(instance); 42 | this.setPacketDefine(instance.header.messageId, instance.clientSide, packetClass); 43 | } 44 | 45 | public setPacketDefine(messageId:number, clientSide:boolean, packetClass:any):void { 46 | DefaultPacketFactory.packetDefineDic[(clientSide?"c_":"s_") + messageId] = packetClass; 47 | } 48 | public createPacketByMessageId(messageId:number, clientSide:boolean):Packet{ 49 | var classz:any = DefaultPacketFactory.packetDefineDic[(clientSide?"c_":"s_") + messageId]; 50 | if (classz){ 51 | var packet:Packet = new classz(); 52 | Debug.log ="message->packet:" + classz; 53 | return packet; 54 | } 55 | Debug.log = "message->packet:" + "NULL"; 56 | return null; 57 | } 58 | /** 59 | * 根据协议header,取得对应的pakcet对象 60 | * @param header 协议header,根据serverid和messageId生成Packet对象 61 | * @return packet 协议packet对象 62 | */ 63 | public createPacket(messageId:number, clientSide:boolean):Packet{ 64 | Debug.log = "header->packet:" + messageId; 65 | var classz:any = DefaultPacketFactory.packetDefineDic[(clientSide?"c_":"s_") + messageId]; 66 | if (classz){ 67 | var packet:Packet = new classz(); 68 | packet.header.messageId = messageId; 69 | Debug.log = "header->packet:" + egret.getQualifiedClassName(packet); 70 | return packet; 71 | } 72 | Debug.log = "header->packet:" + "NULL"; 73 | return null; 74 | } 75 | //从packet字典中删除包定义 76 | private removePacketDefine(messageId:number, clientSize:boolean = true):void{ 77 | delete DefaultPacketFactory.packetDefineDic[messageId + "_" + (clientSize?0:1)]; 78 | } 79 | 80 | /** 81 | * 协议头 82 | * @returns {any} 83 | */ 84 | public getHeader():IHeader{ 85 | return new PacketFactory.headerClz(); 86 | } 87 | 88 | /** 89 | * 协议头长度 90 | * @returns {any} 91 | */ 92 | public getHeaderLength():number{ 93 | return PacketFactory.headerClz["HEADER_LENGTH"]; 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/animate/DamageAnimate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | /** 6 | * 战斗伤害控制 7 | * @author jinyi.lu 8 | * 9 | */ 10 | export class DamageAnimate extends BaseAnimate { 11 | 12 | public constructor(){ 13 | super(); 14 | } 15 | public hp:Array = null; 16 | public atk:Array = null; 17 | public des:Array = null; 18 | public target:string = "left";//被动接受进攻方的君主ID定义为-1,挑起战斗的玩家君主ID定义为-2 19 | public isSkill:boolean = false;//是否是技能攻击伤害,用来定位数字位置用 20 | 21 | private _damageGroupCurrY = 150;//当前的y 22 | private _damageGroupToY = -150;//移动后的y 23 | 24 | 25 | /** 26 | * 播放动画,做动画前的各项资料准备 27 | */ 28 | public play():void { 29 | super.play();//设置runing标志 30 | this.console.log("DamageAnimate play.offset=" + this.offsetFrame + ", this.des=" + this.des); 31 | //播放伤害背景动画 32 | this._effectMovieClip = this.view.ui.fightShowAreaAnimateItem.getMovieClip(this.effectId, this.target); 33 | //血槽 和攻击力槽的 变化 34 | if(this.des[0] > 0){ 35 | var battleCardData:BattleCardData = this.battleData.getCardData(this.des[0]); 36 | //血量 37 | if(this.hp && this.hp[0] != 0){ 38 | //更新场上的 39 | if(this.target == "left"){ 40 | this.view.ui.playerCardInfoLeftItem.updateHp(this.hp[0]); 41 | }else if(this.target == "right"){ 42 | this.view.ui.playerCardInfoRightItem.updateHp(this.hp[0]); 43 | } 44 | //更新左右两侧的血槽 45 | ( (battleCardData.cardItem)).updateHp(this.hp[0]); 46 | } 47 | //攻击 48 | if(this.atk && this.atk[0] != 0){ 49 | //更新场上的 50 | if(this.target == "left"){ 51 | this.view.ui.playerCardInfoLeftItem.updateAtk(this.atk[0]); 52 | }else if(this.target == "right"){ 53 | this.view.ui.playerCardInfoRightItem.updateAtk(this.atk[0]); 54 | } 55 | } 56 | }else if(this.des[0] == -2 && this.hp && this.hp[0] != 0){ 57 | //我方君主 58 | this.view.ui.playerHeadLeftItem.updateHp(this.hp[0]); 59 | }else if(this.des[0] == -1 && this.hp && this.hp[0] != 0){ 60 | //敌方 61 | this.view.ui.playerHeadRightItem.updateHp(this.hp[0]); 62 | } 63 | //播放伤害数字的上浮 64 | this.view.ui.fightShowAreaAnimateItem.setDamageValue(this.hp, this.atk, this.target, this.isSkill); 65 | this.view.ui.fightShowAreaAnimateItem.damageGroup.visible = true; 66 | this.view.ui.fightShowAreaAnimateItem.damageGroup.alpha = 1; 67 | this.view.ui.fightShowAreaAnimateItem.damageNameGroup.visible = true; 68 | this.view.ui.fightShowAreaAnimateItem.damageNameGroup.alpha = 1; 69 | if(this.isSkill){ 70 | //技能攻击上浮 71 | this.view.ui.fightShowAreaAnimateItem.damageGroup.y = this._damageGroupCurrY; 72 | TweenLite.to(this.view.ui.fightShowAreaAnimateItem.damageGroup, 0.8, {y:this._damageGroupToY, alpha:0.3, ease:Circ.easeIn}); 73 | this.view.ui.fightShowAreaAnimateItem.damageNameGroup.y = this._damageGroupCurrY; 74 | TweenLite.to(this.view.ui.fightShowAreaAnimateItem.damageNameGroup, 0.8, {y:this._damageGroupToY, alpha:0.3, delay:0.2, ease:Circ.easeIn}); 75 | }else{ 76 | //物理攻击不动 77 | this.view.ui.fightShowAreaAnimateItem.damageGroup.y = this._damageGroupCurrY; 78 | TweenLite.to(this.view.ui.fightShowAreaAnimateItem.damageGroup, 0.8, {y:this._damageGroupToY, alpha:0.3, ease:Circ.easeIn}); 79 | this.view.ui.fightShowAreaAnimateItem.damageNameGroup.y = this._damageGroupCurrY; 80 | TweenLite.to(this.view.ui.fightShowAreaAnimateItem.damageNameGroup, 0.8, {y:this._damageGroupToY, alpha:0.3, delay:0.2, ease:Circ.easeIn}); 81 | 82 | // //物理攻击不动 83 | // this.view.ui.fightShowAreaAnimateItem.damageGroup.y = _damageGroupCurrY + 120; 84 | // this.view.ui.fightShowAreaAnimateItem.damageGroup.scaleX = 1.5; 85 | // this.view.ui.fightShowAreaAnimateItem.damageGroup.scaleY = 1.5; 86 | // TweenLite.to(this.view.ui.fightShowAreaAnimateItem.damageGroup, 0.3, {scaleX:1, scaleY:1, ease:Quad.easeIn}); 87 | // TweenLite.to(this.view.ui.fightShowAreaAnimateItem, 0.6, {onComplete:playDamageComplete}); 88 | } 89 | SystemHeartBeat.addEventListener(this.playDamageComplete, 10,this, 1); 90 | } 91 | /** 92 | * 数字上浮完毕 93 | * 94 | */ 95 | private playDamageComplete(endCall:boolean = false):void { 96 | this.view.ui.fightShowAreaAnimateItem.damageGroup.visible = false; 97 | this.view.ui.fightShowAreaAnimateItem.damageNameGroup.visible = false; 98 | this.stop(); 99 | this.console.log("DamageAnimate stop this.des=" + this.des); 100 | } 101 | /** 102 | * 销毁数据 103 | */ 104 | public destroy():void { 105 | super.destroy(); 106 | this.des = null; 107 | this.hp = null; 108 | this.atk = null; 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/ScrollPane.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class ScrollPane extends Group { 30 | /** 31 | * 显示所有滚动条 32 | */ 33 | public static DISPLAY_SCROLL_BOTH:string = "both"; 34 | /** 35 | * 不显示滚动条 36 | */ 37 | public static DISPLAY_SCROLL_NONE:string = "none"; 38 | /** 39 | * 显示水平滚动条 40 | */ 41 | public static DISPLAY_SCROLL_HORIZONTAL:string = "horizontal"; 42 | /** 43 | * 显示垂直滚动条 44 | */ 45 | public static DISPLAY_SCROLL_VERTICAL:string = "vertical"; 46 | 47 | 48 | public verticalScrollBar:VScrollBar = null; 49 | public horizontalScrollBar:HScrollBar = null; 50 | 51 | private _scrollBarDisplay:string = null;//滚动条显示方式 52 | public constructor() { 53 | super(); 54 | } 55 | /** 56 | * 创建元素 57 | */ 58 | public createChildren():void{ 59 | super.createChildren(); 60 | } 61 | public set showDefaultSkin(value:boolean){ 62 | super.showBg = value; 63 | } 64 | /** 65 | * Draws the visual ui of the component. 66 | */ 67 | public draw():void{ 68 | if (!this.verticalScrollBar && this._scrollBarDisplay != ScrollPane.DISPLAY_SCROLL_NONE && this._scrollBarDisplay != ScrollPane.DISPLAY_SCROLL_HORIZONTAL){ 69 | this.verticalScrollBar = new VScrollBar(); 70 | } 71 | if (!this.horizontalScrollBar && this._scrollBarDisplay != ScrollPane.DISPLAY_SCROLL_NONE && this._scrollBarDisplay != ScrollPane.DISPLAY_SCROLL_VERTICAL){ 72 | this.horizontalScrollBar = new HScrollBar(); 73 | } 74 | if (this._scrollBarDisplay == ScrollPane.DISPLAY_SCROLL_BOTH && this._scrollBarDisplay == ScrollPane.DISPLAY_SCROLL_VERTICAL) { 75 | if (!this.verticalScrollBar.parent) { 76 | this.addChild(this.verticalScrollBar); 77 | } 78 | if (this.horizontalScrollBar.parent) { 79 | this.horizontalScrollBar.parent.removeChild(this.horizontalScrollBar); 80 | } 81 | } 82 | if (this._scrollBarDisplay == ScrollPane.DISPLAY_SCROLL_BOTH && this._scrollBarDisplay == ScrollPane.DISPLAY_SCROLL_HORIZONTAL) { 83 | if (!this.horizontalScrollBar.parent) { 84 | this.addChild(this.horizontalScrollBar); 85 | } 86 | if (this.verticalScrollBar.parent) { 87 | this.verticalScrollBar.parent.removeChild(this.verticalScrollBar); 88 | } 89 | } 90 | } 91 | 92 | public get scrollBarDisplay():string { 93 | return this._scrollBarDisplay; 94 | } 95 | /** 96 | * 滚动条显示方式 97 | * @param value 98 | */ 99 | public set scrollBarDisplay(value:string) { 100 | if (this._scrollBarDisplay != value) { 101 | this._scrollBarDisplay = value; 102 | this.invalidate(); 103 | } 104 | } 105 | 106 | } 107 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/animate/AnimateManager.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | 6 | export class AnimateManager { 7 | private _isRun:boolean = false; 8 | private _isFrozen:boolean = false; 9 | private _animateList:Array = []; 10 | 11 | private static _instance:AnimateManager = null; 12 | public static getInstance():AnimateManager { 13 | if (AnimateManager._instance == null) AnimateManager._instance = new easy.rpg.AnimateManager(); 14 | return AnimateManager._instance; 15 | } 16 | /** 17 | * 动画控制开始 18 | */ 19 | private start():void { 20 | if (!this._isRun){ 21 | //this._animateList.length = 0; 22 | easy.HeartBeat.addListener(this, this.onHeartBeat); 23 | this._isRun = true; 24 | this._isFrozen = false; 25 | } 26 | } 27 | /** 28 | * 战斗控制结束 29 | */ 30 | public stop():void { 31 | //console.log("AnimateManager Stop") 32 | this._isRun = false; 33 | this._animateList.length = 0; 34 | easy.HeartBeat.removeListener(this, this.onHeartBeat); 35 | } 36 | /** 37 | * 添加动画 38 | */ 39 | public addAnimate(animate:IAnimate):void { 40 | this._animateList.push(animate); 41 | this.start(); 42 | } 43 | /** 44 | * 删除动画 45 | */ 46 | public removeAnimate(animate:IAnimate):void { 47 | for (var i:number = 0; i < this._animateList.length; i++) { 48 | if (this._animateList[i] == animate) { 49 | this._animateList[i].stop(); 50 | this._animateList[i].destroy(); 51 | this._animateList.splice(i, 1); 52 | break; 53 | } 54 | } 55 | if (this._animateList.length == 0) this.stop(); 56 | } 57 | /** 58 | * 清空所有特效操作 59 | */ 60 | public removeAllAnimate():void { 61 | for (var i:number = 0; i < this._animateList.length; i++) { 62 | this._animateList[i].destroy(); 63 | } 64 | this._animateList.length = 0; 65 | } 66 | /** 67 | * 冻结 68 | * @param value 69 | */ 70 | public frozen(value:boolean):void { 71 | if (this._isRun){ 72 | this._isFrozen = value; 73 | for (var i:number = 0; i < this._animateList.length; i++) { 74 | this._animateList[i].frozen = value; 75 | } 76 | } 77 | } 78 | /** 79 | * 暂停播放 80 | */ 81 | public pause():void{ 82 | this.frozen(true); 83 | } 84 | /** 85 | * 继续播放 86 | */ 87 | public replay():void { 88 | this.frozen(false); 89 | } 90 | /** 91 | * 心跳,呼吸, 运动的之类要覆盖该方法,做动作 92 | */ 93 | public onHeartBeat():void { 94 | if (!this._isRun || this._isFrozen) return; 95 | var length1:number = this._animateList.length; 96 | //console.log("Animate onHeartBeat.len=" + length1); 97 | for(var i1:number = 0;i1 < length1;i1++){ 98 | var item:IAnimate = this._animateList[i1]; 99 | item.onHeartBeat(); 100 | //console.log("Animate onHeartBeat item.delay=" + item.delayFrame + ", completed=" + item.completed + ", after=" + item.afterFrame); 101 | if (!item.runing && item.delayFrame <= 0)item.play(); 102 | } 103 | var i:number = 0; 104 | for (i = this._animateList.length - 1; i >= 0; i--) { 105 | if (this._animateList[i].completed && this._animateList[i].afterFrame <= 0){ 106 | this._animateList[i].destroy(); 107 | this._animateList.splice(i, 1); 108 | } 109 | } 110 | //console.log("Animate 111 onHeartBeat.len=" + this._animateList.length); 111 | if (this._animateList.length == 0) this.stop(); 112 | } 113 | 114 | /** 115 | * 根据技能生成动画调度 116 | * @param jsonSkill 117 | */ 118 | public genSkillAnimateQueue(jsonSkill:number):void { 119 | //console.log("genSkillAnimateQueue"); 120 | var effectAnimate:EffectAnimate = ObjectPool.getByClass(EffectAnimate); 121 | effectAnimate.scene = ViewManager.currentView.scene; 122 | effectAnimate.skillId = jsonSkill; 123 | effectAnimate.actorSrc = ViewManager.currentView.scene.cameraFoucs; 124 | effectAnimate.actorDes = ViewManager.currentView.scene.getActorById(10001).actor; 125 | this.addAnimate(effectAnimate); 126 | } 127 | } 128 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/Style.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | export class Style{ 29 | public static TEXT_BACKGROUND:number = 0xFFFFFF; 30 | public static BACKGROUND:number = 0xCCCCCC; 31 | public static BUTTON_FACE:number = 0xFFFFFF; 32 | public static BUTTON_DOWN:number = 0xEEEEEE; 33 | public static INPUT_TEXT:number = 0x333333; 34 | public static LABEL_TEXT:number = 0x000000; 35 | public static BUTTON_TEXT:number = 0x666666; 36 | public static DROPSHADOW:number = 0x000000; 37 | public static PANEL:number = 0xF3F3F3; 38 | public static PROGRESS_BAR:number = 0xFFFFFF; 39 | public static LIST_DEFAULT:number = 0xFFFFFF; 40 | public static LIST_ALTERNATE:number = 0xF3F3F3; 41 | public static LIST_SELECTED:number = 0xCCCCCC; 42 | public static LIST_ROLLOVER:number = 0XDDDDDD; 43 | public static BUTTON_DEFAULT_WIDTH:number = 100; 44 | public static BUTTON_DEFAULT_HEIGHT:number = 32; 45 | 46 | 47 | 48 | public static embedFonts:boolean = false; 49 | public static fontName:string = null; 50 | public static fontSize:number = 16; 51 | /** 52 | * 是否允许文本加载默认滤镜. 53 | */ 54 | public static allowDefaultLabelFilter:boolean = true; 55 | public static DARK:string = "dark"; 56 | public static LIGHT:string = "light"; 57 | /** 58 | * 是否允许按钮禁用态时的颜色矩阵. 59 | */ 60 | public static allowColorFilterButtonEnabled:boolean = false; 61 | /** 62 | * 是否允许默认按钮点击自动冷却.(在按钮本身设置无冷却的情况下生效.) 63 | */ 64 | public static allowButtonDefaultCoolDown:boolean = false; 65 | /** 66 | * allowButtonDefaultCoolDown == true 情况下生效. 67 | */ 68 | public static defaultCoolDownFrames:number = 2; 69 | 70 | public static TEXTINPUT_HEIGHT:number = 25; 71 | public static TEXTINPUT_WIDTH:number = 100; 72 | public static TEXTINPUT_COLOR:number = 0xffffff; 73 | 74 | public static HORIZONTAL:string = "horizontal"; 75 | public static VERTICAL:string = "vertical"; 76 | 77 | public static SLIDER_WIDTH:number = 300; 78 | public static SLIDER_HEIGHT:number = 17; 79 | 80 | public static SCROLLBAR_WIDTH:number = 300; 81 | public static SCROLLBAR_HEIGHT:number = 17; 82 | 83 | 84 | public constructor(){ 85 | 86 | } 87 | /** 88 | * Applies a preset style as a list of color values. Should be called before creating any components. 89 | */ 90 | public static setStyle(style:string):void{ 91 | switch(style){ 92 | case Style.DARK: 93 | Style.BACKGROUND = 0x444444; 94 | Style.BUTTON_FACE = 0x666666; 95 | Style.BUTTON_DOWN = 0x222222; 96 | Style.INPUT_TEXT = 0xBBBBBB; 97 | Style.LABEL_TEXT = 0xCCCCCC; 98 | Style.PANEL = 0x666666; 99 | Style.PROGRESS_BAR = 0x666666; 100 | Style.TEXT_BACKGROUND = 0x555555; 101 | Style.LIST_DEFAULT = 0x444444; 102 | Style.LIST_ALTERNATE = 0x393939; 103 | Style.LIST_SELECTED = 0x666666; 104 | Style.LIST_ROLLOVER = 0x777777; 105 | break; 106 | case Style.LIGHT: 107 | default: 108 | Style.BACKGROUND = 0xCCCCCC; 109 | Style.BUTTON_FACE = 0xFFFFFF; 110 | Style.BUTTON_DOWN = 0xEEEEEE; 111 | Style.INPUT_TEXT = 0x333333; 112 | Style.LABEL_TEXT = 0x666666; 113 | Style.PANEL = 0xF3F3F3; 114 | Style.PROGRESS_BAR = 0xFFFFFF; 115 | Style.TEXT_BACKGROUND = 0xFFFFFF; 116 | Style.LIST_DEFAULT = 0xFFFFFF; 117 | Style.LIST_ALTERNATE = 0xF3F3F3; 118 | Style.LIST_SELECTED = 0xCCCCCC; 119 | Style.LIST_ROLLOVER = 0xDDDDDD; 120 | break; 121 | } 122 | } 123 | } 124 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/astar/AStar.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | 6 | export class AStar { 7 | private _open:BinaryHeap; 8 | private _grid:Grid; 9 | private _endNode:Node; 10 | private _startNode:Node; 11 | public path:Array; 12 | public heuristic:Function; 13 | private _straightCost:number = 1.0; 14 | private _diagCost:number = Math.SQRT2; 15 | private nowversion:number = 1; 16 | 17 | public constructor(){ 18 | this.heuristic = this.euclidian2; 19 | 20 | } 21 | public get grid():Grid{ 22 | return this._grid; 23 | } 24 | private justMin(x:any, y:any):boolean { 25 | return x.f < y.f; 26 | } 27 | 28 | public findPath(grid:Grid):boolean { 29 | this._grid = grid; 30 | this._endNode = this._grid.endNode; 31 | this.nowversion++; 32 | this._startNode = this._grid.startNode; 33 | //_open = []; 34 | this._open = new BinaryHeap(this.justMin); 35 | this._startNode.g = 0; 36 | return this.search(); 37 | } 38 | 39 | public search():boolean { 40 | var node:Node = this._startNode; 41 | node.version = this.nowversion; 42 | while (node != this._endNode){ 43 | var len:number = node.links.length; 44 | for (var i:number = 0; i < len; i++){ 45 | var test:Node = node.links[i].node; 46 | var cost:number = node.links[i].cost; 47 | var g:number = node.g + cost; 48 | var h:number = this.heuristic(test); 49 | var f:number = g + h; 50 | if (test.version == this.nowversion){ 51 | if (test.f > f){ 52 | test.f = f; 53 | test.g = g; 54 | test.h = h; 55 | test.parent = node; 56 | } 57 | } else { 58 | test.f = f; 59 | test.g = g; 60 | test.h = h; 61 | test.parent = node; 62 | this._open.ins(test); 63 | test.version = this.nowversion; 64 | } 65 | 66 | } 67 | if (this._open.a.length == 1){ 68 | return false; 69 | } 70 | node = (this._open.pop()); 71 | } 72 | this.buildPath(); 73 | return true; 74 | } 75 | 76 | private buildPath():void { 77 | this.path = new Array(); 78 | var node:Node = this._endNode; 79 | this.path.push(node); 80 | while (node != this._startNode){ 81 | node = node.parent; 82 | this.path.unshift(node); 83 | } 84 | } 85 | 86 | public manhattan(node:Node):number { 87 | return Math.abs(node.row - this._endNode.row) + Math.abs(node.column - this._endNode.column); 88 | } 89 | 90 | public manhattan2(node:Node):number { 91 | var dx:number = Math.abs(node.row - this._endNode.row); 92 | var dy:number = Math.abs(node.column - this._endNode.column); 93 | return dx + dy + Math.abs(dx - dy) / 1000; 94 | } 95 | 96 | public euclidian(node:Node):number { 97 | var dx:number = node.row - this._endNode.row; 98 | var dy:number = node.column - this._endNode.column; 99 | return Math.sqrt(dx * dx + dy * dy); 100 | } 101 | 102 | private TwoOneTwoZero:number = 2 * Math.cos(Math.PI / 3); 103 | 104 | public chineseCheckersEuclidian2(node:Node):number { 105 | var y:number = node.column / this.TwoOneTwoZero; 106 | var x:number = node.row + node.column / 2; 107 | var dx:number = x - this._endNode.row - this._endNode.column / 2; 108 | var dy:number = y - this._endNode.column / this.TwoOneTwoZero; 109 | return this.sqrt(dx * dx + dy * dy); 110 | } 111 | 112 | private sqrt(x:number):number { 113 | return Math.sqrt(x); 114 | } 115 | 116 | public euclidian2(node:Node):number { 117 | var dx:number = node.row - this._endNode.row; 118 | var dy:number = node.column - this._endNode.column; 119 | return dx * dx + dy * dy; 120 | } 121 | 122 | public diagonal(node:Node):number { 123 | var dx:number = Math.abs(node.row - this._endNode.row); 124 | var dy:number = Math.abs(node.column - this._endNode.column); 125 | var diag:number = Math.min(dx, dy); 126 | var straight:number = dx + dy; 127 | return this._diagCost * diag + this._straightCost * (straight - 2 * diag); 128 | } 129 | } 130 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/display/Actor.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy.rpg { 28 | export class Actor extends easy.Group{ 29 | public hitRect:egret.Rectangle = null;//战斗攻击碰撞使用的矩形 30 | public backGroup:easy.BaseGroup = null;//后置效果容器 31 | public frontGroup:easy.BaseGroup = null;//前置效果容器 32 | 33 | public _bitmapActor:egret.Bitmap = null;//角色的显示 34 | 35 | public _ctrl:ActorCtrl = null; 36 | 37 | private _dotShape:egret.Shape = null; 38 | private _hitShape:egret.Shape = null; 39 | /** 40 | * 构造角色 41 | * @param data 角色的原始数据,这个必须是要设置的,否者没法显示 42 | * @param control 角色的控制器,不给的话,就用默认的内置控制器 43 | */ 44 | public constructor(data:IActorData, control?:ActorCtrl) { 45 | super(); 46 | this._ctrl = control; 47 | if (this._ctrl == null){ 48 | this._ctrl = new easy.rpg.ActorCtrl(this, data); 49 | } 50 | } 51 | /** 52 | * 初始化主场景的组件 53 | * 这个方法在对象new的时候就调用,因为有些ui必须在加入stage之前就准备好 54 | * 子类覆写该方法,添加UI逻辑 55 | */ 56 | public createChildren():void { 57 | super.createChildren(); 58 | this.hitRect = new egret.Rectangle(); 59 | 60 | this.backGroup = new easy.BaseGroup(); 61 | this.frontGroup = new easy.BaseGroup(); 62 | 63 | this._bitmapActor = new egret.Bitmap(); 64 | //this._bitmapActor.anchorX = 0.5; 65 | //this._bitmapActor.anchorY = 0.5; 66 | 67 | //this.addChild(this.backGroup); 68 | this.addChild(this._bitmapActor); 69 | //this.addChild(this.frontGroup); 70 | this.anchorX = 0.5; 71 | this.anchorY = 1; 72 | //this.touchEnabled = true; 73 | 74 | this._hitShape = new egret.Shape(); 75 | this._dotShape = new egret.Shape(); 76 | 77 | //this.addChild(this._hitShape); 78 | //this.addChild(this._dotShape); 79 | this.showBg = false; 80 | 81 | this.hitRect.width = 20; 82 | this.hitRect.height = 80; 83 | this.setSize(100, 100); 84 | 85 | } 86 | 87 | public draw():void { 88 | super.draw(); 89 | var regPoint:egret.Point = this.getRegPoint(); 90 | this.hitRect.x = regPoint.x - this.hitRect.width/2; 91 | this.hitRect.y = regPoint.y - this.hitRect.height; 92 | this._hitShape.graphics.clear(); 93 | this._hitShape.graphics.beginFill(0xfff666); 94 | this._hitShape.graphics.drawRect(this.hitRect.x, this.hitRect.y, this.hitRect.width, this.hitRect.height); 95 | this._hitShape.graphics.endFill(); 96 | this._hitShape.graphics.lineStyle(1, 0x444333); 97 | this._hitShape.graphics.drawRect(this.hitRect.x, this.hitRect.y, this.hitRect.width, this.hitRect.height); 98 | 99 | this._dotShape.x = this.globalToLocal(this.getGlobalXY().x, this.getGlobalXY().y).x; 100 | this._dotShape.y = this.globalToLocal(this.getGlobalXY().x, this.getGlobalXY().y).y; 101 | this._dotShape.graphics.clear(); 102 | this._dotShape.graphics.beginFill(0xff0000); 103 | this._dotShape.graphics.drawRect(0, 0, 4, 4); 104 | this._dotShape.graphics.endFill(); 105 | this._dotShape.x = regPoint.x - 2; 106 | this._dotShape.y = regPoint.y - 2; 107 | } 108 | 109 | public getBounds():egret.Rectangle{ 110 | return this.hitRect; 111 | } 112 | } 113 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/astar/Grid.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 www.2ren.cn 3 | */ 4 | module easy.rpg { 5 | 6 | export class Grid { 7 | private _startNode:Node = null; 8 | private _endNode:Node = null; 9 | private _nodes:Array> = null; 10 | private _numCols:number = 0; 11 | private _numRows:number = 0; 12 | private _cellSize:number = 20; 13 | 14 | private type:number = 0; 15 | 16 | private _straightCost:number = 1.0; 17 | private _diagCost:number = Math.SQRT2; 18 | 19 | public constructor(gridData:Array, cellSize:number = 0){ 20 | this._numRows = gridData.length; 21 | this._numCols = gridData[0].length; 22 | this._cellSize = cellSize; 23 | this._nodes = new Array>(); 24 | 25 | for (var i:number = 0; i < this._numCols; i++){ 26 | this._nodes[i] = new Array(); 27 | for (var j:number = 0; j < this._numRows; j++){ 28 | this._nodes[i][j] = new Node(i, j, gridData[j][i]); 29 | this._nodes[i][j].point.x = i * this._cellSize + this._cellSize/2; 30 | this._nodes[i][j].point.y = j * this._cellSize + this._cellSize/2; 31 | } 32 | } 33 | } 34 | 35 | public get cellSize():number { 36 | return this._cellSize; 37 | } 38 | 39 | /** 40 | * 41 | * @param type 0四方向 1八方向 2跳棋 42 | */ 43 | public calculateLinks(type:number = 0):void { 44 | this.type = type; 45 | for (var i:number = 0; i < this._numCols; i++){ 46 | for (var j:number = 0; j < this._numRows; j++){ 47 | this.initNodeLink(this._nodes[i][j], type); 48 | } 49 | } 50 | } 51 | 52 | public getType():number { 53 | return this.type; 54 | } 55 | 56 | /** 57 | * 58 | * @param node 59 | * @param type 0八方向 1四方向 2跳棋 60 | */ 61 | private initNodeLink(node:Node, type:number = 0):void { 62 | var startX:number = Math.max(0, node.row - 1); 63 | // var endX:int = Math.min(numCols - 1, node.row); 64 | var endX:number = Math.min(this.numCols - 1, node.row + 1); 65 | 66 | var startY:number = Math.max(0, node.column - 1); 67 | // var endY:int = Math.min(numRows - 1, node.column); 68 | var endY:number = Math.min(this.numRows - 1, node.column + 1); 69 | 70 | node.links = new Array(); 71 | for (var i:number = startX; i <= endX; i++){ 72 | for (var j:number = startY; j <= endY; j++){ 73 | var test:Node = this.getNode(i, j); 74 | if (test == node || !test.walkable){ 75 | continue; 76 | } 77 | if (type != 2 && i != node.row && j != node.column){ 78 | var test2:Node = this.getNode(node.row, j); 79 | if (!test2.walkable){ 80 | continue; 81 | } 82 | test2 = this.getNode(i, node.column); 83 | if (!test2.walkable){ 84 | continue; 85 | } 86 | } 87 | var cost:number = this._straightCost; 88 | if (!((node.row == test.row) || (node.column == test.column))){ 89 | if (type == 1){ 90 | continue; 91 | } 92 | if (type == 2 && (node.row - test.row) * (node.column - test.column) == 1){ 93 | continue; 94 | } 95 | if (type == 2){ 96 | cost = this._straightCost; 97 | } else { 98 | cost = this._diagCost; 99 | } 100 | } 101 | node.links.push(new Link(test, cost)); 102 | } 103 | } 104 | } 105 | 106 | public getNode(x:number, y:number = 0):Node { 107 | return this._nodes[x][y]; 108 | } 109 | 110 | public setEndNode(x:number, y:number = 0):void { 111 | this._endNode = this._nodes[x][y]; 112 | } 113 | 114 | public setStartNode(x:number, y:number = 0):void { 115 | this._startNode = this._nodes[x][y]; 116 | } 117 | 118 | public setWalkable(x:number, y:number, value:boolean):void { 119 | this._nodes[x][y].walkable = value; 120 | } 121 | 122 | public get endNode():Node { 123 | return this._endNode; 124 | } 125 | 126 | public get numCols():number { 127 | return this._numCols; 128 | } 129 | 130 | public get numRows():number { 131 | return this._numRows; 132 | } 133 | 134 | public get startNode():Node { 135 | return this._startNode; 136 | } 137 | } 138 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/HGroup.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | /** 29 | * 水平放置的容器 30 | */ 31 | export class HGroup extends Group{ 32 | public _gap:number = 0; 33 | public _hAlign:string = egret.HorizontalAlign.LEFT; 34 | public _vAlign:string = egret.VerticalAlign.MIDDLE; 35 | 36 | public constructor(drawDelay:boolean = false){ 37 | super(drawDelay); 38 | } 39 | 40 | /** 41 | * 初始化主场景的组件 42 | * 这个方法在对象new的时候就调用,因为有些ui必须在加入stage之前就准备好 43 | * 子类覆写该方法,添加UI逻辑 44 | */ 45 | public createChildren():void { 46 | super.createChildren(); 47 | this.invalidate(); 48 | } 49 | 50 | /** 51 | * 设置或获取参与布局元素间水平像素间隔 52 | */ 53 | public get gap():number{ 54 | return this._gap; 55 | } 56 | 57 | public set gap(value:number){ 58 | if(this._gap != value){ 59 | this._gap = value; 60 | this.invalidate(); 61 | } 62 | } 63 | 64 | /** 65 | * 水平方向布局方式 66 | */ 67 | public get hAlign():string{ 68 | return this._hAlign; 69 | } 70 | 71 | public set hAlign(value:string){ 72 | if(this._hAlign != value){ 73 | this._hAlign = value; 74 | this.invalidate(); 75 | } 76 | } 77 | /** 78 | * 垂直方向布局方式 79 | */ 80 | public get vAlign():string{ 81 | return this._vAlign; 82 | } 83 | 84 | public set vAlign(value:string){ 85 | if(this._vAlign != value){ 86 | this._vAlign = value; 87 | this.invalidate(); 88 | } 89 | } 90 | /** 91 | * 设置宽 92 | * @param value 93 | */ 94 | public set width(value:number){ 95 | if (this.width != value) { 96 | //this.width = value; 97 | this._setWidth(value); 98 | this.invalidate(); 99 | } 100 | } 101 | public get width():number { 102 | if (this.explicitWidth == NaN || this.explicitWidth == undefined) return 0; 103 | return this.explicitWidth; 104 | } 105 | /** 106 | * 设置高 107 | * @param value 108 | */ 109 | public set height(value:number){ 110 | if (this.height != value) { 111 | //this.height = value; 112 | this._setHeight(value); 113 | this.invalidate(); 114 | } 115 | } 116 | public get height():number { 117 | if (this.explicitHeight == NaN || this.explicitHeight == undefined) return 0; 118 | return this.explicitHeight; 119 | } 120 | 121 | /** 122 | * 更新显示组件的各项属性,重新绘制显示 123 | */ 124 | public draw():void{ 125 | if (this._bgImage && this._bgImage.parent) { 126 | this._bgImage.parent.removeChild(this._bgImage); 127 | } 128 | this.updateLayout(); 129 | super.draw(); 130 | if (this._showBg){ 131 | this.addChildAt(this._bgImage, 0) 132 | } 133 | } 134 | /** 135 | * 更新容器水平布局 136 | */ 137 | public updateLayout():void{ 138 | var i:number = 0; 139 | var child:egret.DisplayObject = null; 140 | var childLast:egret.DisplayObject = null; 141 | var wElements:number = 0; 142 | //console.log("@@@@@HGroup numChildren=" + this.numChildren); 143 | for(i = 0; i < this.numChildren; i++){ 144 | wElements += this.getChildAt(i).explicitWidth; 145 | } 146 | //console.log("@@@@@HGroup 000 wElements=" + wElements + ", gap=" + this._gap); 147 | wElements += (this.numChildren - 1) * this._gap; 148 | //console.log("@@@@@HGroup 1111 wElements=" + wElements + ", gap=" + this._gap); 149 | for(i = 0; i < this.numChildren; i++){ 150 | child = this.getChildAt(i); 151 | if(i == 0){ 152 | if(this._hAlign == egret.HorizontalAlign.LEFT){ 153 | child.x = 0; 154 | }else if(this._hAlign == egret.HorizontalAlign.CENTER){ 155 | child.x = (this.width - wElements)/2; 156 | }else if(this._hAlign == egret.HorizontalAlign.RIGHT){ 157 | child.x = this.width - wElements; 158 | } 159 | }else { 160 | childLast = this.getChildAt(i - 1); 161 | child.x = childLast.x + childLast.width + this.gap; 162 | } 163 | if(this._vAlign == egret.VerticalAlign.TOP){ 164 | child.y = 0; 165 | }else if(this._vAlign == egret.VerticalAlign.MIDDLE){ 166 | child.y = (this.explicitHeight - child.height)/2; 167 | }else if(this._vAlign == egret.VerticalAlign.BOTTOM){ 168 | child.y = this.explicitHeight - child.height; 169 | } 170 | //console.log("@@@@@HGroup x=" + child.x + ", y=" + child.y); 171 | } 172 | } 173 | } 174 | } -------------------------------------------------------------------------------- /src/com/easyegret/component/DebugWin.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | /** 29 | * Debug信息显示窗口 30 | */ 31 | export class DebugWin extends Win { 32 | //操作按钮容器 33 | private _bottomContainer:Group = null; 34 | //顶部信息容器 35 | private _topContainer:Group = null; 36 | private _labelTitle:Label = null; 37 | 38 | //内容显示 39 | private _textInfo:egret.TextField = null; 40 | //关闭按钮 41 | private _btnClose:Button = null; 42 | //刷新按钮 43 | private _btnRefresh:Button = null; 44 | /** 45 | * view成对应的ui展现 46 | * @type {null} 47 | * @private 48 | */ 49 | 50 | public constructor() { 51 | super(); 52 | } 53 | /** 54 | * 初始化ui数据 55 | * 这个方法在对象new的时候就调用,因为有些ui必须在加入stage之前就准备好 56 | */ 57 | public createChildren():void{ 58 | super.createChildren(); 59 | //窗口宽高 60 | this.width = 300; 61 | this.height = 400; 62 | //顶部信息设置 63 | this._topContainer = new Group(); 64 | this._topContainer.height = 15; 65 | this._topContainer.width = this.width; 66 | this._topContainer.y = 0; 67 | this.addChild(this._topContainer); 68 | 69 | this._labelTitle = new Label(); 70 | this._labelTitle.text = "Debug窗口"; 71 | this._topContainer.addChild(this._labelTitle); 72 | 73 | //底部按钮设置 74 | //按钮容器 75 | this._bottomContainer = new Group(); 76 | this._bottomContainer.height = 30; 77 | this._bottomContainer.width = this.width; 78 | this._bottomContainer.y = this.height - this._bottomContainer.height; 79 | this.addChild(this._bottomContainer); 80 | //刷新按钮 81 | this._btnRefresh = new Button(); 82 | this._btnRefresh.label = "刷新"; 83 | this._btnRefresh.setSize(50, 25); 84 | this._btnRefresh.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchRegresh, this); 85 | this._bottomContainer.addChild(this._btnRefresh); 86 | 87 | //关闭按钮 88 | this._btnClose = new Button(); 89 | this._btnClose.x = this._btnRefresh.width + 2; 90 | this._btnClose.label = "关闭"; 91 | this._btnClose.setSize(50, 25); 92 | this._bottomContainer.addChild(this._btnClose); 93 | this._btnClose.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchClose, this); 94 | 95 | //内容显示设置 96 | this._textInfo = new egret.TextField(); 97 | this._textInfo.multiline = true; 98 | this._textInfo.textColor = 0x000000; 99 | this._textInfo.size = 12; 100 | this._textInfo.lineSpacing = 6; 101 | this._textInfo.x = 1; 102 | this._textInfo.y = this._topContainer.height + 1; 103 | this._textInfo.width = this.width; 104 | this._textInfo.height = this.height - this._topContainer.height - this._bottomContainer.height - 2; 105 | this.addChild(this._textInfo); 106 | 107 | } 108 | 109 | /** 110 | * 刷新内容事件 111 | * @param event 112 | */ 113 | private onTouchRegresh(event:egret.TouchEvent):void { 114 | this._textInfo.text = Debug.log; 115 | } 116 | /** 117 | * 关闭窗口事件 118 | * @param event 119 | */ 120 | private onTouchClose(event:egret.TouchEvent):void { 121 | DebugWin.hidden(); 122 | } 123 | 124 | 125 | //单例调用 126 | private static _instance:DebugWin = null; 127 | 128 | /** 129 | * 显示 130 | */ 131 | public static show():void { 132 | if (DebugWin._instance == null) { 133 | DebugWin._instance = new DebugWin(); 134 | } 135 | GlobalSetting.STAGE.addChild(DebugWin._instance); 136 | } 137 | 138 | /** 139 | * 隐藏 140 | */ 141 | public static hidden():void { 142 | if (DebugWin._instance && DebugWin._instance.parent) { 143 | DebugWin._instance.parent.removeChild(this._instance); 144 | } 145 | } 146 | } 147 | } -------------------------------------------------------------------------------- /src/com/easyegret/core/ObjectPool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | /** 29 | * 对象池,针对经常创建的对象进行 回收并复用,减少对象创建的消耗 30 | * 不给垃圾回收的机会 31 | */ 32 | export class ObjectPool { 33 | private static _dataPool:any = {};//池数据 34 | //public static length:number = 0;//长度 35 | /** 36 | * 传入一个class,给你一个class对象的实例 37 | * 使用class的名称作为对象映射的key 38 | * 该class的构造函数必须是无参数要求 39 | * 从对象池中提取Object 40 | * @param clz 要提取的objec的Class 41 | * @return clz 对象的实例 42 | */ 43 | public static getByClass(clz:any, pop:boolean = true):any { 44 | var key:string = egret.getQualifiedClassName(clz); 45 | var item:any = ObjectPool.getObject(key, pop); 46 | if (item == null) item = new clz(); 47 | if (!pop) { 48 | ObjectPool.recycleClass(item); 49 | } 50 | return item; 51 | } 52 | 53 | /** 54 | * 释放object,使得objec返回到pool池,可以继续重复利用 55 | * 使用class的名称作为对象映射的key 56 | * @param item 要返回池中的item对象 57 | */ 58 | public static recycleClass(obj:any):void { 59 | if (!obj) return; 60 | var key:string = egret.getQualifiedClassName(obj); 61 | ObjectPool.recycleObject(key, obj); 62 | } 63 | 64 | /** 65 | * 查询是否有某class名称的对象池存在 66 | * @param clz 67 | * @returns {any} 68 | */ 69 | public static hasClass(clz:any):boolean { 70 | return ObjectPool.getByClass(clz, false); 71 | } 72 | 73 | /** 74 | * 根据name从对象池中提取Object 75 | * @param name 要提取的objec的name 76 | * @param pop 是否从对象池中弹出 77 | * @return clz 对象的实例 78 | */ 79 | public static getObject(name:string, pop:boolean = true):any { 80 | if (ObjectPool._dataPool.hasOwnProperty(name) && ObjectPool._dataPool[name].length > 0) { 81 | var obj:any = null; 82 | if (pop) { 83 | obj = ObjectPool._dataPool[name].pop(); 84 | if (ObjectPool._dataPool[name].length == 0) delete ObjectPool._dataPool[name]; 85 | } else { 86 | obj = ObjectPool._dataPool[name][0]; 87 | } 88 | return obj; 89 | } 90 | return null; 91 | } 92 | 93 | /** 94 | * 使用name存储对象 95 | * @param item 96 | * @param name 97 | * @param group 98 | */ 99 | public static setObject(name:string, item:any):void { 100 | ObjectPool.recycleObject(name, item); 101 | } 102 | 103 | /** 104 | * 回收对象,使用name存储 105 | * 反之,通过name提取 106 | * @param name 107 | * @param item 108 | */ 109 | public static recycleObject(name:string, item:any):void { 110 | if (!item) return; 111 | if (!ObjectPool._dataPool.hasOwnProperty(name)) { 112 | ObjectPool._dataPool[name] = []; 113 | } 114 | if (item.hasOwnProperty("destroy"))item.destroy(); 115 | if (ObjectPool._dataPool[name].indexOf(item) < 0) { 116 | ObjectPool._dataPool[name].push(item); 117 | } 118 | } 119 | 120 | /** 121 | * 查询是否有name名称的对象池存在 122 | * @param name 123 | * @returns {any} 124 | */ 125 | public static hasObject(name:string):boolean { 126 | return ObjectPool.getObject(name, false); 127 | } 128 | 129 | /** 130 | * 释放所有clz归属的objec的引用 131 | * 获取class的名称作为对象映射的key,把对应的对象列表引用释放 132 | * @param clz 要释放的objec的Class 133 | */ 134 | public static dispose(clz:any):void { 135 | var key:string = egret.getQualifiedClassName(clz); 136 | ObjectPool.disposeObjects(key); 137 | } 138 | 139 | /** 140 | * 释放某个对象池的所有对象 141 | * 获取name对应的对象列表, 把引用释放 142 | * @param name 143 | */ 144 | public static disposeObjects(name:string):void { 145 | if (ObjectPool._dataPool.hasOwnProperty(name)) { 146 | ObjectPool._dataPool[name].length = 0; 147 | delete ObjectPool._dataPool[name]; 148 | } 149 | } 150 | } 151 | } -------------------------------------------------------------------------------- /src/com/easyegret/ui/TitleGroup.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | 29 | export class TitleGroup extends Group{ 30 | public constructor(){ 31 | super(); 32 | } 33 | 34 | public _columnWidth:number = 0; 35 | /** 36 | * tile布局列宽 37 | */ 38 | public get columnWidth():number{ 39 | return this._columnWidth; 40 | } 41 | 42 | public set columnWidth(value:number){ 43 | if(this._columnWidth != value){ 44 | this._columnWidth = value; 45 | this.invalidate(); 46 | } 47 | } 48 | 49 | public _rowHeight:number = 0; 50 | /** 51 | * tile布局行高 52 | */ 53 | public get rowHeight():number{ 54 | return this._rowHeight; 55 | } 56 | 57 | public set rowHeight(value:number){ 58 | if(this._rowHeight != value){ 59 | this._rowHeight = value; 60 | this.invalidate(); 61 | } 62 | } 63 | 64 | public _requestedColumnCount:number = 1; 65 | /** 66 | * tile布局列数 67 | */ 68 | public get requestedColumnCount():number{ 69 | return this._requestedColumnCount; 70 | } 71 | 72 | public set requestedColumnCount(value:number){ 73 | if(this._requestedColumnCount != value){ 74 | this._requestedColumnCount = value; 75 | this.invalidate(); 76 | } 77 | } 78 | 79 | public _requestedRowCount:number = 1; 80 | /** 81 | * tile布局行数 82 | */ 83 | public get requestedRowCount():number{ 84 | return this._requestedRowCount; 85 | } 86 | 87 | public set requestedRowCount(value:number){ 88 | if(this._requestedRowCount != value){ 89 | this._requestedRowCount = value; 90 | this.invalidate(); 91 | } 92 | } 93 | public _tileHDirectionBeginFromLeft:boolean = true; 94 | 95 | /** 96 | * tile布局水平流次序.true,左;right,右. 97 | */ 98 | public get tileHDirectionBeginFromLeft():boolean{ 99 | return this._tileHDirectionBeginFromLeft; 100 | } 101 | 102 | /** 103 | * @private 104 | */ 105 | public set tileHDirectionBeginFromLeft(value:boolean){ 106 | this._tileHDirectionBeginFromLeft = value; 107 | if(this._layout == LayoutMode.TILE){ 108 | this.invalidate(); 109 | } 110 | } 111 | 112 | 113 | /** 114 | * 更新容器布局 115 | */ 116 | public updateLayout():void{ 117 | switch(this._layout){ 118 | case LayoutMode.HORIZONTAL:{ 119 | this.updateHorizontalLayout(); 120 | break; 121 | } 122 | case LayoutMode.VERTICAL:{ 123 | this.updateVerticalLayout(); 124 | break; 125 | } 126 | case LayoutMode.TILE:{ 127 | this.updateTileLayout(); 128 | break; 129 | } 130 | default:{ 131 | break; 132 | } 133 | } 134 | } 135 | 136 | 137 | /** 138 | * 更新容器平铺布局 139 | * 140 | */ 141 | public updateTileLayout():void{ 142 | var i:number = 0;//循环参数 143 | var columnCount:number = 0;//列好 144 | var rowCount:number = 0;//行号 145 | var child:egret.DisplayObject = null; 146 | var xOffset:number = 0;//child阵列整体水平偏移 147 | var yOffset:number = 0;//child阵列整体垂直偏移 148 | // var childLast:DisplayObject = null; 149 | var wElements:number = (this.numChildren >= this.requestedColumnCount?this.requestedColumnCount:this.numChildren) * this.columnWidth + ((this.numChildren >= this.requestedColumnCount?this.requestedColumnCount:this.numChildren) - 1)*this.horizontalGap; 150 | var hElements:number = Math.ceil(this.numChildren/this.requestedColumnCount) * this.rowHeight + Math.floor(this.numChildren/this.requestedColumnCount) * this.verticalGap; 151 | //if(this._verticalAlign == egret.VerticalAlign.TOP){ 152 | // yOffset = 0; 153 | //}else if(this._verticalAlign == egret.VerticalAlign.MIDDLE){ 154 | // yOffset = (this._height - hElements)/2; 155 | //}else if(this._verticalAlign == egret.VerticalAlign.BOTTOM){ 156 | // yOffset = this._height - hElements; 157 | //} 158 | //if(this._horizontalAlign == egret.HorizontalAlign.LEFT){ 159 | // xOffset = 0; 160 | //}else if(this._horizontalAlign == egret.HorizontalAlign.CENTER){ 161 | // xOffset = (this._width - wElements)/2; 162 | //}else if(this._horizontalAlign == egret.HorizontalAlign.RIGHT){ 163 | // xOffset = this._width - wElements; 164 | //} 165 | for(i = 0; i < this.numChildren; i++){+89 166 | child = this.getChildAt(i); 167 | columnCount = this.tileHDirectionBeginFromLeft?(i%this.requestedColumnCount):(this.requestedColumnCount - i%this.requestedColumnCount - 1); 168 | rowCount = Math.floor(i/this.requestedColumnCount); 169 | child.x = (this.columnWidth - child.width)/2 + columnCount*this.columnWidth + columnCount*this.horizontalGap + xOffset; 170 | child.y = (this.rowHeight - child.height)/2 + rowCount*this.rowHeight + rowCount*this.verticalGap + yOffset; 171 | } 172 | } 173 | } 174 | } -------------------------------------------------------------------------------- /src/com/easyegret/component/View.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Administrator on 2014/11/5. 3 | */ 4 | module easy{ 5 | /** 6 | * view的基本类 7 | * 所有的ui组件都应该放置在ui层中 8 | * 在view中只处理view相关的逻辑,对ui成层的组件进行操作 9 | */ 10 | export class View extends ReceiveGroup { 11 | private _scene:easy.rpg.Scene = null; 12 | public constructor() { 13 | super(); 14 | this._loadingUIClz = LoadingViewUI; 15 | } 16 | 17 | /** 18 | * view进入的逻辑 19 | * 可以再次根据外部数据情况做一些逻辑处理 20 | */ 21 | public enter():void { 22 | super.enter(); 23 | if (this._scene){ 24 | this._scene.enter(); 25 | } 26 | this.checkViewSize(); 27 | } 28 | /** 29 | * 设置ui层的显示对象 30 | * @param myui 31 | */ 32 | public setUI(myui:BaseGroup) { 33 | super.setUI(myui); 34 | this._ui = myui; 35 | if (this._ui) { 36 | this.addChild(this._ui); 37 | } 38 | } 39 | /** 40 | * 检测view的尺寸要求是否达到设定 41 | */ 42 | public checkViewSize():void { 43 | if (GlobalSetting.DISPLAY_MODEL == GlobalSetting.DISPLAY_VIEW_FULL){ 44 | var w:number = this.width; 45 | var h:number = this.height; 46 | if (this._scene){ 47 | //console.log("check size has sence") 48 | //有场景的,需要自适应窗口大小 49 | if (this.scene.sceneWidth <= 0) { 50 | w = GlobalSetting.STAGE_WIDTH; 51 | } else if(GlobalSetting.STAGE_WIDTH < w){ 52 | if (GlobalSetting.STAGE_WIDTH >= GlobalSetting.VIEW_MINI_WIDTH) { 53 | w = GlobalSetting.STAGE_WIDTH; 54 | } else { 55 | w = GlobalSetting.VIEW_MINI_WIDTH; 56 | } 57 | } else if (GlobalSetting.STAGE_WIDTH > this.scene.sceneWidth) { 58 | w = this.scene.sceneWidth; 59 | } else { 60 | w = GlobalSetting.STAGE_WIDTH; 61 | } 62 | if (this.scene.sceneHeight <= 0) { 63 | h = GlobalSetting.STAGE_HEIGHT; 64 | if (!egret.NumberUtils.isNumber(h)) { 65 | //console.log("checkViewSize2222 height is not a number!!!!"); 66 | } 67 | } else if(GlobalSetting.STAGE_HEIGHT < h){ 68 | if (GlobalSetting.STAGE_HEIGHT >= GlobalSetting.VIEW_MINI_HEIGHT) { 69 | h = GlobalSetting.STAGE_HEIGHT; 70 | //console.log("checkViewSize333 height is not a number!!!!"); 71 | } else { 72 | h = GlobalSetting.VIEW_MINI_HEIGHT; 73 | //console.log("checkViewSize444 height is not a number!!!!"); 74 | } 75 | } else if (GlobalSetting.STAGE_HEIGHT > this.scene.sceneHeight) { 76 | h = this.scene.sceneHeight; 77 | //console.log("checkViewSize555 height is not a number!!!! h=" + h); 78 | } else { 79 | h = GlobalSetting.STAGE_HEIGHT; 80 | //console.log("checkViewSize666 height is not a number!!!!"); 81 | } 82 | } else {//无场景的 83 | //console.log("check size no sence") 84 | if(GlobalSetting.STAGE_WIDTH > w){ 85 | if (GlobalSetting.STAGE_WIDTH >= GlobalSetting.VIEW_MINI_WIDTH) { 86 | w = GlobalSetting.STAGE_WIDTH; 87 | } else { 88 | w = GlobalSetting.VIEW_MINI_WIDTH; 89 | } 90 | } else if (GlobalSetting.VIEW_MINI_WIDTH > w){ 91 | w = GlobalSetting.STAGE_WIDTH; 92 | } 93 | if(GlobalSetting.STAGE_HEIGHT > h){ 94 | if (GlobalSetting.STAGE_HEIGHT >= GlobalSetting.VIEW_MINI_HEIGHT) { 95 | h = GlobalSetting.STAGE_HEIGHT; 96 | } else { 97 | h = GlobalSetting.VIEW_MINI_HEIGHT; 98 | } 99 | } else if (GlobalSetting.VIEW_MINI_HEIGHT > h){ 100 | h = GlobalSetting.STAGE_HEIGHT; 101 | } 102 | } 103 | w = parseInt("" + w); 104 | h = parseInt("" + h); 105 | this.setSize(w, h); 106 | var ui:BaseGroup = this.getUI(); 107 | if (ui){ 108 | ui.setSize(w, h); 109 | } 110 | if (this._scene)this._scene.setSize(w, h); 111 | //console.log("view checkViewSize widht=" + w + ", height=" + h) 112 | } 113 | } 114 | /** 115 | * enter的过渡效果 116 | */ 117 | public enterTransition():void { 118 | if (ViewManager.currentView && ViewManager.currentView != this) ViewManager.currentView.outer(); 119 | super.enterTransition(); 120 | } 121 | /** 122 | * enter的过渡效果结束 123 | */ 124 | public enterTransitionComplete():void { 125 | if (ViewManager.currentView && ViewManager.currentView != this) ViewManager.currentView.outerTransitionComplete(); 126 | super.enterTransitionComplete(); 127 | ViewManager.currentView = this; 128 | } 129 | 130 | /** 131 | * 设置场景 132 | * @param scene 133 | */ 134 | public set scene(scene:easy.rpg.Scene){ 135 | if (this._scene){//旧场景移除 136 | this._scene.removeFromParent(); 137 | } 138 | this._scene = scene; 139 | if (this._scene){ 140 | this.addChildAt(this._scene, 0); 141 | } 142 | this.checkViewSize(); 143 | } 144 | 145 | public get scene():easy.rpg.Scene{ 146 | return this._scene; 147 | } 148 | } 149 | } -------------------------------------------------------------------------------- /src/com/easyegret/rpg/RpgSetting.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy.rpg { 28 | export class RpgSetting { 29 | public static SHOW_OTHER_PLAYER:boolean = true;//显示其他玩家 30 | 31 | public static ACTOR_TYPE_NPC:string = "npc"; 32 | public static ACTOR_TYPE_PLAYER:string = "player"; 33 | public static ACTOR_TYPE_BUILDING:string = "building"; 34 | //public static ACTOR_TYPE_:string = ""; 35 | 36 | 37 | 38 | public static PLAYER_ID:number = 0;//ME ID 39 | 40 | public static ACTOR_STD:string = "std";//人物站立 41 | public static ACTOR_MOV:string = "mov";//人物行走 42 | public static ACTOR_DIE:string = "die";//人物死亡 43 | public static ACTOR_ATK:string = "atk";//人物攻击 44 | public static ACTOR_BAK:string = "bak";//人物被攻击 45 | public static ACTOR_SKL:string = "skl";//人物释放技能 46 | 47 | /** 48 | * 方向定义, valve,保持和动作序列的下标一致 49 | * n 50 | * wn ne 51 | * w e 52 | * sw es 53 | * s 54 | * 55 | * [1] 56 | * [2] [8] 57 | * [3] [7] 58 | * [4] [6] 59 | * [5] 60 | */ 61 | public static DIRECTION_8:number = 8; 62 | public static DIRECTION_7:number = 7; 63 | public static DIRECTION_6:number = 6; 64 | public static DIRECTION_5:number = 5; 65 | public static DIRECTION_4:number = 4; 66 | public static DIRECTION_3:number = 3; 67 | public static DIRECTION_2:number = 2; 68 | public static DIRECTION_1:number = 1; 69 | public static DIRECTION_0:number = 0;//无此方向 70 | 71 | public static DIRECT_NUMBER:number =RpgSetting.DIRECT_2;//角色状态的方向材质数量定义 72 | public static DIRECT_2:number = 2;//2方向,提供3的材质 73 | public static DIRECT_4:number = 4;//4方向,提供2,4的材质 74 | public static DIRECT_6:number = 6;//6,提供2,3,4的材质 75 | public static DIRECT_8:number = 8;//8方向1,2,3,4,5的材质 76 | 77 | public static BUFF_CENTER_FRONT:string = "centre_F";//中前 78 | public static BUFF_CENTER_BACK:string = "centre_B";//中后 79 | public static BUFF_ABOVE:string = "above";//上 80 | public static BUFF_BELOW_BACK:string = "below_B";//下后 81 | public static BUFF_BELOW_FRONT:string = "below_F";//下前 82 | public static EFFECT_MISSILE:string = "missile";//飞行 83 | 84 | //战斗命令类型 85 | /** 86 | * 移动命令 87 | */ 88 | public static FIGHT_ACTION_MOV:number = 0; 89 | /** 90 | * 攻击命令 91 | */ 92 | public static FIGHT_ACTION_SKILL:number = 1; 93 | /** 94 | * 血量变化命令 95 | */ 96 | public static FIGHT_ACTION_CHANGE_HP:number = 2; 97 | /** 98 | * 死亡命令 99 | */ 100 | public static FIGHT_ACTION_DIE:number = 3; 101 | /** 102 | * 战斗结果命令 103 | */ 104 | public static FIGHT_ACTION_TYPE_RESULT:number = 4; 105 | /** 106 | * 傀儡能量值刷新. 107 | */ 108 | public static FIGHT_ACTION_TYPE_ENEYGY:number = 5; 109 | /** 110 | * 战斗角色获得buff通知. 111 | */ 112 | public static FIGHT_ACTION_TYPE_BUFF:number = 6; 113 | 114 | //战斗伤害类型 115 | /** 116 | * 攻击伤害,普通 117 | */ 118 | public static FIGHT_DAMEGE_COMMON:number = 0; 119 | /** 120 | * 攻击伤害,闪避 121 | */ 122 | public static FIGHT_DAMEGE_DODGE:number = 1; 123 | /** 124 | * 攻击伤害,暴击 125 | */ 126 | public static FIGHT_DAMEGE_CRIT:number = 2; 127 | /** 128 | * 攻击伤害,效果 129 | */ 130 | public static FIGHT_DAMEGE_EFFECT:number = 3; 131 | /** 132 | * 攻击伤害,抵抗 133 | */ 134 | public static FIGHT_DAMEGE_RESISTANCE:number = 4; 135 | /** 136 | * 移动同步总帧时 137 | */ 138 | public static MOVE_SYNC_FRAME_COUNT:number = 5; 139 | //任务 任务内容类型 1:杀怪 2:对话 140 | public static TASK_TYPE_DIALOGUE:number = 2; 141 | public static TASK_TYPE_KILL:number = 1; 142 | /** 143 | * 技能类型:通用 144 | */ 145 | public static BATTLE_SKILL_TYPE_COM:number = 0; 146 | /** 147 | * 技能类型:受击 148 | */ 149 | public static BATTLE_SKILL_TYPE_BAK:number = 1; 150 | 151 | 152 | /** 角色的身处场景的状态要求 */ 153 | public static GAME_STATE_FIGHT:string = "fight";//战斗状态 154 | public static GAME_STATE_NORMAL:string = "normal";//正常态 155 | public static GAME_STATE_ALL:string = "all";//全显示 156 | public static GAME_STATE_NONE:string = "none";//全都不显示 157 | } 158 | } -------------------------------------------------------------------------------- /src/com/easyegret/component/MessageTips.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014,www.easyegret.com 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the Egret-Labs.org nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | module easy { 28 | /** 29 | * 一个文字提示显示 30 | */ 31 | export class MessageTips extends BaseGroup { 32 | private static _instance:MessageTips = null;// 33 | private _dulation:number = 15;//停留时间 34 | private _mssageArr:Array = [];//消息内容 35 | 36 | private _labelArr:Array