window.es={},window.__extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();var __awaiter=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?n(e.value):new i(function(t){t(e.value)}).then(o,s)}l((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var i,r,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]=0&&(t.push(this.findBoundsRect(i,a,n,e)),i=-1)}i>=0&&(t.push(this.findBoundsRect(i,this.map.width,n,e)),i=-1)}return t},t.prototype.findBoundsRect=function(t,i,r,n){for(var a=-1,o=r+1;othis.tileHeight||this.maxTileWidth>this.tileWidth},enumerable:!0,configurable:!0}),i.prototype.getTilesetForTileGid=function(e){if(0==e)return null;for(var t=this.tilesets.length-1;t>=0;t--)if(this.tilesets[t].firstGid<=e)return this.tilesets[t];console.error("tile gid"+e+"未在任何tileset中找到")},i.prototype.worldToTilePositionX=function(t,i){void 0===i&&(i=!0);var r=Math.floor(t/this.tileWidth);return i?e.MathHelper.clamp(r,0,this.width-1):r},i.prototype.worldToTilePositionY=function(t,i){void 0===i&&(i=!0);var r=Math.floor(t/this.tileHeight);return i?e.MathHelper.clamp(r,0,this.height-1):r},i.prototype.getLayer=function(e){return this.layers[e]},i.prototype.update=function(){this.tilesets.forEach(function(e){e.update()})},i.prototype.dispose=function(e){void 0===e&&(e=!0),this._isDisposed||(e&&(this.tilesets.forEach(function(e){e.image&&e.image.dispose()}),this.imageLayers.forEach(function(e){e.image&&e.image.dispose()})),this._isDisposed=!0)},i}(e.TmxDocument);e.TmxMap=t,function(e){e[e.unknown=0]="unknown",e[e.orthogonal=1]="orthogonal",e[e.isometric=2]="isometric",e[e.staggered=3]="staggered",e[e.hexagonal=4]="hexagonal"}(e.OrientationType||(e.OrientationType={})),function(e){e[e.x=0]="x",e[e.y=1]="y"}(e.StaggerAxisType||(e.StaggerAxisType={})),function(e){e[e.odd=0]="odd",e[e.even=1]="even"}(e.StaggerIndexType||(e.StaggerIndexType={})),function(e){e[e.rightDown=0]="rightDown",e[e.rightUp=1]="rightUp",e[e.leftDown=2]="leftDown",e[e.leftUp=3]="leftUp"}(e.RenderOrderType||(e.RenderOrderType={}))}(es||(es={})),function(e){var t=function(){return function(){}}();e.TmxObjectGroup=t;var i=function(){return function(){this.shape=new egret.Shape,this.textField=new egret.TextField}}();e.TmxObject=i;var r=function(){return function(){}}();e.TmxText=r;var n=function(){return function(){}}();e.TmxAlignment=n,function(e){e[e.basic=0]="basic",e[e.point=1]="point",e[e.tile=2]="tile",e[e.ellipse=3]="ellipse",e[e.polygon=4]="polygon",e[e.polyline=5]="polyline",e[e.text=6]="text"}(e.TmxObjectType||(e.TmxObjectType={})),function(e){e[e.unkownOrder=-1]="unkownOrder",e[e.TopDown=0]="TopDown",e[e.IndexOrder=1]="IndexOrder"}(e.DrawOrderType||(e.DrawOrderType={})),function(e){e[e.left=0]="left",e[e.center=1]="center",e[e.right=2]="right",e[e.justify=3]="justify"}(e.TmxHorizontalAlignment||(e.TmxHorizontalAlignment={})),function(e){e[e.top=0]="top",e[e.center=1]="center",e[e.bottom=2]="bottom"}(e.TmxVerticalAlignment||(e.TmxVerticalAlignment={}))}(es||(es={})),function(e){var t=function(){function t(){}return t.loadTmxMap=function(e,t){var i=RES.getRes(t);return this.loadTmxMapData(e,i,RES.getResourceInfo(t))},t.loadTmxMapData=function(t,i,r){return __awaiter(this,void 0,void 0,function(){var n,a,o,s;return __generator(this,function(l){switch(l.label){case 0:t.version=i.version,t.tiledVersion=i.tiledversion,t.width=i.width,t.height=i.height,t.tileWidth=i.tilewidth,t.tileHeight=i.tileheight,t.hexSideLength=i.hexsidelength,t.orientation=this.parseOrientationType(i.orientation),t.staggerAxis=this.parseStaggerAxisType(i.staggeraxis),t.staggerIndex=this.parseStaggerIndexType(i.staggerindex),t.renderOrder=this.parseRenderOrderType(i.renderorder),t.nextObjectID=i.nextobjectid,t.backgroundColor=e.TmxUtils.color16ToUnit(i.color),t.properties=this.parsePropertyDict(i.properties),t.maxTileWidth=t.tileWidth,t.maxTileHeight=t.tileHeight,t.tmxDirectory=r.root+r.url.replace(".","_").replace(r.name,""),t.tilesets=[],n=0,a=i.tilesets,l.label=1;case 1:return ne.map.maxTileWidth&&(e.map.maxTileWidth=t.image.width),t.image.height>e.map.maxTileHeight&&(e.map.maxTileHeight=t.image.height))}),e.tileRegions.forEach(function(t){var i=t.width,r=t.height;i>e.map.maxTileWidth&&(e.map.maxTileWidth=i),i>e.map.maxTileHeight&&(e.map.maxTileHeight=r)})},t.parseOrientationType=function(t){return"unknown"==t?e.OrientationType.unknown:"orthogonal"==t?e.OrientationType.orthogonal:"isometric"==t?e.OrientationType.isometric:"staggered"==t?e.OrientationType.staggered:"hexagonal"==t?e.OrientationType.hexagonal:e.OrientationType.unknown},t.parseStaggerAxisType=function(t){return"y"==t?e.StaggerAxisType.y:e.StaggerAxisType.x},t.parseStaggerIndexType=function(t){return"even"==t?e.StaggerIndexType.even:e.StaggerIndexType.odd},t.parseRenderOrderType=function(t){return"right-up"==t?e.RenderOrderType.rightUp:"left-down"==t?e.RenderOrderType.leftDown:"left-up"==t?e.RenderOrderType.leftUp:e.RenderOrderType.rightDown},t.parsePropertyDict=function(t){if(!t)return null;for(var i=new Map,r=0,n=t;r=t.columns));x+=t.tileWidth+t.spacing);else t.tiles.forEach(function(i,r){t.tileRegions.set(r,new e.Rectangle(0,0,i.image.width,i.image.height))});return[2,t]}})})},t.loadTmxTilesetTile=function(t,i,r,n,a){return __awaiter(this,void 0,void 0,function(){var o,s,l,h,p,c,u,d,g,m,f,x,y;return __generator(this,function(T){switch(T.label){case 0:if(t.tileset=i,t.id=r.id,o=r.terrain)for(t.terrainEdges=new Array(4),s=0,l=0,h=o;l0){s.shape.x=l.x,s.shape.y=l.y,i.addChild(s.shape),s.shape.graphics.clear(),s.shape.graphics.lineStyle(1,10526884);for(c=0;c0&&(p=c.currentAnimationFrameGid);var u=i.tileset.tileRegions.get(p),d=Math.floor(i.x)*o,g=Math.floor(i.y)*s;i.horizontalFlip&&i.verticalFlip?(d+=s+(u.height*a.y-s),g-=u.width*a.x-o):i.horizontalFlip?d+=o+(u.height*a.y-s):i.verticalFlip?g+=o-u.width*a.x:g+=s-u.height*a.y;var m=new e.Vector2(d,g).add(n);if(i.tileset.image){if(r){var f=i.tileset.image.bitmap.getTexture(""+p);f||(f=i.tileset.image.bitmap.createTexture(""+p,u.x,u.y,u.width,u.height)),i.tileset.image.texture=new t(f),r.addChild(i.tileset.image.texture),i.tileset.image.texture.x!=m.x&&(i.tileset.image.texture.x=m.x),i.tileset.image.texture.y!=m.y&&(i.tileset.image.texture.y=m.y),i.verticalFlip&&i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=-1):i.verticalFlip?(i.tileset.image.texture.scaleX=a.x,i.tileset.image.texture.scaleY=-1):i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=a.y):(i.tileset.image.texture.scaleX=a.x,i.tileset.image.texture.scaleY=a.y),0!=i.tileset.image.texture.rotation&&(i.tileset.image.texture.rotation=0),0!=i.tileset.image.texture.anchorOffsetX&&(i.tileset.image.texture.anchorOffsetX=0),0!=i.tileset.image.texture.anchorOffsetY&&(i.tileset.image.texture.anchorOffsetY=0)}}else c.image.texture&&(c.image.bitmap.getTexture(p.toString())||(c.image.texture=new t(c.image.bitmap.createTexture(p.toString(),u.x,u.y,u.width,u.height)),r.addChild(c.image.texture)),c.image.texture.x=m.x,c.image.texture.y=m.y,c.image.texture.scaleX=a.x,c.image.texture.scaleY=a.y,c.image.texture.rotation=0,c.image.texture.anchorOffsetX=0,c.image.texture.anchorOffsetY=0,c.image.texture.filters=[l])},i}();e.TiledRendering=i}(es||(es={})),function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.update=function(){this.tiles.forEach(function(e){e.updateAnimatedTiles()})},t}(e.TmxDocument);e.TmxTileset=t;var i=function(){return function(){}}();e.TmxTileOffset=i;var r=function(){return function(){}}();e.TmxTerrain=r}(es||(es={})),function(e){var t=function(){function t(){}return Object.defineProperty(t.prototype,"currentAnimationFrameGid",{get:function(){return this.animationFrames[this._animationCurrentFrame].gid+this.tileset.firstGid},enumerable:!0,configurable:!0}),t.prototype.processProperties=function(){var e;(e=this.properties.get("engine.isDestructable"))&&(this.isDestructable=Boolean(e)),(e=this.properties.get("engine:isSlope"))&&(this.isSlope=Boolean(e)),(e=this.properties.get("engine:isOneWayPlatform"))&&(this.isOneWayPlatform=Boolean(e)),(e=this.properties.get("engine:slopeTopLeft"))&&(this.slopeTopLeft=Number(e)),(e=this.properties.get("engine:slopeTopRight"))&&(this.slopeTopRight=Number(e))},t.prototype.updateAnimatedTiles=function(){0!=this.animationFrames.length&&(this._animationElapsedTime+=e.Time.deltaTime,this._animationElapsedTime>this.animationFrames[this._animationCurrentFrame].duration&&(this._animationCurrentFrame=e.MathHelper.incrementWithWrap(this._animationCurrentFrame,this.animationFrames.length),this._animationElapsedTime=0))},t}();e.TmxTilesetTile=t;var i=function(){return function(){}}();e.TmxAnimationFrame=i}(es||(es={})),function(e){var t=function(){function t(){}return t.decode=function(t,i,r){switch(r=r||"none",i=i||"none"){case"base64":var n=e.Base64Utils.decodeBase64AsArray(t,4);return"none"===r?n:e.Base64Utils.decompress(t,n,r);case"csv":return e.Base64Utils.decodeCSV(t);case"none":for(var a=[],o=0;o