From 7345a17d246f34aba278d5d6a4158d723dbffb0b Mon Sep 17 00:00:00 2001 From: YHH <359807859@qq.com> Date: Sun, 23 Aug 2020 22:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eninja=20adventure=E4=BE=8B?= =?UTF-8?q?=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/libs/framework/framework.d.ts | 16 ++++ demo/libs/framework/framework.js | 79 ++++++++++++++++-- demo/libs/framework/framework.min.js | 2 +- demo/manifest.json | 6 +- demo/resource/characters/1.png | Bin 0 -> 4980 bytes demo/resource/characters/2.png | Bin 0 -> 5289 bytes demo/resource/characters/3.png | Bin 0 -> 5446 bytes demo/resource/characters/4.png | Bin 0 -> 5467 bytes demo/resource/characters/5.png | Bin 0 -> 5263 bytes demo/resource/characters/6.png | Bin 0 -> 4999 bytes demo/resource/default.res.json | 34 ++++++++ demo/src/Scenes/Ninja Adventure/Ninja.ts | 50 +++++++++++ .../Ninja Adventure/NinjaAdventureScene.ts | 32 +++++++ demo/src/UI/loading/LoadingView.ts | 2 +- demo/src/UI/sc/ScView.ts | 1 + source/bin/framework.d.ts | 16 ++++ source/bin/framework.js | 79 ++++++++++++++++-- source/bin/framework.min.js | 2 +- source/src/ECS/Components/Sprite.ts | 36 ++++++++ source/src/ECS/Components/SpriteAnimator.ts | 7 +- source/src/ECS/Core.ts | 2 +- source/src/ECS/Utils/ComponentList.ts | 3 +- .../src/ECS/Utils/RenderableComponentList.ts | 2 +- source/src/Math/SubpixelFloat.ts | 32 +++++++ source/src/Math/SubpixelVector2.ts | 23 +++++ source/src/Utils/ContentManager.ts | 3 +- 26 files changed, 400 insertions(+), 27 deletions(-) create mode 100644 demo/resource/characters/1.png create mode 100644 demo/resource/characters/2.png create mode 100644 demo/resource/characters/3.png create mode 100644 demo/resource/characters/4.png create mode 100644 demo/resource/characters/5.png create mode 100644 demo/resource/characters/6.png create mode 100644 demo/src/Scenes/Ninja Adventure/Ninja.ts create mode 100644 demo/src/Scenes/Ninja Adventure/NinjaAdventureScene.ts create mode 100644 source/src/Math/SubpixelFloat.ts create mode 100644 source/src/Math/SubpixelVector2.ts diff --git a/demo/libs/framework/framework.d.ts b/demo/libs/framework/framework.d.ts index 06b2d2a3..08994893 100644 --- a/demo/libs/framework/framework.d.ts +++ b/demo/libs/framework/framework.d.ts @@ -658,6 +658,7 @@ declare module es { origin: Vector2; readonly uvs: Rectangle; constructor(texture: egret.Texture, sourceRect?: Rectangle, origin?: Vector2); + static spritesFromAtlas(texture: egret.Texture, cellWidth: number, cellHeight: number, cellOffset?: number, maxCellsToInclude?: number): Sprite[]; } } declare module es { @@ -1331,6 +1332,21 @@ declare module es { calculateBounds(parentPosition: Vector2, position: Vector2, origin: Vector2, scale: Vector2, rotation: number, width: number, height: number): void; } } +declare module es { + class SubpixelFloat { + remainder: number; + update(amount: number): number; + reset(): void; + } +} +declare module es { + class SubpixelVector2 { + _x: SubpixelFloat; + _y: SubpixelFloat; + update(amount: Vector2): void; + reset(): void; + } +} declare module es { class Vector3 { x: number; diff --git a/demo/libs/framework/framework.js b/demo/libs/framework/framework.js index 1985ccd9..d537a03d 100644 --- a/demo/libs/framework/framework.js +++ b/demo/libs/framework/framework.js @@ -1255,7 +1255,8 @@ var es; this._scene.update(); } if (!this._nextScene) return [3, 2]; - this.removeChild(this._scene); + if (this._scene.parent) + this._scene.parent.removeChild(this._scene); this._scene.end(); this._scene = this._nextScene; this._nextScene = null; @@ -3094,6 +3095,7 @@ var es; })(es || (es = {})); var es; (function (es) { + var SpriteSheet = egret.SpriteSheet; var Sprite = (function () { function Sprite(texture, sourceRect, origin) { if (sourceRect === void 0) { sourceRect = new es.Rectangle(0, 0, texture.textureWidth, texture.textureHeight); } @@ -3110,6 +3112,28 @@ var es; this.uvs.width = sourceRect.width * inverseTexW; this.uvs.height = sourceRect.height * inverseTexH; } + Sprite.spritesFromAtlas = function (texture, cellWidth, cellHeight, cellOffset, maxCellsToInclude) { + if (cellOffset === void 0) { cellOffset = 0; } + if (maxCellsToInclude === void 0) { maxCellsToInclude = Number.MAX_VALUE; } + var sprites = []; + var cols = texture.textureWidth / cellWidth; + var rows = texture.textureHeight / cellHeight; + var i = 0; + var spriteSheet = new SpriteSheet(texture); + for (var y = 0; y < rows; y++) { + for (var x = 0; x < cols; x++) { + if (i++ < cellOffset) + continue; + var texture_1 = spriteSheet.getTexture(y + "_" + x); + if (!texture_1) + texture_1 = spriteSheet.createTexture(y + "_" + x, x * cellWidth, y * cellHeight, cellWidth, cellHeight); + sprites.push(new Sprite(texture_1)); + if (sprites.length == maxCellsToInclude) + return sprites; + } + } + return sprites; + }; return Sprite; }()); es.Sprite = Sprite; @@ -3179,7 +3203,7 @@ var es; this.animationState = State.completed; this._elapsedTime = 0; this.currentFrame = 0; - this.sprite = animation.sprites[this.currentFrame]; + this.displayObject.texture = animation.sprites[this.currentFrame].texture2D; return; } var i = Math.floor(time / secondsPerFrame); @@ -3191,7 +3215,7 @@ var es; else { this.currentFrame = i % n; } - this.sprite = animation.sprites[this.currentFrame]; + this.displayObject.texture = animation.sprites[this.currentFrame].texture2D; }; SpriteAnimator.prototype.addAnimation = function (name, animation) { if (!this.sprite && animation.sprites.length > 0) @@ -3205,7 +3229,7 @@ var es; this.currentAnimationName = name; this.currentFrame = 0; this.animationState = State.running; - this.sprite = this.currentAnimation.sprites[0]; + this.displayObject.texture = this.currentAnimation.sprites[0].texture2D; this._elapsedTime = 0; this._loopMode = loopMode ? loopMode : LoopMode.loop; }; @@ -4154,7 +4178,8 @@ var es; }; ComponentList.prototype.handleRemove = function (component) { if (component instanceof es.RenderableComponent) { - this._entity.scene.removeChild(component.displayObject); + if (component.displayObject.parent) + component.displayObject.parent.removeChild(component.displayObject); this._entity.scene.renderableComponents.remove(component); } this._entity.componentBits.set(es.ComponentTypeManager.getIndexFor(component), false); @@ -4727,7 +4752,7 @@ var es; var component = this_1._components[i]; var egretDisplayObject = scene.$children.find(function (a) { return a.hashCode == component.displayObject.hashCode; }); var displayIndex = scene.getChildIndex(egretDisplayObject); - if (displayIndex != i) + if (displayIndex != -1 && displayIndex != i) scene.swapChildrenAt(displayIndex, i); }; var this_1 = this; @@ -6384,6 +6409,45 @@ var es; es.Rectangle = Rectangle; })(es || (es = {})); var es; +(function (es) { + var SubpixelFloat = (function () { + function SubpixelFloat() { + this.remainder = 0; + } + SubpixelFloat.prototype.update = function (amount) { + this.remainder += amount; + var motion = Math.trunc(this.remainder); + this.remainder -= motion; + amount = motion; + return amount; + }; + SubpixelFloat.prototype.reset = function () { + this.remainder = 0; + }; + return SubpixelFloat; + }()); + es.SubpixelFloat = SubpixelFloat; +})(es || (es = {})); +var es; +(function (es) { + var SubpixelVector2 = (function () { + function SubpixelVector2() { + this._x = new es.SubpixelFloat(); + this._y = new es.SubpixelFloat(); + } + SubpixelVector2.prototype.update = function (amount) { + amount.x = this._x.update(amount.x); + amount.y = this._y.update(amount.y); + }; + SubpixelVector2.prototype.reset = function () { + this._x.reset(); + this._y.reset(); + }; + return SubpixelVector2; + }()); + es.SubpixelVector2 = SubpixelVector2; +})(es || (es = {})); +var es; (function (es) { var Vector3 = (function () { function Vector3(x, y, z) { @@ -9441,7 +9505,8 @@ var es; ContentManager.prototype.dispose = function () { this.loadedAssets.forEach(function (value) { var assetsToRemove = value; - assetsToRemove.dispose(); + if (RES.destroyRes(assetsToRemove)) + assetsToRemove.dispose(); }); this.loadedAssets.clear(); }; diff --git a/demo/libs/framework/framework.min.js b/demo/libs/framework/framework.min.js index 590dade7..e962e610 100644 --- a/demo/libs/framework/framework.min.js +++ b/demo/libs/framework/framework.min.js @@ -1 +1 @@ -window.es={},window.__extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var transform,__awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(r,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(s,a)}h((n=n.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]-1}(this,t)},Array.prototype.firstOrDefault=function(t){return function(t,e){var i=t.findIndex(e);return-1==i?null:t[i]}(this,t)},Array.prototype.find=function(t){return function(t,e){return t.firstOrDefault(e)}(this,t)},Array.prototype.where=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(i,n,r){return e.call(arguments[2],n,r,t)&&i.push(n),i},[]);for(var i=[],n=0,r=t.length;n=0&&t.splice(i,1)}while(i>=0)}(this,t)},Array.prototype.remove=function(t){return function(t,e){var i=t.findIndex(function(t){return t===e});return i>=0&&(t.splice(i,1),!0)}(this,t)},Array.prototype.removeAt=function(t){return function(t,e){t.splice(e,1)}(this,t)},Array.prototype.removeRange=function(t,e){return function(t,e,i){t.splice(e,i)}(this,t,e)},Array.prototype.select=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(i,n,r){return i.push(e.call(arguments[2],n,r,t)),i},[]);for(var i=[],n=0,r=t.length;no?1:-1}),t}(this,t,e)},Array.prototype.orderByDescending=function(t,e){return function(t,e,i){return t.sort(function(t,n){var r=e(t),o=e(n);return i?-i(r,o):r0;){if("break"===u())break}return s?this.recontructPath(a,n,r):null},e.recontructPath=function(t,e,i){var n=[],r=i;for(n.push(i);r!=e;)r=this.getKey(t,r),n.push(r);return n.reverse(),n},e.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},e.getKey=function(t,e){for(var i,n,r=t.keys(),o=t.values();i=r.next(),n=o.next(),!i.done;)if(JSON.stringify(i.value)==JSON.stringify(e))return n.value;return null},e}();t.AStarPathfinder=e;var i=function(t){function e(e){var i=t.call(this)||this;return i.data=e,i}return __extends(e,t),e}(t.PriorityQueueNode);t.AStarNode=i}(es||(es={})),function(t){var e=function(){function e(e,i){this.dirs=[new t.Vector2(1,0),new t.Vector2(0,-1),new t.Vector2(-1,0),new t.Vector2(0,1)],this.walls=[],this.weightedNodes=[],this.defaultWeight=1,this.weightedNodeWeight=5,this._neighbors=new Array(4),this._width=e,this._height=i}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x=this._nodes.length?(console.error("node.QueueIndex has been corrupted. Did you change it manually? Or add this node to another queue?"),!1):this._nodes[t.queueIndex]==t:(console.error("node cannot be null"),!1)},t.prototype.enqueue=function(t,e){t.priority=e,this._numNodes++,this._nodes[this._numNodes]=t,t.queueIndex=this._numNodes,t.insertionIndex=this._numNodesEverEnqueued++,this.cascadeUp(this._nodes[this._numNodes])},t.prototype.dequeue=function(){var t=this._nodes[1];return this.remove(t),t},t.prototype.remove=function(t){if(t.queueIndex==this._numNodes)return this._nodes[this._numNodes]=null,void this._numNodes--;var e=this._nodes[this._numNodes];this.swap(t,e),delete this._nodes[this._numNodes],this._numNodes--,this.onNodeUpdated(e)},t.prototype.isValidQueue=function(){for(var t=1;t0&&this.hasHigherPriority(t,i)?this.cascadeUp(t):this.cascadeDown(t)},t.prototype.cascadeDown=function(t){for(var e,i=t.queueIndex;;){e=t;var n=2*i;if(n>this._numNodes){t.queueIndex=i,this._nodes[i]=t;break}var r=this._nodes[n];this.hasHigherPriority(r,e)&&(e=r);var o=n+1;if(o<=this._numNodes){var s=this._nodes[o];this.hasHigherPriority(s,e)&&(e=s)}if(e==t){t.queueIndex=i,this._nodes[i]=t;break}this._nodes[i]=e;var a=e.queueIndex;e.queueIndex=i,i=a}},t.prototype.cascadeUp=function(t){for(var e=Math.floor(t.queueIndex/2);e>=1;){var i=this._nodes[e];if(this.hasHigherPriority(i,t))break;this.swap(t,i),e=Math.floor(t.queueIndex/2)}},t.prototype.swap=function(t,e){this._nodes[t.queueIndex]=e,this._nodes[e.queueIndex]=t;var i=t.queueIndex;t.queueIndex=e.queueIndex,e.queueIndex=i},t.prototype.hasHigherPriority=function(t,e){return t.priority0;){if("break"===h())break}return o?t.AStarPathfinder.recontructPath(a,i,n):null},e.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},e}();t.BreadthFirstPathfinder=e}(es||(es={})),function(t){var e=function(){function t(){this.edges=new Map}return t.prototype.addEdgesForNode=function(t,e){return this.edges.set(t,e),this},t.prototype.getNeighbors=function(t){return this.edges.get(t)},t}();t.UnweightedGraph=e}(es||(es={})),function(t){var e=function(){function e(t,e){this.x=0,this.y=0,this.x=t||0,this.y=null!=e?e:this.x}return Object.defineProperty(e,"zero",{get:function(){return e.zeroVector2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"one",{get:function(){return e.unitVector2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unitX",{get:function(){return e.unitXVector},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unitY",{get:function(){return e.unitYVector},enumerable:!0,configurable:!0}),e.add=function(t,i){var n=new e(0,0);return n.x=t.x+i.x,n.y=t.y+i.y,n},e.divide=function(t,i){var n=new e(0,0);return n.x=t.x/i.x,n.y=t.y/i.y,n},e.multiply=function(t,i){var n=new e(0,0);return n.x=t.x*i.x,n.y=t.y*i.y,n},e.subtract=function(t,i){var n=new e(0,0);return n.x=t.x-i.x,n.y=t.y-i.y,n},e.normalize=function(t){var e=1/Math.sqrt(t.x*t.x+t.y*t.y);return t.x*=e,t.y*=e,t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.distanceSquared=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},e.clamp=function(i,n,r){return new e(t.MathHelper.clamp(i.x,n.x,r.x),t.MathHelper.clamp(i.y,n.y,r.y))},e.lerp=function(i,n,r){return new e(t.MathHelper.lerp(i.x,n.x,r),t.MathHelper.lerp(i.y,n.y,r))},e.transform=function(t,i){return new e(t.x*i.m11+t.y*i.m21+i.m31,t.x*i.m12+t.y*i.m22+i.m32)},e.distance=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},e.angle=function(i,n){return i=e.normalize(i),n=e.normalize(n),Math.acos(t.MathHelper.clamp(e.dot(i,n),-1,1))*t.MathHelper.Rad2Deg},e.negate=function(t){var i=new e;return i.x=-t.x,i.y=-t.y,i},e.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},e.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},e.prototype.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},e.prototype.normalize=function(){var t=1/Math.sqrt(this.x*this.x+this.y*this.y);return this.x*=t,this.y*=t,this},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.prototype.round=function(){return new e(Math.round(this.x),Math.round(this.y))},e.prototype.equals=function(t){return t.x==this.x&&t.y==this.y},e.unitYVector=new e(0,1),e.unitXVector=new e(1,0),e.unitVector2=new e(1,1),e.zeroVector2=new e(0,0),e}();t.Vector2=e}(es||(es={})),function(t){var e=function(){function e(t,i,n){void 0===n&&(n=!1),this.walls=[],this._neighbors=new Array(4),this._width=t,this._hegiht=i,this._dirs=n?e.COMPASS_DIRS:e.CARDINAL_DIRS}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x0;){if("break"===u())break}return s?this.recontructPath(a,n,r):null},i.recontructPath=function(t,e,i){var n=[],r=i;for(n.push(i);r!=e;)r=this.getKey(t,r),n.push(r);return n.reverse(),n},i.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},i.getKey=function(t,e){for(var i,n,r=t.keys(),o=t.values();i=r.next(),n=o.next(),!i.done;)if(JSON.stringify(i.value)==JSON.stringify(e))return n.value;return null},i}();t.WeightedPathfinder=i}(es||(es={})),function(t){var e=function(){function e(){}return e.drawHollowRect=function(e,i,n){void 0===n&&(n=0),this._debugDrawItems.push(new t.DebugDrawItem(e,i,n))},e.render=function(){if(this._debugDrawItems.length>0){var e=new egret.Shape;t.Core.scene&&t.Core.scene.addChild(e);for(var i=this._debugDrawItems.length-1;i>=0;i--){this._debugDrawItems[i].draw(e)&&this._debugDrawItems.removeAt(i)}}},e._debugDrawItems=[],e}();t.Debug=e}(es||(es={})),function(t){var e=function(){function t(){}return t.verletParticle=14431326,t.verletConstraintEdge=4406838,t}();t.DebugDefaults=e}(es||(es={})),function(t){var e;!function(t){t[t.line=0]="line",t[t.hollowRectangle=1]="hollowRectangle",t[t.pixel=2]="pixel",t[t.text=3]="text"}(e=t.DebugDrawType||(t.DebugDrawType={}));var i=function(){function i(t,i,n){this.rectangle=t,this.color=i,this.duration=n,this.drawType=e.hollowRectangle}return i.prototype.draw=function(i){switch(this.drawType){case e.line:case e.hollowRectangle:case e.pixel:case e.text:}return this.duration-=t.Time.deltaTime,this.duration<0},i}();t.DebugDrawItem=i}(es||(es={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.updateInterval=1,e._enabled=!0,e._updateOrder=0,e}return __extends(e,t),Object.defineProperty(e.prototype,"transform",{get:function(){return this.entity.transform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this.entity?this.entity.enabled&&this._enabled:this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateOrder",{get:function(){return this._updateOrder},set:function(t){this.setUpdateOrder(t)},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){},e.prototype.onAddedToEntity=function(){},e.prototype.onRemovedFromEntity=function(){},e.prototype.onEntityTransformChanged=function(t){},e.prototype.debugRender=function(){},e.prototype.onEnabled=function(){},e.prototype.onDisabled=function(){},e.prototype.update=function(){},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled?this.onEnabled():this.onDisabled()),this},e.prototype.setUpdateOrder=function(t){return this._updateOrder!=t&&(this._updateOrder=t),this},e.prototype.clone=function(){var t=ObjectUtils.clone(this);return t.entity=null,t},e}(egret.HashObject);t.Component=e}(es||(es={})),function(t){var e=function(e){function i(){var n=e.call(this)||this;return n._globalManagers=[],i._instance=n,i.emitter=new t.Emitter,i.content=new t.ContentManager,n.addEventListener(egret.Event.ADDED_TO_STAGE,n.onAddToStage,n),n}return __extends(i,e),Object.defineProperty(i,"Instance",{get:function(){return this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(i,"scene",{get:function(){return this._instance?this._instance._scene:null},set:function(t){t?null==this._instance._scene?(this._instance._scene=t,this._instance.addChild(t),this._instance._scene.begin(),i.Instance.onSceneChanged()):this._instance._nextScene=t:console.error("场景不能为空")},enumerable:!0,configurable:!0}),i.startSceneTransition=function(t){if(!this._instance._sceneTransition)return this._instance._sceneTransition=t,t;console.warn("在前一个场景完成之前,不能开始一个新的场景转换。")},i.registerGlobalManager=function(t){this._instance._globalManagers.push(t),t.enabled=!0},i.unregisterGlobalManager=function(t){this._instance._globalManagers.remove(t),t.enabled=!1},i.getGlobalManager=function(t){for(var e=0;e=0;e--)this._globalManagers[e].enabled&&this._globalManagers[e].update();return this._sceneTransition&&(!this._sceneTransition||this._sceneTransition.loadsNewScene&&!this._sceneTransition.isNewSceneLoaded)||this._scene.update(),this._nextScene?(this.removeChild(this._scene),this._scene.end(),this._scene=this._nextScene,this._nextScene=null,this.onSceneChanged(),this.addChild(this._scene),[4,this._scene.begin()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[4,this.draw()];case 3:return i.sent(),[2]}})})},i.prototype.onAddToStage=function(){i.graphicsDevice=new t.GraphicsDevice,this.addEventListener(egret.Event.RESIZE,this.onGraphicsDeviceReset,this),this.addEventListener(egret.StageOrientationEvent.ORIENTATION_CHANGE,this.onOrientationChanged,this),this.addEventListener(egret.Event.ENTER_FRAME,this.update,this),t.Input.initialize(),KeyboardUtils.init(),this.initialize()},i.debugRenderEndabled=!1,i}(egret.DisplayObjectContainer);t.Core=e}(es||(es={})),function(t){!function(t){t[t.GraphicsDeviceReset=0]="GraphicsDeviceReset",t[t.SceneChanged=1]="SceneChanged",t[t.OrientationChanged=2]="OrientationChanged"}(t.CoreEvents||(t.CoreEvents={}))}(es||(es={})),function(t){var e=function(){function e(i){this.updateInterval=1,this._tag=0,this._enabled=!0,this._updateOrder=0,this.components=new t.ComponentList(this),this.transform=new t.Transform(this),this.name=i,this.id=e._idGenerator++,this.componentBits=new t.BitSet}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this._isDestroyed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tag",{get:function(){return this._tag},set:function(t){this.setTag(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateOrder",{get:function(){return this._updateOrder},set:function(t){this.setUpdateOrder(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.transform.parent},set:function(t){this.transform.setParent(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childCount",{get:function(){return this.transform.childCount},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.setPosition(t.x,t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localPosition",{get:function(){return this.transform.localPosition},set:function(t){this.transform.setLocalPosition(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.setRotation(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationDegrees",{get:function(){return this.transform.rotationDegrees},set:function(t){this.transform.setRotationDegrees(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localRotation",{get:function(){return this.transform.localRotation},set:function(t){this.transform.setLocalRotation(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localRotationDegrees",{get:function(){return this.transform.localRotationDegrees},set:function(t){this.transform.setLocalRotationDegrees(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.setScale(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localScale",{get:function(){return this.transform.localScale},set:function(t){this.transform.setLocalScale(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"worldInverseTransform",{get:function(){return this.transform.worldInverseTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localToWorldTransform",{get:function(){return this.transform.localToWorldTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"worldToLocalTransform",{get:function(){return this.transform.worldToLocalTransform},enumerable:!0,configurable:!0}),e.prototype.onTransformChanged=function(t){this.components.onEntityTransformChanged(t)},e.prototype.setTag=function(t){return this._tag!=t&&(this.scene&&this.scene.entities.removeFromTagList(this),this._tag=t,this.scene&&this.scene.entities.addToTagList(this)),this},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled?this.components.onEntityEnabled():this.components.onEntityDisabled()),this},e.prototype.setUpdateOrder=function(t){if(this._updateOrder!=t)return this._updateOrder=t,this.scene&&(this.scene.entities.markEntityListUnsorted(),this.scene.entities.markTagUnsorted(this.tag)),this},e.prototype.destroy=function(){this._isDestroyed=!0,this.scene.entities.remove(this),this.transform.parent=null;for(var t=this.transform.childCount-1;t>=0;t--){this.transform.getChild(t).entity.destroy()}},e.prototype.detachFromScene=function(){this.scene.entities.remove(this),this.components.deregisterAllComponents();for(var t=0;t=0;t--)this._sceneComponents[t].enabled&&this._sceneComponents[t].update();this.entityProcessors&&this.entityProcessors.update(),this.entities.update(),this.entityProcessors&&this.entityProcessors.lateUpdate(),this.renderableComponents.updateList()},i.prototype.render=function(){if(0!=this._renderers.length)for(var t=0;te.x?-1:1,n=t.Vector2.normalize(t.Vector2.subtract(this.position,e));this.rotation=i*Math.acos(t.Vector2.dot(n,t.Vector2.unitY))},n.prototype.setLocalRotation=function(t){return this._localRotation=t,this._localDirty=this._positionDirty=this._localPositionDirty=this._localRotationDirty=this._localScaleDirty=!0,this.setDirty(e.rotationDirty),this},n.prototype.setLocalRotationDegrees=function(e){return this.setLocalRotation(t.MathHelper.toRadians(e))},n.prototype.setScale=function(e){return this._scale=e,this.parent?this.localScale=t.Vector2.divide(e,this.parent._scale):this.localScale=e,this},n.prototype.setLocalScale=function(t){return this._localScale=t,this._localDirty=this._positionDirty=this._localScaleDirty=!0,this.setDirty(e.scaleDirty),this},n.prototype.roundPosition=function(){this.position=this._position.round()},n.prototype.updateTransform=function(){this.hierarchyDirty!=e.clean&&(this.parent&&this.parent.updateTransform(),this._localDirty&&(this._localPositionDirty&&(this._translationMatrix=t.Matrix2D.create().translate(this._localPosition.x,this._localPosition.y),this._localPositionDirty=!1),this._localRotationDirty&&(this._rotationMatrix=t.Matrix2D.create().rotate(this._localRotation),this._localRotationDirty=!1),this._localScaleDirty&&(this._scaleMatrix=t.Matrix2D.create().scale(this._localScale.x,this._localScale.y),this._localScaleDirty=!1),this._localTransform=this._scaleMatrix.multiply(this._rotationMatrix),this._localTransform=this._localTransform.multiply(this._translationMatrix),this.parent||(this._worldTransform=this._localTransform,this._rotation=this._localRotation,this._scale=this._localScale,this._worldInverseDirty=!0),this._localDirty=!1),this.parent&&(this._worldTransform=this._localTransform.multiply(this.parent._worldTransform),this._rotation=this._localRotation+this.parent._rotation,this._scale=t.Vector2.multiply(this.parent._scale,this._localScale),this._worldInverseDirty=!0),this._worldToLocalDirty=!0,this._positionDirty=!0,this.hierarchyDirty=e.clean)},n.prototype.setDirty=function(e){if(0==(this.hierarchyDirty&e)){switch(this.hierarchyDirty|=e,e){case t.DirtyType.positionDirty:this.entity.onTransformChanged(transform.Component.position);break;case t.DirtyType.rotationDirty:this.entity.onTransformChanged(transform.Component.rotation);break;case t.DirtyType.scaleDirty:this.entity.onTransformChanged(transform.Component.scale)}this._children||(this._children=[]);for(var i=0;it&&(this._zoom=t),this._maximumZoom=t,this;console.error("maximumZoom must be greater than zero")},r.prototype.onEntityTransformChanged=function(t){this._areMatrixedDirty=!0},r.prototype.zoomIn=function(t){this.zoom+=t},r.prototype.zoomOut=function(t){this.zoom-=t},r.prototype.worldToScreenPoint=function(e){return this.updateMatrixes(),e=t.Vector2.transform(e,this._transformMatrix)},r.prototype.screenToWorldPoint=function(e){return this.updateMatrixes(),e=t.Vector2.transform(e,this._inverseTransformMatrix)},r.prototype.mouseToWorldPoint=function(){return this.screenToWorldPoint(t.Input.touchPosition)},r.prototype.onAddedToEntity=function(){this.follow(this._targetEntity,this._cameraStyle)},r.prototype.update=function(){var e=t.Vector2.multiply(new t.Vector2(this.bounds.width,this.bounds.height),new t.Vector2(.5));this._worldSpaceDeadZone.x=this.position.x-e.x*t.Core.scene.scaleX+this.deadzone.x+this.focusOffset.x,this._worldSpaceDeadZone.y=this.position.y-e.y*t.Core.scene.scaleY+this.deadzone.y+this.focusOffset.y,this._worldSpaceDeadZone.width=this.deadzone.width,this._worldSpaceDeadZone.height=this.deadzone.height,this._targetEntity&&this.updateFollow(),this.position=t.Vector2.lerp(this.position,t.Vector2.add(this.position,this._desiredPositionDelta),this.followLerp),this.entity.transform.roundPosition(),this.mapLockEnabled&&(this.position=this.clampToMapSize(this.position),this.entity.transform.roundPosition())},r.prototype.clampToMapSize=function(e){var i=t.Vector2.multiply(new t.Vector2(this.bounds.width,this.bounds.height),new t.Vector2(.5)).add(new t.Vector2(this.mapSize.x,this.mapSize.y)),n=new t.Vector2(this.mapSize.width-i.x,this.mapSize.height-i.y);return t.Vector2.clamp(e,i,n)},r.prototype.updateFollow=function(){if(this._desiredPositionDelta.x=this._desiredPositionDelta.y=0,this._cameraStyle==e.lockOn){var i=this._targetEntity.transform.position.x,n=this._targetEntity.transform.position.y;this._worldSpaceDeadZone.x>i?this._desiredPositionDelta.x=i-this._worldSpaceDeadZone.x:this._worldSpaceDeadZone.xn&&(this._desiredPositionDelta.y=n-this._worldSpaceDeadZone.y)}else{if(!this._targetCollider&&(this._targetCollider=this._targetEntity.getComponent(t.Collider),!this._targetCollider))return;var r=this._targetEntity.getComponent(t.Collider).bounds;this._worldSpaceDeadZone.containsRect(r)||(this._worldSpaceDeadZone.left>r.left?this._desiredPositionDelta.x=r.left-this._worldSpaceDeadZone.left:this._worldSpaceDeadZone.rightr.top&&(this._desiredPositionDelta.y=r.top-this._worldSpaceDeadZone.top))}},r.prototype.follow=function(i,n){switch(void 0===n&&(n=e.cameraWindow),this._targetEntity=i,this._cameraStyle=n,this._cameraStyle){case e.cameraWindow:var r=this.bounds.width/6,o=this.bounds.height/3;this.deadzone=new t.Rectangle((this.bounds.width-r)/2,(this.bounds.height-o)/2,r,o);break;case e.lockOn:this.deadzone=new t.Rectangle(this.bounds.width/2,this.bounds.height/2,10,10)}},r.prototype.setCenteredDeadzone=function(e,i){this.deadzone=new t.Rectangle((this.bounds.width-e)/2,(this.bounds.height-i)/2,e,i)},r.prototype.updateMatrixes=function(){var e;this._areMatrixedDirty&&(this._transformMatrix=t.Matrix2D.create().translate(-this.entity.transform.position.x,-this.entity.transform.position.y),1!=this._zoom&&(e=t.Matrix2D.create().scale(this._zoom,this._zoom),this._transformMatrix=this._transformMatrix.multiply(e)),0!=this.entity.transform.rotation&&(e=t.Matrix2D.create().rotate(this.entity.transform.rotation),this._transformMatrix=this._transformMatrix.multiply(e)),e=t.Matrix2D.create().translate(this._origin.x,this._origin.y),this._transformMatrix=this._transformMatrix.multiply(e),this._inverseTransformMatrix=this._transformMatrix.invert(),this._areBoundsDirty=!0,this._areMatrixedDirty=!1)},r}(t.Component);t.Camera=n}(es||(es={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._shakeDirection=t.Vector2.zero,i._shakeOffset=t.Vector2.zero,i._shakeIntensity=0,i._shakeDegredation=.95,i}return __extends(i,e),i.prototype.shake=function(e,i,n){void 0===e&&(e=15),void 0===i&&(i=.9),void 0===n&&(n=t.Vector2.zero),this.enabled=!0,this._shakeIntensity=1)&&(i=.95),this._shakeDegredation=i)},i.prototype.update=function(){Math.abs(this._shakeIntensity)>0&&(this._shakeOffset=this._shakeDirection,0!=this._shakeOffset.x||0!=this._shakeOffset.y?this._shakeOffset.normalize():(this._shakeOffset.x=this._shakeOffset.x+Math.random()-.5,this._shakeOffset.y=this._shakeOffset.y+Math.random()-.5),this._shakeOffset.multiply(new t.Vector2(this._shakeIntensity)),this._shakeIntensity*=-this._shakeDegredation,Math.abs(this._shakeIntensity)<=.01&&(this._shakeIntensity=0,this.enabled=!1)),this.entity.scene.camera.position.add(this._shakeOffset)},i}(t.Component);t.CameraShake=e}(es||(es={})),function(t){var e=function(){function t(t){this._type=t,this._cache=[]}return t.prototype.obtain=function(){try{return this._cache.length>0?this._cache.shift():new this._type}catch(t){throw new Error(this._type+t)}},t.prototype.free=function(t){t.reset(),this._cache.push(t)},t}();t.ComponentPool=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.compare=function(t,e){return t.updateOrder-e.updateOrder},t}();t.IUpdatableComparer=e}(es||(es={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(t.Component);t.PooledComponent=e}(es||(es={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.displayObject=new egret.DisplayObject,i.color=0,i._areBoundsDirty=!0,i._localOffset=t.Vector2.zero,i._renderLayer=0,i._bounds=new t.Rectangle,i}return __extends(i,e),Object.defineProperty(i.prototype,"width",{get:function(){return this.bounds.width},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.bounds.height},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"localOffset",{get:function(){return this._localOffset},set:function(t){this.setLocalOffset(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"renderLayer",{get:function(){return this._renderLayer},set:function(t){this.setRenderLayer(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._areBoundsDirty&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,t.Vector2.zero,this.entity.transform.scale,this.entity.transform.rotation,this.width,this.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!=t&&(this._isVisible=t,this._isVisible?this.onBecameVisible():this.onBecameInvisible())},enumerable:!0,configurable:!0}),i.prototype.onEntityTransformChanged=function(t){this._areBoundsDirty=!0},i.prototype.isVisibleFromCamera=function(t){return!!t&&(this.isVisible=t.bounds.intersects(this.displayObject.getBounds().union(this.bounds)),this.isVisible)},i.prototype.setRenderLayer=function(t){if(t!=this._renderLayer){var e=this._renderLayer;this._renderLayer=t,this.entity&&this.entity.scene&&this.entity.scene.renderableComponents.updateRenderableRenderLayer(this,e,this._renderLayer)}return this},i.prototype.setColor=function(t){return this.color=t,this},i.prototype.setLocalOffset=function(t){return this._localOffset!=t&&(this._localOffset=t),this},i.prototype.sync=function(e){var i=new t.Vector2(this.entity.position.x+this.localOffset.x-e.position.x+e.origin.x,this.entity.position.y+this.localOffset.y-e.position.y+e.origin.y);this.displayObject.x!=i.x&&(this.displayObject.x=i.x),this.displayObject.y!=i.y&&(this.displayObject.y=i.y),this.displayObject.scaleX!=this.entity.scale.x&&(this.displayObject.scaleX=this.entity.scale.x),this.displayObject.scaleY!=this.entity.scale.y&&(this.displayObject.scaleY=this.entity.scale.y),this.displayObject.rotation!=this.entity.rotation&&(this.displayObject.rotation=this.entity.rotation)},i.prototype.toString=function(){return"[RenderableComponent] renderLayer: "+this.renderLayer},i.prototype.onBecameVisible=function(){this.displayObject.visible=this.isVisible},i.prototype.onBecameInvisible=function(){this.displayObject.visible=this.isVisible},i}(t.Component);t.RenderableComponent=e}(es||(es={})),function(t){var e=function(){function e(){this.updateOrder=0,this._enabled=!0}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),e.prototype.onEnabled=function(){},e.prototype.onDisabled=function(){},e.prototype.onRemovedFromScene=function(){},e.prototype.update=function(){},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled),this},e.prototype.setUpdateOrder=function(e){return this.updateOrder!=e&&(this.updateOrder=e,t.Core.scene._sceneComponents.sort(this.compareTo)),this},e.prototype.compareTo=function(t){return this.updateOrder-t.updateOrder},e}();t.SceneComponent=e}(es||(es={})),function(t){var e=egret.Bitmap,i=function(i){function n(e){void 0===e&&(e=null);var n=i.call(this)||this;return e instanceof t.Sprite?n.setSprite(e):e instanceof egret.Texture&&n.setSprite(new t.Sprite(e)),n}return __extends(n,i),Object.defineProperty(n.prototype,"bounds",{get:function(){return this._areBoundsDirty&&this._sprite&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,this._origin,this.entity.transform.scale,this.entity.transform.rotation,this._sprite.sourceRect.width,this._sprite.sourceRect.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"originNormalized",{get:function(){return new t.Vector2(this._origin.x/this.width*this.entity.transform.scale.x,this._origin.y/this.height*this.entity.transform.scale.y)},set:function(e){this.setOrigin(new t.Vector2(e.x*this.width/this.entity.transform.scale.x,e.y*this.height/this.entity.transform.scale.y))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"origin",{get:function(){return this._origin},set:function(t){this.setOrigin(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sprite",{get:function(){return this._sprite},set:function(t){this.setSprite(t)},enumerable:!0,configurable:!0}),n.prototype.setSprite=function(t){return this._sprite=t,this._sprite&&(this._origin=this._sprite.origin,this.displayObject.anchorOffsetX=this._origin.x,this.displayObject.anchorOffsetY=this._origin.y),this.displayObject=new e(t.texture2D),this},n.prototype.setOrigin=function(t){return this._origin!=t&&(this._origin=t,this.displayObject.anchorOffsetX=this._origin.x,this.displayObject.anchorOffsetY=this._origin.y,this._areBoundsDirty=!0),this},n.prototype.setOriginNormalized=function(e){return this.setOrigin(new t.Vector2(e.x*this.width/this.entity.transform.scale.x,e.y*this.height/this.entity.transform.scale.y)),this},n.prototype.render=function(e){this.sync(e);var i=new t.Vector2(this.entity.position.x+this.localOffset.x-e.position.x+e.origin.x,this.entity.position.y+this.localOffset.y-e.position.y+e.origin.y);this.displayObject.x!=i.x&&(this.displayObject.x=i.x),this.displayObject.y!=i.y&&(this.displayObject.y=i.y)},n}(t.RenderableComponent);t.SpriteRenderer=i}(es||(es={})),function(t){var e=egret.Bitmap,i=egret.RenderTexture,n=function(n){function r(e){var i=n.call(this,e)||this;return i._textureScale=t.Vector2.one,i._inverseTexScale=t.Vector2.one,i._gapX=0,i._gapY=0,i._sourceRect=e.sourceRect,i.displayObject.$fillMode=egret.BitmapFillMode.REPEAT,i}return __extends(r,n),Object.defineProperty(r.prototype,"bounds",{get:function(){return this._areBoundsDirty&&this._sprite&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,this._origin,this.entity.transform.scale,this.entity.transform.rotation,this.width,this.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollX",{get:function(){return this._sourceRect.x},set:function(t){this._sourceRect.x=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollY",{get:function(){return this._sourceRect.y},set:function(t){this._sourceRect.y=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"textureScale",{get:function(){return this._textureScale},set:function(e){this._textureScale=e,this._inverseTexScale=new t.Vector2(1/this._textureScale.x,1/this._textureScale.y),this._sourceRect.width=this._sprite.sourceRect.width*this._inverseTexScale.x,this._sourceRect.height=this._sprite.sourceRect.height*this._inverseTexScale.y},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this._sourceRect.width},set:function(t){this._areBoundsDirty=!0,this._sourceRect.width=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this._sourceRect.height},set:function(t){this._areBoundsDirty=!0,this._sourceRect.height=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"gapXY",{get:function(){return new t.Vector2(this._gapX,this._gapY)},set:function(t){this._gapX=t.x,this._gapY=t.y;var n=new i,r=this.sprite.sourceRect;r.x=0,r.y=0,r.width+=this._gapX,r.height+=this._gapY,n.drawToTexture(this.displayObject,r),this.displayObject?this.displayObject.texture=n:this.displayObject=new e(n)},enumerable:!0,configurable:!0}),r.prototype.setGapXY=function(t){return this.gapXY=t,this},r.prototype.render=function(t){n.prototype.render.call(this,t);var e=this.displayObject;e.width=this.width,e.height=this.height,e.scrollRect=this._sourceRect},r}(t.SpriteRenderer);t.TiledSpriteRenderer=n}(es||(es={})),function(t){var e=function(e){function i(t){var i=e.call(this,t)||this;return i.scrollSpeedX=15,i.scroolSpeedY=0,i._scrollX=0,i._scrollY=0,i._scrollWidth=0,i._scrollHeight=0,i._scrollWidth=i.width,i._scrollHeight=i.height,i}return __extends(i,e),Object.defineProperty(i.prototype,"textureScale",{get:function(){return this._textureScale},set:function(e){this._textureScale=e,this._inverseTexScale=new t.Vector2(1/this._textureScale.x,1/this._textureScale.y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollWidth",{get:function(){return this._scrollWidth},set:function(t){this._scrollWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollHeight",{get:function(){return this._scrollHeight},set:function(t){this._scrollHeight=t},enumerable:!0,configurable:!0}),i.prototype.update=function(){this.sprite&&(this._scrollX+=this.scrollSpeedX*t.Time.deltaTime,this._scrollY+=this.scroolSpeedY*t.Time.deltaTime,this._sourceRect.x=this._scrollX,this._sourceRect.y=this._scrollY,this._sourceRect.width=this._scrollWidth+Math.abs(this._scrollX),this._sourceRect.height=this._scrollHeight+Math.abs(this._scrollY))},i}(t.TiledSpriteRenderer);t.ScrollingSpriteRenderer=e}(es||(es={})),function(t){var e=function(){return function(e,i,n){void 0===i&&(i=new t.Rectangle(0,0,e.textureWidth,e.textureHeight)),void 0===n&&(n=i.getHalfSize()),this.uvs=new t.Rectangle,this.texture2D=e,this.sourceRect=i,this.center=new t.Vector2(.5*i.width,.5*i.height),this.origin=n;var r=1/e.textureWidth,o=1/e.textureHeight;this.uvs.x=i.x*r,this.uvs.y=i.y*o,this.uvs.width=i.width*r,this.uvs.height=i.height*o}}();t.Sprite=e}(es||(es={})),function(t){var e=function(){return function(t,e){this.sprites=t,this.frameRate=e}}();t.SpriteAnimation=e}(es||(es={})),function(t){var e,i;!function(t){t[t.loop=0]="loop",t[t.once=1]="once",t[t.clampForever=2]="clampForever",t[t.pingPong=3]="pingPong",t[t.pingPongOnce=4]="pingPongOnce"}(e=t.LoopMode||(t.LoopMode={})),function(t){t[t.none=0]="none",t[t.running=1]="running",t[t.paused=2]="paused",t[t.completed=3]="completed"}(i=t.State||(t.State={}));var n=function(n){function r(t){var e=n.call(this,t)||this;return e.speed=1,e.animationState=i.none,e._elapsedTime=0,e._animations=new Map,e}return __extends(r,n),Object.defineProperty(r.prototype,"isRunning",{get:function(){return this.animationState==i.running},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"animations",{get:function(){return this._animations},enumerable:!0,configurable:!0}),r.prototype.update=function(){if(this.animationState==i.running&&this.currentAnimation){var n=this.currentAnimation,r=1/(n.frameRate*this.speed),o=r*n.sprites.length;this._elapsedTime+=t.Time.deltaTime;var s=Math.abs(this._elapsedTime);if(this._loopMode==e.once&&s>o||this._loopMode==e.pingPongOnce&&s>2*o)return this.animationState=i.completed,this._elapsedTime=0,this.currentFrame=0,void(this.sprite=n.sprites[this.currentFrame]);var a=Math.floor(s/r),h=n.sprites.length;if(h>2&&(this._loopMode==e.pingPong||this._loopMode==e.pingPongOnce)){var c=h-1;this.currentFrame=c-Math.abs(c-a%(2*c))}else this.currentFrame=a%h;this.sprite=n.sprites[this.currentFrame]}},r.prototype.addAnimation=function(t,e){return!this.sprite&&e.sprites.length>0&&this.setSprite(e.sprites[0]),this._animations[t]=e,this},r.prototype.play=function(t,n){void 0===n&&(n=null),this.currentAnimation=this._animations[t],this.currentAnimationName=t,this.currentFrame=0,this.animationState=i.running,this.sprite=this.currentAnimation.sprites[0],this._elapsedTime=0,this._loopMode=n||e.loop},r.prototype.isAnimationActive=function(t){return this.currentAnimation&&this.currentAnimationName==t},r.prototype.pause=function(){this.animationState=i.paused},r.prototype.unPause=function(){this.animationState=i.running},r.prototype.stop=function(){this.currentAnimation=null,this.currentAnimationName=null,this.currentFrame=0,this.animationState=i.none},r}(t.SpriteRenderer);t.SpriteAnimator=n}(es||(es={})),function(t){var e=function(){function t(){}return Object.defineProperty(t.prototype,"hasCollision",{get:function(){return this.below||this.right||this.left||this.above},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.becameGroundedThisFrame=this.isGroundedOnOnewayPlatform=this.right=this.left=this.above=this.below=!1,this.slopAngle=0},t.prototype.toString=function(){return"[CollisionState] r: "+this.right+", l: "+this.left+", a: "+this.above+", b: "+this.below+", angle: "+this.slopAngle+", wasGroundedLastFrame: "+this.wasGroundedLastFrame+", becameGroundedThisFrame: "+this.becameGroundedThisFrame},t}();t.CollisionState=e;var i=function(e){function i(){var t=e.call(this)||this;return t.colliderHorizontalInset=2,t.colliderVerticalInset=6,t}return __extends(i,e),i.prototype.testCollisions=function(e,i,n){this._boxColliderBounds=i,n.wasGroundedLastFrame=n.below,n.reset();var r=e.x;e.y;if(0!=r){var o=r>0?t.Edge.right:t.Edge.left,s=this.collisionRectForSide(o,r);this.testMapCollision(s,o,n,0)?(e.x=0-t.RectangleExt.getSide(i,o),n.left=o==t.Edge.left,n.right=o==t.Edge.right,n._movementRemainderX.reset()):(n.left=!1,n.right=!1)}},i.prototype.testMapCollision=function(e,i,n,r){var o=t.EdgeExt.oppositeEdge(i);t.EdgeExt.isVertical(o)?e.center.x:e.center.y,t.RectangleExt.getSide(e,i),t.EdgeExt.isVertical(o)},i.prototype.collisionRectForSide=function(e,i){var n;return n=t.EdgeExt.isHorizontal(e)?t.RectangleExt.getRectEdgePortion(this._boxColliderBounds,e):t.RectangleExt.getHalfRect(this._boxColliderBounds,e),t.EdgeExt.isVertical(e)?t.RectangleExt.contract(n,this.colliderHorizontalInset,0):t.RectangleExt.contract(n,0,this.colliderVerticalInset),t.RectangleExt.expandSide(n,e,i),n},i}(t.Component);t.TiledMapMover=i}(es||(es={})),function(t){var e=function(e){function i(t,i,n){void 0===i&&(i=null),void 0===n&&(n=!0);var r=e.call(this)||this;return r.physicsLayer=1,r.toContainer=!1,r.tiledMap=t,r._shouldCreateColliders=n,r.displayObject=new egret.DisplayObjectContainer,i&&(r.collisionLayer=t.tileLayers[i]),r}return __extends(i,e),Object.defineProperty(i.prototype,"width",{get:function(){return this.tiledMap.width*this.tiledMap.tileWidth},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.tiledMap.height*this.tiledMap.tileHeight},enumerable:!0,configurable:!0}),i.prototype.setLayerToRender=function(t){this.layerIndicesToRender=[],this.layerIndicesToRender[0]=this.getLayerIndex(t)},i.prototype.setLayersToRender=function(){for(var t=[],e=0;e>6;0!=(e&t.LONG_MASK)&&i++,this._bits=new Array(i)}return t.prototype.and=function(t){for(var e,i=Math.min(this._bits.length,t._bits.length),n=0;n=0;)this._bits[e]&=~t._bits[e]},t.prototype.cardinality=function(){for(var t=0,e=this._bits.length-1;e>=0;e--){var i=this._bits[e];if(0!=i)if(-1!=i){var n=((i=((i=(i>>1&0x5555555555555400)+(0x5555555555555400&i))>>2&0x3333333333333400)+(0x3333333333333400&i))>>32)+i;t+=((n=((n=(n>>4&252645135)+(252645135&n))>>8&16711935)+(16711935&n))>>16&65535)+(65535&n)}else t+=64}return t},t.prototype.clear=function(t){if(null!=t){var e=t>>6;this.ensure(e),this._bits[e]&=~(1<>6;return!(e>=this._bits.length)&&0!=(this._bits[e]&1<=0;)if(0!=(this._bits[e]&t._bits[e]))return!0;return!1},t.prototype.isEmpty=function(){for(var t=this._bits.length-1;t>=0;t--)if(this._bits[t])return!1;return!0},t.prototype.nextSetBit=function(t){for(var e=t>>6,i=1<>6;this.ensure(i),this._bits[i]|=1<=this._bits.length){var e=new Number[t+1];e=this._bits.copyWithin(0,0,this._bits.length),this._bits=e}},t.LONG_MASK=63,t}();t.BitSet=e}(es||(es={})),function(t){var e=function(){function e(t){this._components=[],this._componentsToAdd=[],this._componentsToRemove=[],this._tempBufferList=[],this._entity=t}return Object.defineProperty(e.prototype,"count",{get:function(){return this._components.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._components},enumerable:!0,configurable:!0}),e.prototype.markEntityListUnsorted=function(){this._isComponentListUnsorted=!0},e.prototype.add=function(t){this._componentsToAdd.push(t)},e.prototype.remove=function(t){this._componentsToRemove.contains(t)&&console.warn("You are trying to remove a Component ("+t+") that you already removed"),this._componentsToAdd.contains(t)?this._componentsToAdd.remove(t):this._componentsToRemove.push(t)},e.prototype.removeAllComponents=function(){for(var t=0;t0){for(var i=0;i0){i=0;for(var n=this._componentsToAdd.length;i0){var e=this._entitiesToRemove;this._entitiesToRemove=this._tempEntityList,this._tempEntityList=e,this._tempEntityList.forEach(function(e){t.removeFromTagList(e),t._entities.remove(e),e.onRemovedFromScene(),e.scene=null,t.scene.entityProcessors.onEntityRemoved(e)}),this._tempEntityList.length=0}if(this._entitiesToAdded.length>0){e=this._entitiesToAdded;this._entitiesToAdded=this._tempEntityList,this._tempEntityList=e,this._tempEntityList.forEach(function(e){t._entities.contains(e)||(t._entities.push(e),e.scene=t.scene,t.addToTagList(e),t.scene.entityProcessors.onEntityAdded(e))}),this._tempEntityList.forEach(function(t){return t.onAddedToScene()}),this._tempEntityList.length=0,this._isEntityListUnsorted=!0}this._isEntityListUnsorted&&(this._entities.sort(),this._isEntityListUnsorted=!1),this._unsortedTags.length>0&&(this._unsortedTags.forEach(function(e){t._entityDict.get(e).sort()}),this._unsortedTags.length=0)},e.prototype.findEntity=function(t){for(var e=0;e=0;e=this.allSet.nextSetBit(e+1))if(!t.componentBits.get(e))return!1;return!(!this.exclusionSet.isEmpty()&&this.exclusionSet.intersects(t.componentBits))&&!(!this.oneSet.isEmpty()&&!this.oneSet.intersects(t.componentBits))},e.prototype.all=function(){for(var e=this,i=[],n=0;n0){for(var t=0,i=this._unsortedRenderLayers.length;t=e)return t;var n=!1;"-"==t.substr(0,1)&&(n=!0,t=t.substr(1));for(var r=e-i,o=0;o1?this.reverse(t.substring(1))+t.substring(0,1):t},t.cutOff=function(t,e,i,n){void 0===n&&(n=!0),e=Math.floor(e),i=Math.floor(i);var r=t.length;e>r&&(e=r);var o,s=e,a=e+i;return n?o=t.substring(0,s)+t.substr(a,r):(a=(s=r-1-e-i)+i,o=t.substring(0,s+1)+t.substr(a+1,r)),o},t.strReplace=function(t,e){for(var i=0,n=e.length;i",">",'"',""","'","'","®","®","©","©","™","™"],t}();!function(t){var e=function(){function e(){}return e.convertImageToCanvas=function(e,i){this.sharedCanvas||(this.sharedCanvas=egret.sys.createCanvas(),this.sharedContext=this.sharedCanvas.getContext("2d"));var n=e.$getTextureWidth(),r=e.$getTextureHeight();i||((i=egret.$TempRectangle).x=0,i.y=0,i.width=n,i.height=r),i.x=Math.min(i.x,n-1),i.y=Math.min(i.y,r-1),i.width=Math.min(i.width,n-i.x),i.height=Math.min(i.height,r-i.y);var o=Math.floor(i.width),s=Math.floor(i.height),a=this.sharedCanvas;if(a.style.width=o+"px",a.style.height=s+"px",this.sharedCanvas.width=o,this.sharedCanvas.height=s,"webgl"==egret.Capabilities.renderMode){var h=void 0;e.$renderBuffer?h=e:(egret.sys.systemRenderer.renderClear&&egret.sys.systemRenderer.renderClear(),(h=new egret.RenderTexture).drawToTexture(new egret.Bitmap(e)));for(var c=h.$renderBuffer.getPixels(i.x,i.y,o,s),u=0,l=0,p=0;p=0?"png":"jpg"});return wx.getFileSystemManager().saveFile({tempFilePath:o,filePath:wx.env.USER_DATA_PATH+"/"+i,success:function(t){}}),o},e.getPixel32=function(t,e,i){return egret.$warn(1041,"getPixel32","getPixels"),t.getPixels(e,i)},e.getPixels=function(t,e,i,n,r){if(void 0===n&&(n=1),void 0===r&&(r=1),"webgl"==egret.Capabilities.renderMode){var o=void 0;return t.$renderBuffer?o=t:(o=new egret.RenderTexture).drawToTexture(new egret.Bitmap(t)),o.$renderBuffer.getPixels(e,i,n,r)}try{this.convertImageToCanvas(t);return this.sharedContext.getImageData(e,i,n,r).data}catch(t){egret.$error(1039)}},e}();t.TextureUtils=e}(es||(es={})),function(t){var e=function(){function t(){}return t.update=function(t){var e=(t-this._lastTime)/1e3;this.deltaTime=e*this.timeScale,this.unscaledDeltaTime=e,this._timeSinceSceneLoad+=e,this.frameCount++,this._lastTime=t},t.sceneChanged=function(){this._timeSinceSceneLoad=0},t.checkEvery=function(t){return this._timeSinceSceneLoad/t>(this._timeSinceSceneLoad-this.deltaTime)/t},t.deltaTime=0,t.timeScale=1,t.frameCount=0,t._lastTime=0,t}();t.Time=e}(es||(es={}));var TimeUtils=function(){function t(){}return t.monthId=function(t){void 0===t&&(t=null);var e=(t=t||new Date).getFullYear(),i=t.getMonth()+1;return parseInt(e+(i<10?"0":"")+i)},t.dateId=function(t){void 0===t&&(t=null);var e=(t=t||new Date).getMonth()+1,i=e<10?"0":"",n=t.getDate(),r=n<10?"0":"";return parseInt(t.getFullYear()+i+e+r+n)},t.weekId=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!0),t=t||new Date;var i=new Date;i.setTime(t.getTime()),i.setDate(1),i.setMonth(0);var n=i.getFullYear(),r=i.getDay();0==r&&(r=7);var o=!1;r<=4?(o=r>1,i.setDate(i.getDate()-(r-1))):i.setDate(i.getDate()+7-r+1);var s=this.diffDay(t,i,!1);if(s<0)return i.setDate(1),i.setMonth(0),i.setDate(i.getDate()-1),this.weekId(i,!1);var a=s/7,h=Math.floor(a)+1;if(53==h){i.setTime(t.getTime()),i.setDate(i.getDate()-1);var c=i.getDay();if(0==c&&(c=7),e&&(!o||c<4))return i.setFullYear(i.getFullYear()+1),i.setDate(1),i.setMonth(0),this.weekId(i,!1)}return parseInt(n+"00"+(h>9?"":"0")+h)},t.diffDay=function(t,e,i){void 0===i&&(i=!1);var n=(t.getTime()-e.getTime())/864e5;return i?Math.ceil(n):Math.floor(n)},t.getFirstDayOfWeek=function(t){var e=(t=t||new Date).getDay()||7;return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1-e,0,0,0,0)},t.getFirstOfDay=function(t){return(t=t||new Date).setHours(0,0,0,0),t},t.getNextFirstOfDay=function(t){return new Date(this.getFirstOfDay(t).getTime()+864e5)},t.formatDate=function(t){var e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();return e+"-"+i+"-"+(n=n<10?"0"+n:n)},t.formatDateTime=function(t){var e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();n=n<10?"0"+n:n;var r=t.getHours(),o=t.getMinutes();o=o<10?"0"+o:o;var s=t.getSeconds();return e+"-"+i+"-"+n+" "+r+":"+o+":"+(s=s<10?"0"+s:s)},t.parseDate=function(t){var e=Date.parse(t);return isNaN(e)?new Date:new Date(Date.parse(t.replace(/-/g,"/")))},t.secondToTime=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=":"),void 0===i&&(i=!0);var n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=Math.floor(t%3600%60),s=n.toString(),a=r.toString(),h=o.toString();return n<10&&(s="0"+s),r<10&&(a="0"+a),o<10&&(h="0"+h),i?s+e+a+e+h:a+e+h},t.timeToMillisecond=function(t,e){void 0===e&&(e=":");for(var i=t.split(e),n=0,r=i.length,o=0;o-1?this.os="iOS":n.indexOf("android")>-1&&(this.os="Android");var r=i.language;r=r.indexOf("zh")>-1?"zh-CN":"en-US",this.language=r}},e}(egret.Capabilities);t.GraphicsCapabilities=e}(es||(es={})),function(t){var e=function(){function e(){this.setup(),this.graphicsCapabilities=new t.GraphicsCapabilities,this.graphicsCapabilities.initialize(this)}return Object.defineProperty(e.prototype,"viewport",{get:function(){return this._viewport},enumerable:!0,configurable:!0}),e.prototype.setup=function(){this._viewport=new t.Viewport(0,0,t.Core._instance.stage.stageWidth,t.Core._instance.stage.stageHeight)},e}();t.GraphicsDevice=e}(es||(es={})),function(t){var e=function(){function e(t,e,i,n){this._x=t,this._y=e,this._width=i,this._height=n,this._minDepth=0,this._maxDepth=1}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatio",{get:function(){return 0!=this._height&&0!=this._width?this._width/this._height:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){return new t.Rectangle(this._x,this._y,this._width,this._height)},set:function(t){this._x=t.x,this._y=t.y,this._width=t.width,this._height=t.height},enumerable:!0,configurable:!0}),e}();t.Viewport=e}(es||(es={})),function(t){var e=function(e){function i(){return e.call(this,t.PostProcessor.default_vert,i.blur_frag,{screenWidth:t.Core.graphicsDevice.viewport.width,screenHeight:t.Core.graphicsDevice.viewport.height})||this}return __extends(i,e),i.blur_frag="precision mediump float;\nuniform sampler2D uSampler;\nuniform float screenWidth;\nuniform float screenHeight;\nfloat normpdf(in float x, in float sigma)\n{\nreturn 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;\n}\nvoid main()\n{\nvec3 c = texture2D(uSampler, gl_FragCoord.xy / vec2(screenWidth, screenHeight).xy).rgb;\nconst int mSize = 11;\nconst int kSize = (mSize - 1)/2;\nfloat kernel[mSize];\nvec3 final_colour = vec3(0.0);\nfloat sigma = 7.0;\nfloat z = 0.0;\nfor (int j = 0; j <= kSize; ++j)\n{\nkernel[kSize+j] = kernel[kSize-j] = normpdf(float(j),sigma);\n}\nfor (int j = 0; j < mSize; ++j)\n{\nz += kernel[j];\n}\nfor (int i = -kSize; i <= kSize; ++i)\n{\nfor (int j = -kSize; j <= kSize; ++j)\n{\nfinal_colour += kernel[kSize+j]*kernel[kSize+i]*texture2D(uSampler, (gl_FragCoord.xy+vec2(float(i),float(j))) / vec2(screenWidth, screenHeight).xy).rgb;\n}\n}\ngl_FragColor = vec4(final_colour/(z*z), 1.0);\n}",i}(egret.CustomFilter);t.GaussianBlurEffect=e}(es||(es={})),function(t){var e=function(t){function e(){return t.call(this,e.vertSrc,e.fragmentSrc)||this}return __extends(e,t),e.vertSrc="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\n gl_Position = vec4( (aVertexPosition / projectionVector) + center , 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e.fragmentSrc="precision lowp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n#define SAMPLE_COUNT 15\nuniform vec2 _sampleOffsets[SAMPLE_COUNT];\nuniform float _sampleWeights[SAMPLE_COUNT];\nvoid main(void) {\nvec4 c = vec4(0, 0, 0, 0);\nfor( int i = 0; i < SAMPLE_COUNT; i++ )\n c += texture2D( uSampler, vTextureCoord + _sampleOffsets[i] ) * _sampleWeights[i];\ngl_FragColor = c;\n}",e}(egret.CustomFilter);t.PolygonLightEffect=e}(es||(es={})),function(t){var e=function(){function e(t){void 0===t&&(t=null),this.enabled=!0,this.effect=t}return e.prototype.onAddedToScene=function(e){this.scene=e,this.shape=new egret.Shape,this.shape.graphics.beginFill(16777215,1),this.shape.graphics.drawRect(0,0,t.Core.graphicsDevice.viewport.width,t.Core.graphicsDevice.viewport.height),this.shape.graphics.endFill(),e.addChild(this.shape)},e.prototype.process=function(){this.drawFullscreenQuad()},e.prototype.onSceneBackBufferSizeChanged=function(t,e){},e.prototype.unload=function(){this.effect&&(this.effect=null),this.scene.removeChild(this.shape),this.scene=null},e.prototype.drawFullscreenQuad=function(){this.scene.filters=[this.effect]},e.default_vert="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aColor;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\ngl_Position = vec4( (aVertexPosition / projectionVector) + center , 0.0, 1.0);\nvTextureCoord = aTextureCoord;\nvColor = vec4(aColor.x, aColor.x, aColor.x, aColor.x);\n}",e}();t.PostProcessor=e}(es||(es={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return __extends(i,e),i.prototype.onAddedToScene=function(i){e.prototype.onAddedToScene.call(this,i),this.effect=new t.GaussianBlurEffect},i}(t.PostProcessor);t.GaussianBlurPostProcessor=e}(es||(es={})),function(t){var e=function(){function t(t,e){void 0===e&&(e=null),this.renderOrder=0,this.shouldDebugRender=!0,this.camera=e,this.renderOrder=t}return Object.defineProperty(t.prototype,"wantsToRenderToSceneRenderTarget",{get:function(){return!!this.renderTexture},enumerable:!0,configurable:!0}),t.prototype.onAddedToScene=function(t){},t.prototype.unload=function(){},t.prototype.onSceneBackBufferSizeChanged=function(t,e){},t.prototype.compareTo=function(t){return this.renderOrder-t.renderOrder},t.prototype.beginRender=function(t){},t.prototype.renderAfterStateCheck=function(t,e){t.render(e)},t.prototype.debugRender=function(t,e){for(var i=0;ii?i:t},e.pointOnCirlce=function(i,n,r){var o=e.toRadians(r);return new t.Vector2(Math.cos(o)*o+i.x,Math.sin(o)*o+i.y)},e.isEven=function(t){return t%2==0},e.clamp01=function(t){return t<0?0:t>1?1:t},e.angleBetweenVectors=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},e.incrementWithWrap=function(t,e){return++t==e?0:t},e.approach=function(t,e,i){return tn&&(n=s.x),s.yr&&(r=s.y)}return this.fromMinMax(e,i,n,r)},i.prototype.intersects=function(t){return t.leftthis.x+this.width)return e}else{var n=1/t.direction.x,r=(this.x-t.start.x)*n,o=(this.x+this.width-t.start.x)*n;if(r>o){var s=r;r=o,o=s}if((e=Math.max(r,e))>(i=Math.min(o,i)))return e}if(Math.abs(t.direction.y)<1e-6){if(t.start.ythis.y+this.height)return e}else{var a=1/t.direction.y,h=(this.y-t.start.y)*a,c=(this.y+this.height-t.start.y)*a;if(h>c){var u=h;h=c,c=u}if((e=Math.max(h,e))>(i=Math.max(c,i)))return e}return e},i.prototype.containsRect=function(t){return this.x<=t.x&&t.x1)return!1;var u=(h.x*o.y-h.y*o.x)/a;return!(u<0||u>1)},i.lineToLineIntersection=function(e,i,n,r){var o=new t.Vector2(0,0),s=t.Vector2.subtract(i,e),a=t.Vector2.subtract(r,n),h=s.x*a.y-s.y*a.x;if(0==h)return o;var c=t.Vector2.subtract(n,e),u=(c.x*a.y-c.y*a.x)/h;if(u<0||u>1)return o;var l=(c.x*s.y-c.y*s.x)/h;return l<0||l>1?o:o=t.Vector2.add(e,new t.Vector2(u*s.x,u*s.y))},i.closestPointOnLine=function(e,i,n){var r=t.Vector2.subtract(i,e),o=t.Vector2.subtract(n,e),s=t.Vector2.dot(o,r)/t.Vector2.dot(r,r);return s=t.MathHelper.clamp(s,0,1),t.Vector2.add(e,new t.Vector2(r.x*s,r.y*s))},i.isCircleToCircle=function(e,i,n,r){return t.Vector2.distanceSquared(e,n)<(i+r)*(i+r)},i.isCircleToLine=function(e,i,n,r){return t.Vector2.distanceSquared(e,this.closestPointOnLine(n,r,e))=t&&r.y>=e&&r.x=t+n&&(s|=e.right),o.y=i+r&&(s|=e.bottom),s},i}();t.Collisions=i}(es||(es={})),function(t){var e=function(){function e(e,i,n,r,o){this.fraction=0,this.distance=0,this.point=t.Vector2.zero,this.normal=t.Vector2.zero,this.collider=e,this.fraction=i,this.distance=n,this.point=r,this.centroid=t.Vector2.zero}return e.prototype.setValues=function(t,e,i,n){this.collider=t,this.fraction=e,this.distance=i,this.point=n},e.prototype.setValuesNonCollider=function(t,e,i,n){this.fraction=t,this.distance=e,this.point=i,this.normal=n},e.prototype.reset=function(){this.collider=null,this.fraction=this.distance=0},e.prototype.toString=function(){return"[RaycastHit] fraction: "+this.fraction+", distance: "+this.distance+", normal: "+this.normal+", centroid: "+this.centroid+", point: "+this.point},e}();t.RaycastHit=e}(es||(es={})),function(t){var e=function(){function e(){}return e.reset=function(){this._spatialHash=new t.SpatialHash(this.spatialHashCellSize)},e.clear=function(){this._spatialHash.clear()},e.overlapCircleAll=function(t,e,i,n){if(void 0===n&&(n=-1),0!=i.length)return this._spatialHash.overlapCircle(t,e,i,n);console.error("An empty results array was passed in. No results will ever be returned.")},e.boxcastBroadphase=function(t,e){return void 0===e&&(e=this.allLayers),this._spatialHash.aabbBroadphase(t,null,e)},e.boxcastBroadphaseExcludingSelf=function(t,e,i){return void 0===i&&(i=this.allLayers),this._spatialHash.aabbBroadphase(e,t,i)},e.addCollider=function(t){e._spatialHash.register(t)},e.removeCollider=function(t){e._spatialHash.remove(t)},e.updateCollider=function(t){this._spatialHash.remove(t),this._spatialHash.register(t)},e.linecast=function(t,i,n){return void 0===n&&(n=e.allLayers),this._hitArray[0].reset(),this.linecastAll(t,i,this._hitArray,n),this._hitArray[0]},e.linecastAll=function(t,i,n,r){return void 0===r&&(r=e.allLayers),0==n.length?(console.warn("传入了一个空的hits数组。没有点击会被返回"),0):this._spatialHash.linecast(t,i,n,r)},e.debugDraw=function(t){this._spatialHash.debugDraw(t,2)},e.spatialHashCellSize=100,e.allLayers=-1,e.raycastsHitTriggers=!1,e.raycastsStartInColliders=!1,e._hitArray=[new t.RaycastHit],e}();t.Physics=e}(es||(es={})),function(t){var e=function(){return function(e,i){this.start=e,this.end=i,this.direction=t.Vector2.subtract(this.end,this.start)}}();t.Ray2D=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.clone=function(){return ObjectUtils.clone(this)},t}();t.Shape=e}(es||(es={})),function(t){var e=function(e){function i(t,i){var n=e.call(this)||this;return n._areEdgeNormalsDirty=!0,n.isUnrotated=!0,n.setPoints(t),n.isBox=i,n}return __extends(i,e),Object.defineProperty(i.prototype,"edgeNormals",{get:function(){return this._areEdgeNormalsDirty&&this.buildEdgeNormals(),this._edgeNormals},enumerable:!0,configurable:!0}),i.prototype.setPoints=function(t){this.points=t,this.recalculateCenterAndEdgeNormals(),this._originalPoints=[];for(var e=0;e=this.points.length?this.points[0]:this.points[n+1];var o=t.Vector2Ext.perpendicular(r,e);o=t.Vector2.normalize(o),this._edgeNormals[n]=o}},i.buildSymmetricalPolygon=function(e,i){for(var n=new Array(e),r=0;rr&&(r=s,n=o)}return e[n]},i.getClosestPointOnPolygonToPoint=function(e,i,n,r){n=Number.MAX_VALUE,r=new t.Vector2(0,0);for(var o,s=new t.Vector2(0,0),a=0;ae.y!=this.points[r].y>e.y&&e.x<(this.points[r].x-this.points[n].x)*(e.y-this.points[n].y)/(this.points[r].y-this.points[n].y)+this.points[n].x&&(i=!i);return i},i.prototype.pointCollidesWithShape=function(e,i){return t.ShapeCollisions.pointToPoly(e,this,i)},i}(t.Shape);t.Polygon=e}(es||(es={})),function(t){var e=function(e){function i(t,n){var r=e.call(this,i.buildBox(t,n),!0)||this;return r.width=t,r.height=n,r}return __extends(i,e),i.buildBox=function(e,i){var n=e/2,r=i/2,o=new Array(4);return o[0]=new t.Vector2(-n,-r),o[1]=new t.Vector2(n,-r),o[2]=new t.Vector2(n,r),o[3]=new t.Vector2(-n,r),o},i.prototype.updateBox=function(e,i){this.width=e,this.height=i;var n=e/2,r=i/2;this.points[0]=new t.Vector2(-n,-r),this.points[1]=new t.Vector2(n,-r),this.points[2]=new t.Vector2(n,r),this.points[3]=new t.Vector2(-n,r);for(var o=0;o1)return s;var a,h=t.Vector2.add(o.start,t.Vector2.add(o.direction,new t.Vector2(s))),c=0;h.xi.bounds.right&&(c|=1),h.yi.bounds.bottom&&(c|=2);var u=a+c;return 3==u&&console.log("m == 3. corner "+t.Time.frameCount),s},e}();t.RealtimeCollisions=e}(es||(es={})),function(t){var e=function(){function e(){}return e.polygonToPolygon=function(e,i,n){for(var r,o=!0,s=e.edgeNormals,a=i.edgeNormals,h=Number.POSITIVE_INFINITY,c=new t.Vector2,u=t.Vector2.subtract(e.position,i.position),l=0;l0&&(o=!1),!o)return!1;(m=Math.abs(m))r&&(r=o);return{min:n,max:r}},e.circleToPolygon=function(e,i,n){var r,o=t.Vector2.subtract(e.position,i.position),s=t.Polygon.getClosestPointOnPolygonToPoint(i.points,o,0,n.normal),a=i.containsPoint(e.position);if(0>e.radius*e.radius&&!a)return!1;a?r=t.Vector2.multiply(n.normal,new t.Vector2(Math.sqrt(0)-e.radius)):r=t.Vector2.multiply(n.normal,new t.Vector2(e.radius));return n.minimumTranslationVector=r,n.point=t.Vector2.add(s,i.position),!0},e.circleToBox=function(e,i,n){var r=i.bounds.getClosestPointOnRectangleBorderToPoint(e.position,n.normal);if(i.containsPoint(e.position)){n.point=r;var o=t.Vector2.add(r,t.Vector2.multiply(n.normal,new t.Vector2(e.radius)));return n.minimumTranslationVector=t.Vector2.subtract(e.position,o),!0}var s=t.Vector2.distanceSquared(r,e.position);if(0==s)n.minimumTranslationVector=t.Vector2.multiply(n.normal,new t.Vector2(e.radius));else if(s<=e.radius*e.radius){n.normal=t.Vector2.subtract(e.position,r);var a=n.normal.length()-e.radius;return n.point=r,n.normal=t.Vector2Ext.normalize(n.normal),n.minimumTranslationVector=t.Vector2.multiply(new t.Vector2(a),n.normal),!0}return!1},e.pointToCircle=function(e,i,n){var r=t.Vector2.distanceSquared(e,i.position),o=1+i.radius;if(r1)return!1;var l=(c.x*s.y-c.y*s.x)/h;return!(l<0||l>1)&&(o=o.add(e).add(t.Vector2.multiply(new t.Vector2(u),s)),!0)},e.lineToCircle=function(e,i,n,r){var o=t.Vector2.distance(e,i),s=t.Vector2.divide(t.Vector2.subtract(i,e),new t.Vector2(o)),a=t.Vector2.subtract(e,n.position),h=t.Vector2.dot(a,s),c=t.Vector2.dot(a,a)-n.radius*n.radius;if(c>0&&h>0)return!1;var u=h*h-c;return!(u<0)&&(r.fraction=-h-Math.sqrt(u),r.fraction<0&&(r.fraction=0),r.point=t.Vector2.add(e,t.Vector2.multiply(new t.Vector2(r.fraction),s)),r.distance=t.Vector2.distance(e,r.point),r.normal=t.Vector2.normalize(t.Vector2.subtract(r.point,n.position)),r.fraction=r.distance/o,!0)},e.boxToBoxCast=function(e,i,n,r){var o=this.minkowskiDifference(e,i);if(o.contains(0,0)){var s=o.getClosestPointOnBoundsToOrigin();return!s.equals(t.Vector2.zero)&&(r.normal=new t.Vector2(-s.x),r.normal=r.normal.normalize(),r.distance=0,r.fraction=0,!0)}var a=new t.Ray2D(t.Vector2.zero,new t.Vector2(-n.x)),h=o.rayIntersects(a);return h<=1&&(r.fraction=h,r.distance=n.length()*h,r.normal=new t.Vector2(-n.x),r.normal=r.normal.normalize(),r.centroid=t.Vector2.add(e.bounds.center,t.Vector2.multiply(n,new t.Vector2(h))),!0)},e}();t.ShapeCollisions=e}(es||(es={})),function(t){var e=function(){function e(e){void 0===e&&(e=100),this.gridBounds=new t.Rectangle,this._overlapTestCircle=new t.Circle(0),this._cellDict=new i,this._tempHashSet=[],this._cellSize=e,this._inverseCellSize=1/this._cellSize,this._raycastParser=new n}return e.prototype.register=function(e){var i=e.bounds;e.registeredPhysicsBounds=i;var n=this.cellCoords(i.x,i.y),r=this.cellCoords(i.right,i.bottom);this.gridBounds.contains(n.x,n.y)||(this.gridBounds=t.RectangleExt.union(this.gridBounds,n)),this.gridBounds.contains(r.x,r.y)||(this.gridBounds=t.RectangleExt.union(this.gridBounds,r));for(var o=n.x;o<=r.x;o++)for(var s=n.y;s<=r.y;s++){var a=this.cellAtPosition(o,s,!0);a.firstOrDefault(function(t){return t.hashCode==e.hashCode})||a.push(e)}},e.prototype.remove=function(t){for(var e=t.registeredPhysicsBounds,i=this.cellCoords(e.x,e.y),n=this.cellCoords(e.right,e.bottom),r=i.x;r<=n.x;r++)for(var o=i.y;o<=n.y;o++){var s=this.cellAtPosition(r,o);s?s.remove(t):console.log("从不存在碰撞器的单元格中移除碰撞器: ["+t+"]")}},e.prototype.removeWithBruteForce=function(t){this._cellDict.remove(t)},e.prototype.clear=function(){this._cellDict.clear()},e.prototype.debugDraw=function(t,e){void 0===e&&(e=1);for(var i=this.gridBounds.x;i<=this.gridBounds.right;i++)for(var n=this.gridBounds.y;n<=this.gridBounds.bottom;n++){var r=this.cellAtPosition(i,n);r&&r.length>0&&this.debugDrawCellDetails(i,n,r.length,t,e)}},e.prototype.aabbBroadphase=function(e,i,n){this._tempHashSet.length=0;for(var r=this.cellCoords(e.x,e.y),o=this.cellCoords(e.right,e.bottom),s=r.x;s<=o.x;s++)for(var a=r.y;a<=o.y;a++){var h=this.cellAtPosition(s,a);if(h)for(var c=function(r){var o=h[r];if(o==i||!t.Flags.isFlagSet(n,o.physicsLayer))return"continue";e.intersects(o.bounds)&&(u._tempHashSet.firstOrDefault(function(t){return t.hashCode==o.hashCode})||u._tempHashSet.push(o))},u=this,l=0;l=0&&(e.push(this.findBoundsRect(i,o,r,t)),i=-1)}i>=0&&(e.push(this.findBoundsRect(i,this.map.width,r,t)),i=-1)}return e},e.prototype.findBoundsRect=function(e,i,n,r){for(var o=-1,s=n+1;sthis.tileHeight||this.maxTileWidth>this.tileWidth},enumerable:!0,configurable:!0}),i.prototype.getTilesetForTileGid=function(t){if(0==t)return null;for(var e=this.tilesets.length-1;e>=0;e--)if(this.tilesets[e].firstGid<=t)return this.tilesets[e];console.error("tile gid"+t+"未在任何tileset中找到")},i.prototype.worldToTilePositionX=function(e,i){void 0===i&&(i=!0);var n=Math.floor(e/this.tileWidth);return i?t.MathHelper.clamp(n,0,this.width-1):n},i.prototype.worldToTilePositionY=function(e,i){void 0===i&&(i=!0);var n=Math.floor(e/this.tileHeight);return i?t.MathHelper.clamp(n,0,this.height-1):n},i.prototype.getLayer=function(t){return this.layers[t]},i.prototype.update=function(){this.tilesets.forEach(function(t){t.update()})},i.prototype.dispose=function(t){void 0===t&&(t=!0),this._isDisposed||(t&&(this.tilesets.forEach(function(t){t.image&&t.image.dispose()}),this.imageLayers.forEach(function(t){t.image&&t.image.dispose()})),this._isDisposed=!0)},i}(t.TmxDocument);t.TmxMap=e,function(t){t[t.unknown=0]="unknown",t[t.orthogonal=1]="orthogonal",t[t.isometric=2]="isometric",t[t.staggered=3]="staggered",t[t.hexagonal=4]="hexagonal"}(t.OrientationType||(t.OrientationType={})),function(t){t[t.x=0]="x",t[t.y=1]="y"}(t.StaggerAxisType||(t.StaggerAxisType={})),function(t){t[t.odd=0]="odd",t[t.even=1]="even"}(t.StaggerIndexType||(t.StaggerIndexType={})),function(t){t[t.rightDown=0]="rightDown",t[t.rightUp=1]="rightUp",t[t.leftDown=2]="leftDown",t[t.leftUp=3]="leftUp"}(t.RenderOrderType||(t.RenderOrderType={}))}(es||(es={})),function(t){var e=function(){return function(){}}();t.TmxObjectGroup=e;var i=function(){return function(){this.shape=new egret.Shape,this.textField=new egret.TextField}}();t.TmxObject=i;var n=function(){return function(){}}();t.TmxText=n;var r=function(){return function(){}}();t.TmxAlignment=r,function(t){t[t.basic=0]="basic",t[t.point=1]="point",t[t.tile=2]="tile",t[t.ellipse=3]="ellipse",t[t.polygon=4]="polygon",t[t.polyline=5]="polyline",t[t.text=6]="text"}(t.TmxObjectType||(t.TmxObjectType={})),function(t){t[t.unkownOrder=-1]="unkownOrder",t[t.TopDown=0]="TopDown",t[t.IndexOrder=1]="IndexOrder"}(t.DrawOrderType||(t.DrawOrderType={})),function(t){t[t.left=0]="left",t[t.center=1]="center",t[t.right=2]="right",t[t.justify=3]="justify"}(t.TmxHorizontalAlignment||(t.TmxHorizontalAlignment={})),function(t){t[t.top=0]="top",t[t.center=1]="center",t[t.bottom=2]="bottom"}(t.TmxVerticalAlignment||(t.TmxVerticalAlignment={}))}(es||(es={})),function(t){var e=function(){function e(){}return e.loadTmxMap=function(t,e){var i=RES.getRes(e);return this.loadTmxMapData(t,i)},e.loadTmxMapData=function(e,i){return __awaiter(this,void 0,void 0,function(){var n,r,o,s;return __generator(this,function(a){switch(a.label){case 0:e.version=i.version,e.tiledVersion=i.tiledversion,e.width=i.width,e.height=i.height,e.tileWidth=i.tilewidth,e.tileHeight=i.tileheight,e.hexSideLength=i.hexsidelength,e.orientation=this.parseOrientationType(i.orientation),e.staggerAxis=this.parseStaggerAxisType(i.staggeraxis),e.staggerIndex=this.parseStaggerIndexType(i.staggerindex),e.renderOrder=this.parseRenderOrderType(i.renderorder),e.nextObjectID=i.nextobjectid,e.backgroundColor=t.TmxUtils.color16ToUnit(i.color),e.properties=this.parsePropertyDict(i.properties),e.maxTileWidth=e.tileWidth,e.maxTileHeight=e.tileHeight,e.tilesets=[],n=0,r=i.tilesets,a.label=1;case 1:return nt.map.maxTileWidth&&(t.map.maxTileWidth=e.image.width),e.image.height>t.map.maxTileHeight&&(t.map.maxTileHeight=e.image.height))}),t.tileRegions.forEach(function(e){var i=e.width,n=e.height;i>t.map.maxTileWidth&&(t.map.maxTileWidth=i),i>t.map.maxTileHeight&&(t.map.maxTileHeight=n)})},e.parseOrientationType=function(e){return"unknown"==e?t.OrientationType.unknown:"orthogonal"==e?t.OrientationType.orthogonal:"isometric"==e?t.OrientationType.isometric:"staggered"==e?t.OrientationType.staggered:"hexagonal"==e?t.OrientationType.hexagonal:t.OrientationType.unknown},e.parseStaggerAxisType=function(e){return"y"==e?t.StaggerAxisType.y:t.StaggerAxisType.x},e.parseStaggerIndexType=function(e){return"even"==e?t.StaggerIndexType.even:t.StaggerIndexType.odd},e.parseRenderOrderType=function(e){return"right-up"==e?t.RenderOrderType.rightUp:"left-down"==e?t.RenderOrderType.leftDown:"left-up"==e?t.RenderOrderType.leftUp:t.RenderOrderType.rightDown},e.parsePropertyDict=function(e){if(!e)return null;for(var i=new Map,n=0,r=e;n=e.columns));y+=e.tileWidth+e.spacing);else e.tiles.forEach(function(i,n){e.tileRegions.set(n,new t.Rectangle(0,0,i.image.width,i.image.height))});return[2,e]}})})},e.loadTmxTilesetTile=function(e,i,n,r,o){return __awaiter(this,void 0,void 0,function(){var s,a,h,c,u,l,p,d,f,g,m,y,_;return __generator(this,function(v){switch(v.label){case 0:if(e.tileset=i,e.id=n.id,s=n.terrain)for(e.terrainEdges=new Array(4),a=0,h=0,c=s;h0){a.shape.x=h.x,a.shape.y=h.y,i.addChild(a.shape),a.shape.graphics.clear(),a.shape.graphics.lineStyle(1,10526884);for(l=0;l0&&(u=l.currentAnimationFrameGid);var p=i.tileset.tileRegions.get(u),d=Math.floor(i.x)*s,f=Math.floor(i.y)*a;i.horizontalFlip&&i.verticalFlip?(d+=a+(p.height*o.y-a),f-=p.width*o.x-s):i.horizontalFlip?d+=s+(p.height*o.y-a):i.verticalFlip?f+=s-p.width*o.x:f+=a-p.height*o.y;var g=new t.Vector2(d,f).add(r);if(i.tileset.image){if(n){var m=i.tileset.image.bitmap.getTexture(""+u);m||(m=i.tileset.image.bitmap.createTexture(""+u,p.x,p.y,p.width,p.height)),i.tileset.image.texture=new e(m),n.addChild(i.tileset.image.texture),i.tileset.image.texture.x!=g.x&&(i.tileset.image.texture.x=g.x),i.tileset.image.texture.y!=g.y&&(i.tileset.image.texture.y=g.y),i.verticalFlip&&i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=-1):i.verticalFlip?(i.tileset.image.texture.scaleX=o.x,i.tileset.image.texture.scaleY=-1):i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=o.y):(i.tileset.image.texture.scaleX=o.x,i.tileset.image.texture.scaleY=o.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 l.image.texture&&(l.image.bitmap.getTexture(u.toString())||(l.image.texture=new e(l.image.bitmap.createTexture(u.toString(),p.x,p.y,p.width,p.height)),n.addChild(l.image.texture)),l.image.texture.x=g.x,l.image.texture.y=g.y,l.image.texture.scaleX=o.x,l.image.texture.scaleY=o.y,l.image.texture.rotation=0,l.image.texture.anchorOffsetX=0,l.image.texture.anchorOffsetY=0,l.image.texture.filters=[h])},i}();t.TiledRendering=i}(es||(es={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e.prototype.update=function(){this.tiles.forEach(function(t){t.updateAnimatedTiles()})},e}(t.TmxDocument);t.TmxTileset=e;var i=function(){return function(){}}();t.TmxTileOffset=i;var n=function(){return function(){}}();t.TmxTerrain=n}(es||(es={})),function(t){var e=function(){function e(){}return Object.defineProperty(e.prototype,"currentAnimationFrameGid",{get:function(){return this.animationFrames[this._animationCurrentFrame].gid+this.tileset.firstGid},enumerable:!0,configurable:!0}),e.prototype.processProperties=function(){var t;(t=this.properties.get("engine.isDestructable"))&&(this.isDestructable=Boolean(t)),(t=this.properties.get("engine:isSlope"))&&(this.isSlope=Boolean(t)),(t=this.properties.get("engine:isOneWayPlatform"))&&(this.isOneWayPlatform=Boolean(t)),(t=this.properties.get("engine:slopeTopLeft"))&&(this.slopeTopLeft=Number(t)),(t=this.properties.get("engine:slopeTopRight"))&&(this.slopeTopRight=Number(t))},e.prototype.updateAnimatedTiles=function(){0!=this.animationFrames.length&&(this._animationElapsedTime+=t.Time.deltaTime,this._animationElapsedTime>this.animationFrames[this._animationCurrentFrame].duration&&(this._animationCurrentFrame=t.MathHelper.incrementWithWrap(this._animationCurrentFrame,this.animationFrames.length),this._animationElapsedTime=0))},e}();t.TmxTilesetTile=e;var i=function(){return function(){}}();t.TmxAnimationFrame=i}(es||(es={})),function(t){var e=function(){function e(){}return e.decode=function(e,i,n){switch(n=n||"none",i=i||"none"){case"base64":var r=t.Base64Utils.decodeBase64AsArray(e,4);return"none"===n?r:t.Base64Utils.decompress(e,r,n);case"csv":return t.Base64Utils.decodeCSV(e);case"none":for(var o=[],s=0;si;n--)if(t[n]0&&t[r-1]>n;r--)t[r]=t[r-1];t[r]=n}},t.binarySearch=function(t,e){for(var i=0,n=t.length,r=i+n>>1;i=t[r]&&(i=r+1),r=i+n>>1;return t[i]==e?i:-1},t.findElementIndex=function(t,e){for(var i=t.length,n=0;nt[e]&&(e=n);return e},t.getMinElementIndex=function(t){for(var e=0,i=t.length,n=1;n=0;--r)i.unshift(e[r]);return i},t.getDifferAry=function(t,e){t=this.getUniqueAry(t),e=this.getUniqueAry(e);for(var i=t.concat(e),n={},r=[],o=i.length,s=0;s=0;e-=1)t.splice(e,1)},t.cloneList=function(t){return t?t.slice(0,t.length):null},t.equals=function(t,e){if(t==e)return!0;var i=t.length;if(i!=e.length)return!1;for(;i--;)if(t[i]!=e[i])return!1;return!0},t.insert=function(t,e,i){if(!t)return null;var n=t.length;if(e>n&&(e=n),e<0&&(e=0),e==n)t.push(i);else if(0==e)t.unshift(i);else{for(var r=n-1;r>=e;r-=1)t[r+1]=t[r];t[e]=i}return i},t}();!function(t){var e=function(){function t(){}return Object.defineProperty(t,"nativeBase64",{get:function(){return"function"==typeof window.atob},enumerable:!0,configurable:!0}),t.decode=function(t){if(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),this.nativeBase64)return window.atob(t);for(var e,i,n,r,o,s,a=[],h=0;h>4,i=(15&r)<<4|(o=this._keyStr.indexOf(t.charAt(h++)))>>2,n=(3&o)<<6|(s=this._keyStr.indexOf(t.charAt(h++))),a.push(String.fromCharCode(e)),64!==o&&a.push(String.fromCharCode(i)),64!==s&&a.push(String.fromCharCode(n));return a=a.join("")},t.encode=function(t){if(t=t.replace(/\r\n/g,"\n"),!this.nativeBase64){for(var e,i,n,r,o,s,a,h=[],c=0;c>2,o=(3&e)<<4|(i=t.charCodeAt(c++))>>4,s=(15&i)<<2|(n=t.charCodeAt(c++))>>6,a=63&n,isNaN(i)?s=a=64:isNaN(n)&&(a=64),h.push(this._keyStr.charAt(r)),h.push(this._keyStr.charAt(o)),h.push(this._keyStr.charAt(s)),h.push(this._keyStr.charAt(a));return h=h.join("")}window.btoa(t)},t.decodeBase64AsArray=function(e,i){i=i||1;var n,r,o,s=t.decode(e),a=new Uint32Array(s.length/i);for(n=0,o=s.length/i;n=0;--r)a[n]+=s.charCodeAt(n*i+r)<<(r<<3);return a},t.decompress=function(t,e,i){throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!")},t.decodeCSV=function(t){for(var e=t.replace("\n","").trim().split(","),i=[],n=0;n>16},set:function(t){this._packedValue=4278255615&this._packedValue|t<<16},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"g",{get:function(){return this._packedValue>>8},set:function(t){this._packedValue=4294902015&this._packedValue|t<<8},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"r",{get:function(){return this._packedValue},set:function(t){this._packedValue=4294967040&this._packedValue|t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"a",{get:function(){return this._packedValue>>24},set:function(t){this._packedValue=16777215&this._packedValue|t<<24},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"packedValue",{get:function(){return this._packedValue},set:function(t){this._packedValue=t},enumerable:!0,configurable:!0}),e.prototype.equals=function(t){return this._packedValue==t._packedValue},e}();t.Color=e}(es||(es={})),function(t){var e=function(){function t(){this.loadedAssets=new Map}return t.prototype.loadRes=function(t,e){var i=this;return void 0===e&&(e=!0),new Promise(function(n,r){var o=i.loadedAssets.get(t);o?n(o):e?RES.getResAsync(t).then(function(e){i.loadedAssets.set(t,e),n(e)}).catch(function(e){console.error("资源加载错误:",t,e),r(e)}):RES.getResByUrl(t).then(function(e){i.loadedAssets.set(t,e),n(e)}).catch(function(e){console.error("资源加载错误:",t,e),r(e)})})},t.prototype.dispose=function(){this.loadedAssets.forEach(function(t){t.dispose()}),this.loadedAssets.clear()},t}();t.ContentManager=e}(es||(es={})),function(t){var e=function(){function t(){}return t.getColorMatrix=function(t){var e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];return e[0]=Math.floor(t/256/256)/255,e[6]=Math.floor(t/256%256)/255,e[12]=t%256/255,new egret.ColorMatrixFilter(e)},t}();t.DrawUtils=e}(es||(es={})),function(t){var e=function(){function e(){}return e.oppositeEdge=function(e){switch(e){case t.Edge.bottom:return t.Edge.top;case t.Edge.top:return t.Edge.bottom;case t.Edge.left:return t.Edge.right;case t.Edge.right:return t.Edge.left}},e.isHorizontal=function(e){return e==t.Edge.right||e==t.Edge.left},e.isVertical=function(e){return e==t.Edge.top||e==t.Edge.bottom},e}();t.EdgeExt=e}(es||(es={})),function(t){var e=function(){return function(t,e){this.func=t,this.context=e}}();t.FuncPack=e;var i=function(){function t(){this._messageTable=new Map}return t.prototype.addObserver=function(t,i,n){var r=this._messageTable.get(t);r||(r=[],this._messageTable.set(t,r)),-1!=r.findIndex(function(t){return t.func==i})&&console.warn("您试图添加相同的观察者两次"),r.push(new e(i,n))},t.prototype.removeObserver=function(t,e){var i=this._messageTable.get(t),n=i.findIndex(function(t){return t.func==e});-1!=n&&i.removeAt(n)},t.prototype.emit=function(t,e){var i=this._messageTable.get(t);if(i)for(var n=i.length-1;n>=0;n--)i[n].func.call(i[n].context,e)},t}();t.Emitter=i}(es||(es={})),function(t){!function(t){t[t.top=0]="top",t[t.bottom=1]="bottom",t[t.left=2]="left",t[t.right=3]="right"}(t.Edge||(t.Edge={}))}(es||(es={})),function(t){var e=function(){function t(){}return t.repeat=function(t,e){for(var i=[];e--;)i.push(t);return i},t}();t.Enumerable=e}(es||(es={})),function(t){var e=function(){function t(){}return Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),t.prototype.setEnabled=function(t){this._enabled!=t&&(this._enabled=t,this._enabled?this.onEnabled():this.onDisabled())},t.prototype.onEnabled=function(){},t.prototype.onDisabled=function(){},t.prototype.update=function(){},t}();t.GlobalManager=e}(es||(es={})),function(t){var e=function(){function e(){this.x=0,this.y=0,this.touchPoint=-1,this.touchDown=!1}return Object.defineProperty(e.prototype,"position",{get:function(){return new t.Vector2(this.x,this.y)},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this.x=0,this.y=0,this.touchDown=!1,this.touchPoint=-1},e}();t.TouchState=e;var i=function(){function i(){}return Object.defineProperty(i,"gameTouchs",{get:function(){return this._gameTouchs},enumerable:!0,configurable:!0}),Object.defineProperty(i,"resolutionScale",{get:function(){return this._resolutionScale},enumerable:!0,configurable:!0}),Object.defineProperty(i,"totalTouchCount",{get:function(){return this._totalTouchCount},enumerable:!0,configurable:!0}),Object.defineProperty(i,"touchPosition",{get:function(){return this._gameTouchs[0]?this._gameTouchs[0].position:t.Vector2.zero},enumerable:!0,configurable:!0}),Object.defineProperty(i,"maxSupportedTouch",{get:function(){return t.Core._instance.stage.maxTouches},set:function(e){t.Core._instance.stage.maxTouches=e,this.initTouchCache()},enumerable:!0,configurable:!0}),Object.defineProperty(i,"touchPositionDelta",{get:function(){var e=t.Vector2.subtract(this.touchPosition,this._previousTouchState.position);return e.length()>0&&this.setpreviousTouchState(this._gameTouchs[0]),e},enumerable:!0,configurable:!0}),i.initialize=function(){this._init||(this._init=!0,t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.touchBegin,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.touchMove,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_END,this.touchEnd,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_CANCEL,this.touchEnd,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_RELEASE_OUTSIDE,this.touchEnd,this),this.initTouchCache())},i.scaledPosition=function(e){var i=new t.Vector2(e.x-this._resolutionOffset.x,e.y-this._resolutionOffset.y);return t.Vector2.multiply(i,this.resolutionScale)},i.initTouchCache=function(){this._totalTouchCount=0,this._touchIndex=0,this._gameTouchs.length=0;for(var t=0;t0)for(var e=0;ethis._objectQueue.length;)this._objectQueue.shift()},t.clearCache=function(){this._objectQueue.length=0},t.obtain=function(){return this._objectQueue.length>0?this._objectQueue.shift():[]},t.free=function(t){this._objectQueue.unshift(t),t.length=0},t._objectQueue=[],t}();t.ListPool=e}(es||(es={}));var THREAD_ID=Math.floor(1e3*Math.random())+"-"+Date.now(),nextTick=function(t){setTimeout(t,0)},LockUtils=function(){function t(t){this._keyX="mutex_key_"+t+"_X",this._keyY="mutex_key_"+t+"_Y",this.setItem=egret.localStorage.setItem.bind(localStorage),this.getItem=egret.localStorage.getItem.bind(localStorage),this.removeItem=egret.localStorage.removeItem.bind(localStorage)}return t.prototype.lock=function(){var t=this;return new Promise(function(e,i){var n=function(){t.setItem(t._keyX,THREAD_ID),null===!t.getItem(t._keyY)&&nextTick(n),t.setItem(t._keyY,THREAD_ID),t.getItem(t._keyX)!==THREAD_ID?setTimeout(function(){t.getItem(t._keyY)===THREAD_ID?(e(),t.removeItem(t._keyY)):nextTick(n)},10):(e(),t.removeItem(t._keyY))};n()})},t}();!function(t){var e=function(){function t(t,e){this.first=t,this.second=e}return t.prototype.clear=function(){this.first=this.second=null},t.prototype.equals=function(t){return this.first==t.first&&this.second==t.second},t}();t.Pair=e}(es||(es={}));var RandomUtils=function(){function t(){}return t.randrange=function(t,e,i){if(void 0===i&&(i=1),0==i)throw new Error("step 不能为 0");var n=e-t;if(0==n)throw new Error("没有可用的范围("+t+","+e+")");n<0&&(n=t-e);var r=Math.floor((n+i-1)/i);return Math.floor(this.random()*r)*i+Math.min(t,e)},t.randint=function(t,e){return(t=Math.floor(t))>(e=Math.floor(e))?t++:e++,this.randrange(t,e)},t.randnum=function(t,e){return this.random()*(e-t)+t},t.shuffle=function(t){return t.sort(this._randomCompare),t},t.choice=function(t){if(!t.hasOwnProperty("length"))throw new Error("无法对此对象执行此操作");var e=Math.floor(this.random()*t.length);return t instanceof String?String(t).charAt(e):t[e]},t.sample=function(t,e){var i=t.length;if(e<=0||i=0;)s=Math.floor(this.random()*i);n.push(t[s]),r.push(s)}return n},t.random=function(){return Math.random()},t.boolean=function(t){return void 0===t&&(t=.5),this.random().5?1:-1},t}();!function(t){var e=function(){function e(){}return e.getSide=function(e,i){switch(i){case t.Edge.top:return e.top;case t.Edge.bottom:return e.bottom;case t.Edge.left:return e.left;case t.Edge.right:return e.right}},e.union=function(e,i){var n=new t.Rectangle(i.x,i.y,0,0),r=new t.Rectangle;return r.x=Math.min(e.x,n.x),r.y=Math.min(e.y,n.y),r.width=Math.max(e.right,n.right)-r.x,r.height=Math.max(e.bottom,r.bottom)-r.y,r},e.getHalfRect=function(e,i){switch(i){case t.Edge.top:return new t.Rectangle(e.x,e.y,e.width,e.height/2);case t.Edge.bottom:return new t.Rectangle(e.x,e.y+e.height/2,e.width,e.height/2);case t.Edge.left:return new t.Rectangle(e.x,e.y,e.width/2,e.height);case t.Edge.right:return new t.Rectangle(e.x+e.width/2,e.y,e.width/2,e.height)}},e.getRectEdgePortion=function(e,i,n){switch(void 0===n&&(n=1),i){case t.Edge.top:return new t.Rectangle(e.x,e.y,e.width,n);case t.Edge.bottom:return new t.Rectangle(e.x,e.y+e.height-n,e.width,n);case t.Edge.left:return new t.Rectangle(e.x,e.y,n,e.height);case t.Edge.right:return new t.Rectangle(e.x+e.width-n,e.y,n,e.height)}},e.expandSide=function(e,i,n){switch(n=Math.abs(n),i){case t.Edge.top:e.y-=n,e.height+=n;break;case t.Edge.bottom:e.height+=n;break;case t.Edge.left:e.x-=n,e.width+=n;break;case t.Edge.right:e.width+=n}},e.contract=function(t,e,i){t.x+=e,t.y+=i,t.width-=2*e,t.height-=2*i},e}();t.RectangleExt=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.update=function(t){this.remainder+=t;var e=Math.trunc(this.remainder);return this.remainder-=e,e},t.prototype.reset=function(){this.remainder=0},t}();t.SubpixelNumber=e}(es||(es={})),function(t){var e=function(){function e(){this.triangleIndices=[],this._triPrev=new Array(12),this._triNext=new Array(12)}return e.testPointTriangle=function(e,i,n,r){return!(t.Vector2Ext.cross(t.Vector2.subtract(e,i),t.Vector2.subtract(n,i))<0)&&(!(t.Vector2Ext.cross(t.Vector2.subtract(e,n),t.Vector2.subtract(r,n))<0)&&!(t.Vector2Ext.cross(t.Vector2.subtract(e,r),t.Vector2.subtract(i,r))<0))},e.prototype.triangulate=function(i,n){void 0===n&&(n=!0);var r=i.length;this.initialize(r);for(var o=0,s=0;r>3&&o<500;){o++;var a=!0,h=i[this._triPrev[s]],c=i[s],u=i[this._triNext[s]];if(t.Vector2Ext.isTriangleCCW(h,c,u)){var l=this._triNext[this._triNext[s]];do{if(e.testPointTriangle(i[l],h,c,u)){a=!1;break}l=this._triNext[l]}while(l!=this._triPrev[s])}else a=!1;a?(this.triangleIndices.push(this._triPrev[s]),this.triangleIndices.push(s),this.triangleIndices.push(this._triNext[s]),this._triNext[this._triPrev[s]]=this._triNext[s],this._triPrev[this._triNext[s]]=this._triPrev[s],r--,s=this._triPrev[s]):s=this._triNext[s]}this.triangleIndices.push(this._triPrev[s]),this.triangleIndices.push(s),this.triangleIndices.push(this._triNext[s]),n||this.triangleIndices.reverse()},e.prototype.initialize=function(t){this.triangleIndices.length=0,this._triNext.lengtht.MathHelper.Epsilon?e=t.Vector2.divide(e,new t.Vector2(i)):e.x=e.y=0,e},e.transformA=function(t,e,i,n,r,o){for(var s=0;sthis.safeArea.right&&(s.x=this.safeArea.right-s.width),s.topthis.safeArea.bottom&&(s.y=this.safeArea.bottom-s.height),s},i}();t.Layout=i,function(t){t[t.none=0]="none",t[t.left=1]="left",t[t.right=2]="right",t[t.horizontalCenter=4]="horizontalCenter",t[t.top=8]="top",t[t.bottom=16]="bottom",t[t.verticalCenter=32]="verticalCenter",t[t.topLeft=9]="topLeft",t[t.topRight=10]="topRight",t[t.topCenter=12]="topCenter",t[t.bottomLeft=17]="bottomLeft",t[t.bottomRight=18]="bottomRight",t[t.bottomCenter=20]="bottomCenter",t[t.centerLeft=33]="centerLeft",t[t.centerRight=34]="centerRight",t[t.center=36]="center"}(e=t.Alignment||(t.Alignment={}))}(es||(es={})),function(t){var e,i=function(){function t(t){void 0===t&&(t=n),this.getSystemTime=t,this._stopDuration=0,this._completeSlices=[]}return t.prototype.getState=function(){return void 0===this._startSystemTime?e.IDLE:void 0===this._stopSystemTime?e.RUNNING:e.STOPPED},t.prototype.isIdle=function(){return this.getState()===e.IDLE},t.prototype.isRunning=function(){return this.getState()===e.RUNNING},t.prototype.isStopped=function(){return this.getState()===e.STOPPED},t.prototype.slice=function(){return this.recordPendingSlice()},t.prototype.getCompletedSlices=function(){return Array.from(this._completeSlices)},t.prototype.getCompletedAndPendingSlices=function(){return this._completeSlices.concat([this.getPendingSlice()])},t.prototype.getPendingSlice=function(){return this.calculatePendingSlice()},t.prototype.getTime=function(){return this.caculateStopwatchTime()},t.prototype.reset=function(){this._startSystemTime=this._pendingSliceStartStopwatchTime=this._stopSystemTime=void 0,this._stopDuration=0,this._completeSlices=[]},t.prototype.start=function(t){if(void 0===t&&(t=!1),t&&this.reset(),void 0!==this._stopSystemTime){var e=(i=this.getSystemTime())-this._stopSystemTime;this._stopDuration+=e,this._stopSystemTime=void 0}else if(void 0===this._startSystemTime){var i=this.getSystemTime();this._startSystemTime=i,this._pendingSliceStartStopwatchTime=0}},t.prototype.stop=function(t){if(void 0===t&&(t=!1),void 0===this._startSystemTime)return 0;var e=this.getSystemTimeOfCurrentStopwatchTime();return t&&this.recordPendingSlice(this.caculateStopwatchTime(e)),this._stopSystemTime=e,this.getTime()},t.prototype.calculatePendingSlice=function(t){return void 0===this._pendingSliceStartStopwatchTime?Object.freeze({startTime:0,endTime:0,duration:0}):(void 0===t&&(t=this.getTime()),Object.freeze({startTime:this._pendingSliceStartStopwatchTime,endTime:t,duration:t-this._pendingSliceStartStopwatchTime}))},t.prototype.caculateStopwatchTime=function(t){return void 0===this._startSystemTime?0:(void 0===t&&(t=this.getSystemTimeOfCurrentStopwatchTime()),t-this._startSystemTime-this._stopDuration)},t.prototype.getSystemTimeOfCurrentStopwatchTime=function(){return void 0===this._stopSystemTime?this.getSystemTime():this._stopSystemTime},t.prototype.recordPendingSlice=function(t){if(void 0!==this._pendingSliceStartStopwatchTime){void 0===t&&(t=this.getTime());var e=this.calculatePendingSlice(t);return this._pendingSliceStartStopwatchTime=e.endTime,this._completeSlices.push(e),e}return this.calculatePendingSlice()},t}();t.Stopwatch=i,function(t){t.IDLE="IDLE",t.RUNNING="RUNNING",t.STOPPED="STOPPED"}(e||(e={})),t.setDefaultSystemTimeGetter=function(t){void 0===t&&(t=Date.now),n=t};var n=Date.now}(stopwatch||(stopwatch={})),function(t){var e=function(){function e(){this.showLog=!1,this._frameKey="frame",this._logKey="log",this.markers=[],this.stopwacth=new stopwatch.Stopwatch,this._markerNameToIdMap=new Map,this._logs=new Array(2);for(var e=0;e=e.logSnapDuration&&(l.logs[r].snapMin=l.logs[r].min,l.logs[r].snapMax=l.logs[r].max,l.logs[r].snapAvg=l.logs[r].avg,l.logs[r].samples=0)):(l.logs[r].min=c,l.logs[r].max=c,l.logs[r].avg=c,l.logs[r].initialized=!0)}s.markCount=o.nestCount,s.nestCount=o.nestCount}t.stopwacth.reset(),t.stopwacth.start()}})},e.prototype.beginMark=function(t,i,n){var r=this;void 0===n&&(n=0),new LockUtils(this._frameKey).lock().then(function(){if(n<0||n>=e.maxBars)throw new Error("barIndex argument out of range");var o=r._curLog.bars[n];if(o.markCount>=e.maxSamples)throw new Error("exceeded sample count. either set larger number to timeruler.maxsaple or lower sample count");if(o.nestCount>=e.maxNestCall)throw new Error("exceeded nest count. either set larger number to timeruler.maxnestcall or lower nest calls");var s=r._markerNameToIdMap.get(t);isNaN(s)&&(s=r.markers.length,r._markerNameToIdMap.set(t,s)),o.markerNests[o.nestCount++]=o.markCount,o.markers[o.markCount].markerId=s,o.markers[o.markCount].color=i,o.markers[o.markCount].beginTime=r.stopwacth.getTime(),o.markers[o.markCount].endTime=-1})},e.prototype.endMark=function(t,i){var n=this;void 0===i&&(i=0),new LockUtils(this._frameKey).lock().then(function(){if(i<0||i>=e.maxBars)throw new Error("barIndex argument out of range");var r=n._curLog.bars[i];if(r.nestCount<=0)throw new Error("call beginMark method before calling endMark method");var o=n._markerNameToIdMap.get(t);if(isNaN(o))throw new Error("Marker "+t+" is not registered. Make sure you specifed same name as you used for beginMark method");var s=r.markerNests[--r.nestCount];if(r.markers[s].markerId!=o)throw new Error("Incorrect call order of beginMark/endMark method. beginMark(A), beginMark(B), endMark(B), endMark(A) But you can't called it like beginMark(A), beginMark(B), endMark(A), endMark(B).");r.markers[s].endTime=n.stopwacth.getTime()})},e.prototype.getAverageTime=function(t,i){if(t<0||t>=e.maxBars)throw new Error("barIndex argument out of range");var n=0,r=this._markerNameToIdMap.get(i);return r&&(n=this.markers[r].logs[t].avg),n},e.prototype.resetLog=function(){var t=this;new LockUtils(this._logKey).lock().then(function(){var e=parseInt(egret.localStorage.getItem(t._logKey),10);e+=1,egret.localStorage.setItem(t._logKey,e.toString()),t.markers.forEach(function(t){for(var e=0;e0&&(n+=e.barHeight+2*e.barPadding,r=Math.max(r,t.markers[t.markCount-1].endTime))});var o=this.sampleFrames*(1/60*1e3);this._frameAdjust=r>o?Math.max(0,this._frameAdjust)+1:Math.min(0,this._frameAdjust)-1,Math.max(this._frameAdjust)>e.autoAdjustDelay&&(this.sampleFrames=Math.min(e.maxSampleFrames,this.sampleFrames),this.sampleFrames=Math.max(this.targetSampleFrames,r/(1/60*1e3)+1),this._frameAdjust=0);t.y,e.barHeight}},e.prototype.onGraphicsDeviceReset=function(){var i=new t.Layout;this._position=i.place(new t.Vector2(this.width,e.barHeight),0,.01,t.Alignment.bottomCenter).location},e.maxBars=8,e.maxSamples=256,e.maxNestCall=32,e.barHeight=8,e.maxSampleFrames=4,e.logSnapDuration=120,e.barPadding=2,e.autoAdjustDelay=30,e}();t.TimeRuler=e;var i=function(){return function(){this.bars=new Array(e.maxBars),this.bars.fill(new n,0,e.maxBars)}}();t.FrameLog=i;var n=function(){return function(){this.markers=new Array(e.maxSamples),this.markCount=0,this.markerNests=new Array(e.maxNestCall),this.nestCount=0,this.markers.fill(new r,0,e.maxSamples),this.markerNests.fill(0,0,e.maxNestCall)}}();t.MarkerCollection=n;var r=function(){return function(){this.markerId=0,this.beginTime=0,this.endTime=0,this.color=0}}();t.Marker=r;var o=function(){return function(t){this.logs=new Array(e.maxBars),this.name=t,this.logs.fill(new s,0,e.maxBars)}}();t.MarkerInfo=o;var s=function(){return function(){this.snapMin=0,this.snapMax=0,this.snapAvg=0,this.min=0,this.max=0,this.avg=0,this.samples=0,this.color=0,this.initialized=!1}}();t.MarkerLog=s}(es||(es={})),function(t){var e=egret.Bitmap,i=function(){function i(){this.itemsToRaster=[],this.useCache=!1,this.cacheName="",this._sprites=new Map,this.allow4096Textures=!1}return i.prototype.addTextureToPack=function(e,i){this.itemsToRaster.push(new t.TextureToPack(e,i))},i.prototype.process=function(t){return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.allow4096Textures=t,this.useCache?""==this.cacheName?(console.error("未指定缓存名称"),[2]):[4,RES.getResByUrl(this.cacheName)]:[3,2];case 1:return e.sent()?this.loadPack():this.createPack(),[3,3];case 2:this.createPack(),e.label=3;case 3:return[2]}})})},i.prototype.loadPack=function(){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,RES.getResByUrl(this.cacheName)];case 1:return t=e.sent(),this.onProcessCompleted&&this.onProcessCompleted(),[2,t]}})})},i.prototype.createPack=function(){for(var i=[],n=[],r=0,o=this.itemsToRaster;ra||i[c].height>a)throw new Error("一个纹理的大小比图集的大小大");h.push(new t.Rectangle(0,0,i[c].width,i[c].height))}for(;h.length>0;){var u=new egret.RenderTexture,l=new t.RectanglePacker(a,a,1);for(c=0;c0){for(var p=new t.IntegerRectangle,d=[],f=[],g=[],m=[],y=0;y0;)this.freeRectangle(this._insertedRectangles.pop());for(;this._freeAreas.length>0;)this.freeRectangle(this._freeAreas.pop());for(this._width=t,this._height=e,this._packedWidth=0,this._packedHeight=0,this._freeAreas.push(this.allocateRectangle(0,0,this._width,this._height));this._insertedRectangles.length>0;)this.freeSize(this._insertList.pop());this._padding=i},e.prototype.insertRectangle=function(t,e,i){var n=this.allocateSize(t,e,i);this._insertList.push(n)},e.prototype.packRectangles=function(t){for(void 0===t&&(t=!0),t&&this._insertList.sort(function(t,e){return t.width-e.width});this._insertList.length>0;){var e=this._insertList.pop(),i=e.width,n=e.height,r=this.getFreeAreaIndex(i,n);if(r>=0){var o=this._freeAreas[r],s=this.allocateRectangle(o.x,o.y,i,n);for(s.id=e.id,this.generateNewFreeAreas(s,this._freeAreas,this._newFreeAreas);this._newFreeAreas.length>0;)this._freeAreas.push(this._newFreeAreas.pop());this._insertedRectangles.push(s),s.right>this._packedWidth&&(this._packedWidth=s.right),s.bottom>this._packedHeight&&(this._packedHeight=s.bottom)}this.freeSize(e)}return this.rectangleCount},e.prototype.getRectangle=function(t,e){var i=this._insertedRectangles[t];return e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height,e},e.prototype.getRectangleId=function(t){return this._insertedRectangles[t].id},e.prototype.generateNewFreeAreas=function(t,e,i){var n=t.x,r=t.y,o=t.right+1+this._padding,s=t.bottom+1+this._padding,a=null;0==this._padding&&(a=t);for(var h=e.length-1;h>=0;h--){var c=e[h];if(!(n>=c.right||o<=c.x||r>=c.bottom||s<=c.y)){null==a&&(a=this.allocateRectangle(t.x,t.y,t.width+this._padding,t.height+this._padding)),this.generateDividedAreas(a,c,i);var u=e.pop();h=0;e--)for(var i=t[e],n=t.length-1;n>=0;n--)if(e!=n){var r=t[n];if(i.x>=r.x&&i.y>=r.y&&i.right<=r.right&&i.bottom<=r.bottom){this.freeRectangle(i);var o=t.pop();e0&&(i.push(this.allocateRectangle(t.right,e.y,r,e.height)),n++);var o=t.x-e.x;o>0&&(i.push(this.allocateRectangle(e.x,e.y,o,e.height)),n++);var s=e.bottom-t.bottom;s>0&&(i.push(this.allocateRectangle(e.x,t.bottom,e.width,s)),n++);var a=t.y-e.y;a>0&&(i.push(this.allocateRectangle(e.x,e.y,e.width,a)),n++),0==n&&(t.width=0;s--){var a=this._freeAreas[s];if(a.x0){var r=this._sortableSizeStack.pop();return r.width=e,r.height=i,r.id=n,r}return new t.SortableSize(e,i,n)},e.prototype.freeSize=function(t){this._sortableSizeStack.push(t)},e.prototype.allocateRectangle=function(e,i,n,r){if(this._rectangleStack.length>0){var o=this._rectangleStack.pop();return o.x=e,o.y=i,o.width=n,o.height=r,o.right=e+n,o.bottom=i+r,o}return new t.IntegerRectangle(e,i,n,r)},e.prototype.freeRectangle=function(t){this._rectangleStack.push(t)},e}();t.RectanglePacker=e}(es||(es={})),function(t){var e=function(){return function(t,e,i){this.width=t,this.height=e,this.id=i}}();t.SortableSize=e}(es||(es={})),function(t){var e=function(){return function(t){this.assets=t}}();t.TextureAssets=e;var i=function(){return function(){}}();t.TextureAsset=i}(es||(es={})),function(t){var e=function(){return function(t,e){this.texture=t,this.id=e}}();t.TextureToPack=e}(es||(es={})); \ No newline at end of file +window.es={},window.__extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var transform,__awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(r,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(s,a)}h((n=n.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]-1}(this,t)},Array.prototype.firstOrDefault=function(t){return function(t,e){var i=t.findIndex(e);return-1==i?null:t[i]}(this,t)},Array.prototype.find=function(t){return function(t,e){return t.firstOrDefault(e)}(this,t)},Array.prototype.where=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(i,n,r){return e.call(arguments[2],n,r,t)&&i.push(n),i},[]);for(var i=[],n=0,r=t.length;n=0&&t.splice(i,1)}while(i>=0)}(this,t)},Array.prototype.remove=function(t){return function(t,e){var i=t.findIndex(function(t){return t===e});return i>=0&&(t.splice(i,1),!0)}(this,t)},Array.prototype.removeAt=function(t){return function(t,e){t.splice(e,1)}(this,t)},Array.prototype.removeRange=function(t,e){return function(t,e,i){t.splice(e,i)}(this,t,e)},Array.prototype.select=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(i,n,r){return i.push(e.call(arguments[2],n,r,t)),i},[]);for(var i=[],n=0,r=t.length;no?1:-1}),t}(this,t,e)},Array.prototype.orderByDescending=function(t,e){return function(t,e,i){return t.sort(function(t,n){var r=e(t),o=e(n);return i?-i(r,o):r0;){if("break"===u())break}return s?this.recontructPath(a,n,r):null},e.recontructPath=function(t,e,i){var n=[],r=i;for(n.push(i);r!=e;)r=this.getKey(t,r),n.push(r);return n.reverse(),n},e.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},e.getKey=function(t,e){for(var i,n,r=t.keys(),o=t.values();i=r.next(),n=o.next(),!i.done;)if(JSON.stringify(i.value)==JSON.stringify(e))return n.value;return null},e}();t.AStarPathfinder=e;var i=function(t){function e(e){var i=t.call(this)||this;return i.data=e,i}return __extends(e,t),e}(t.PriorityQueueNode);t.AStarNode=i}(es||(es={})),function(t){var e=function(){function e(e,i){this.dirs=[new t.Vector2(1,0),new t.Vector2(0,-1),new t.Vector2(-1,0),new t.Vector2(0,1)],this.walls=[],this.weightedNodes=[],this.defaultWeight=1,this.weightedNodeWeight=5,this._neighbors=new Array(4),this._width=e,this._height=i}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x=this._nodes.length?(console.error("node.QueueIndex has been corrupted. Did you change it manually? Or add this node to another queue?"),!1):this._nodes[t.queueIndex]==t:(console.error("node cannot be null"),!1)},t.prototype.enqueue=function(t,e){t.priority=e,this._numNodes++,this._nodes[this._numNodes]=t,t.queueIndex=this._numNodes,t.insertionIndex=this._numNodesEverEnqueued++,this.cascadeUp(this._nodes[this._numNodes])},t.prototype.dequeue=function(){var t=this._nodes[1];return this.remove(t),t},t.prototype.remove=function(t){if(t.queueIndex==this._numNodes)return this._nodes[this._numNodes]=null,void this._numNodes--;var e=this._nodes[this._numNodes];this.swap(t,e),delete this._nodes[this._numNodes],this._numNodes--,this.onNodeUpdated(e)},t.prototype.isValidQueue=function(){for(var t=1;t0&&this.hasHigherPriority(t,i)?this.cascadeUp(t):this.cascadeDown(t)},t.prototype.cascadeDown=function(t){for(var e,i=t.queueIndex;;){e=t;var n=2*i;if(n>this._numNodes){t.queueIndex=i,this._nodes[i]=t;break}var r=this._nodes[n];this.hasHigherPriority(r,e)&&(e=r);var o=n+1;if(o<=this._numNodes){var s=this._nodes[o];this.hasHigherPriority(s,e)&&(e=s)}if(e==t){t.queueIndex=i,this._nodes[i]=t;break}this._nodes[i]=e;var a=e.queueIndex;e.queueIndex=i,i=a}},t.prototype.cascadeUp=function(t){for(var e=Math.floor(t.queueIndex/2);e>=1;){var i=this._nodes[e];if(this.hasHigherPriority(i,t))break;this.swap(t,i),e=Math.floor(t.queueIndex/2)}},t.prototype.swap=function(t,e){this._nodes[t.queueIndex]=e,this._nodes[e.queueIndex]=t;var i=t.queueIndex;t.queueIndex=e.queueIndex,e.queueIndex=i},t.prototype.hasHigherPriority=function(t,e){return t.priority0;){if("break"===h())break}return o?t.AStarPathfinder.recontructPath(a,i,n):null},e.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},e}();t.BreadthFirstPathfinder=e}(es||(es={})),function(t){var e=function(){function t(){this.edges=new Map}return t.prototype.addEdgesForNode=function(t,e){return this.edges.set(t,e),this},t.prototype.getNeighbors=function(t){return this.edges.get(t)},t}();t.UnweightedGraph=e}(es||(es={})),function(t){var e=function(){function e(t,e){this.x=0,this.y=0,this.x=t||0,this.y=null!=e?e:this.x}return Object.defineProperty(e,"zero",{get:function(){return e.zeroVector2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"one",{get:function(){return e.unitVector2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unitX",{get:function(){return e.unitXVector},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unitY",{get:function(){return e.unitYVector},enumerable:!0,configurable:!0}),e.add=function(t,i){var n=new e(0,0);return n.x=t.x+i.x,n.y=t.y+i.y,n},e.divide=function(t,i){var n=new e(0,0);return n.x=t.x/i.x,n.y=t.y/i.y,n},e.multiply=function(t,i){var n=new e(0,0);return n.x=t.x*i.x,n.y=t.y*i.y,n},e.subtract=function(t,i){var n=new e(0,0);return n.x=t.x-i.x,n.y=t.y-i.y,n},e.normalize=function(t){var e=1/Math.sqrt(t.x*t.x+t.y*t.y);return t.x*=e,t.y*=e,t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.distanceSquared=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},e.clamp=function(i,n,r){return new e(t.MathHelper.clamp(i.x,n.x,r.x),t.MathHelper.clamp(i.y,n.y,r.y))},e.lerp=function(i,n,r){return new e(t.MathHelper.lerp(i.x,n.x,r),t.MathHelper.lerp(i.y,n.y,r))},e.transform=function(t,i){return new e(t.x*i.m11+t.y*i.m21+i.m31,t.x*i.m12+t.y*i.m22+i.m32)},e.distance=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},e.angle=function(i,n){return i=e.normalize(i),n=e.normalize(n),Math.acos(t.MathHelper.clamp(e.dot(i,n),-1,1))*t.MathHelper.Rad2Deg},e.negate=function(t){var i=new e;return i.x=-t.x,i.y=-t.y,i},e.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},e.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},e.prototype.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},e.prototype.normalize=function(){var t=1/Math.sqrt(this.x*this.x+this.y*this.y);return this.x*=t,this.y*=t,this},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.prototype.round=function(){return new e(Math.round(this.x),Math.round(this.y))},e.prototype.equals=function(t){return t.x==this.x&&t.y==this.y},e.unitYVector=new e(0,1),e.unitXVector=new e(1,0),e.unitVector2=new e(1,1),e.zeroVector2=new e(0,0),e}();t.Vector2=e}(es||(es={})),function(t){var e=function(){function e(t,i,n){void 0===n&&(n=!1),this.walls=[],this._neighbors=new Array(4),this._width=t,this._hegiht=i,this._dirs=n?e.COMPASS_DIRS:e.CARDINAL_DIRS}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x0;){if("break"===u())break}return s?this.recontructPath(a,n,r):null},i.recontructPath=function(t,e,i){var n=[],r=i;for(n.push(i);r!=e;)r=this.getKey(t,r),n.push(r);return n.reverse(),n},i.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},i.getKey=function(t,e){for(var i,n,r=t.keys(),o=t.values();i=r.next(),n=o.next(),!i.done;)if(JSON.stringify(i.value)==JSON.stringify(e))return n.value;return null},i}();t.WeightedPathfinder=i}(es||(es={})),function(t){var e=function(){function e(){}return e.drawHollowRect=function(e,i,n){void 0===n&&(n=0),this._debugDrawItems.push(new t.DebugDrawItem(e,i,n))},e.render=function(){if(this._debugDrawItems.length>0){var e=new egret.Shape;t.Core.scene&&t.Core.scene.addChild(e);for(var i=this._debugDrawItems.length-1;i>=0;i--){this._debugDrawItems[i].draw(e)&&this._debugDrawItems.removeAt(i)}}},e._debugDrawItems=[],e}();t.Debug=e}(es||(es={})),function(t){var e=function(){function t(){}return t.verletParticle=14431326,t.verletConstraintEdge=4406838,t}();t.DebugDefaults=e}(es||(es={})),function(t){var e;!function(t){t[t.line=0]="line",t[t.hollowRectangle=1]="hollowRectangle",t[t.pixel=2]="pixel",t[t.text=3]="text"}(e=t.DebugDrawType||(t.DebugDrawType={}));var i=function(){function i(t,i,n){this.rectangle=t,this.color=i,this.duration=n,this.drawType=e.hollowRectangle}return i.prototype.draw=function(i){switch(this.drawType){case e.line:case e.hollowRectangle:case e.pixel:case e.text:}return this.duration-=t.Time.deltaTime,this.duration<0},i}();t.DebugDrawItem=i}(es||(es={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.updateInterval=1,e._enabled=!0,e._updateOrder=0,e}return __extends(e,t),Object.defineProperty(e.prototype,"transform",{get:function(){return this.entity.transform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this.entity?this.entity.enabled&&this._enabled:this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateOrder",{get:function(){return this._updateOrder},set:function(t){this.setUpdateOrder(t)},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){},e.prototype.onAddedToEntity=function(){},e.prototype.onRemovedFromEntity=function(){},e.prototype.onEntityTransformChanged=function(t){},e.prototype.debugRender=function(){},e.prototype.onEnabled=function(){},e.prototype.onDisabled=function(){},e.prototype.update=function(){},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled?this.onEnabled():this.onDisabled()),this},e.prototype.setUpdateOrder=function(t){return this._updateOrder!=t&&(this._updateOrder=t),this},e.prototype.clone=function(){var t=ObjectUtils.clone(this);return t.entity=null,t},e}(egret.HashObject);t.Component=e}(es||(es={})),function(t){var e=function(e){function i(){var n=e.call(this)||this;return n._globalManagers=[],i._instance=n,i.emitter=new t.Emitter,i.content=new t.ContentManager,n.addEventListener(egret.Event.ADDED_TO_STAGE,n.onAddToStage,n),n}return __extends(i,e),Object.defineProperty(i,"Instance",{get:function(){return this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(i,"scene",{get:function(){return this._instance?this._instance._scene:null},set:function(t){t?null==this._instance._scene?(this._instance._scene=t,this._instance.addChild(t),this._instance._scene.begin(),i.Instance.onSceneChanged()):this._instance._nextScene=t:console.error("场景不能为空")},enumerable:!0,configurable:!0}),i.startSceneTransition=function(t){if(!this._instance._sceneTransition)return this._instance._sceneTransition=t,t;console.warn("在前一个场景完成之前,不能开始一个新的场景转换。")},i.registerGlobalManager=function(t){this._instance._globalManagers.push(t),t.enabled=!0},i.unregisterGlobalManager=function(t){this._instance._globalManagers.remove(t),t.enabled=!1},i.getGlobalManager=function(t){for(var e=0;e=0;e--)this._globalManagers[e].enabled&&this._globalManagers[e].update();return this._sceneTransition&&(!this._sceneTransition||this._sceneTransition.loadsNewScene&&!this._sceneTransition.isNewSceneLoaded)||this._scene.update(),this._nextScene?(this._scene.parent&&this._scene.parent.removeChild(this._scene),this._scene.end(),this._scene=this._nextScene,this._nextScene=null,this.onSceneChanged(),this.addChild(this._scene),[4,this._scene.begin()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[4,this.draw()];case 3:return i.sent(),[2]}})})},i.prototype.onAddToStage=function(){i.graphicsDevice=new t.GraphicsDevice,this.addEventListener(egret.Event.RESIZE,this.onGraphicsDeviceReset,this),this.addEventListener(egret.StageOrientationEvent.ORIENTATION_CHANGE,this.onOrientationChanged,this),this.addEventListener(egret.Event.ENTER_FRAME,this.update,this),t.Input.initialize(),KeyboardUtils.init(),this.initialize()},i.debugRenderEndabled=!1,i}(egret.DisplayObjectContainer);t.Core=e}(es||(es={})),function(t){!function(t){t[t.GraphicsDeviceReset=0]="GraphicsDeviceReset",t[t.SceneChanged=1]="SceneChanged",t[t.OrientationChanged=2]="OrientationChanged"}(t.CoreEvents||(t.CoreEvents={}))}(es||(es={})),function(t){var e=function(){function e(i){this.updateInterval=1,this._tag=0,this._enabled=!0,this._updateOrder=0,this.components=new t.ComponentList(this),this.transform=new t.Transform(this),this.name=i,this.id=e._idGenerator++,this.componentBits=new t.BitSet}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this._isDestroyed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tag",{get:function(){return this._tag},set:function(t){this.setTag(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateOrder",{get:function(){return this._updateOrder},set:function(t){this.setUpdateOrder(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.transform.parent},set:function(t){this.transform.setParent(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childCount",{get:function(){return this.transform.childCount},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.setPosition(t.x,t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localPosition",{get:function(){return this.transform.localPosition},set:function(t){this.transform.setLocalPosition(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.setRotation(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationDegrees",{get:function(){return this.transform.rotationDegrees},set:function(t){this.transform.setRotationDegrees(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localRotation",{get:function(){return this.transform.localRotation},set:function(t){this.transform.setLocalRotation(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localRotationDegrees",{get:function(){return this.transform.localRotationDegrees},set:function(t){this.transform.setLocalRotationDegrees(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.setScale(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localScale",{get:function(){return this.transform.localScale},set:function(t){this.transform.setLocalScale(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"worldInverseTransform",{get:function(){return this.transform.worldInverseTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localToWorldTransform",{get:function(){return this.transform.localToWorldTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"worldToLocalTransform",{get:function(){return this.transform.worldToLocalTransform},enumerable:!0,configurable:!0}),e.prototype.onTransformChanged=function(t){this.components.onEntityTransformChanged(t)},e.prototype.setTag=function(t){return this._tag!=t&&(this.scene&&this.scene.entities.removeFromTagList(this),this._tag=t,this.scene&&this.scene.entities.addToTagList(this)),this},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled?this.components.onEntityEnabled():this.components.onEntityDisabled()),this},e.prototype.setUpdateOrder=function(t){if(this._updateOrder!=t)return this._updateOrder=t,this.scene&&(this.scene.entities.markEntityListUnsorted(),this.scene.entities.markTagUnsorted(this.tag)),this},e.prototype.destroy=function(){this._isDestroyed=!0,this.scene.entities.remove(this),this.transform.parent=null;for(var t=this.transform.childCount-1;t>=0;t--){this.transform.getChild(t).entity.destroy()}},e.prototype.detachFromScene=function(){this.scene.entities.remove(this),this.components.deregisterAllComponents();for(var t=0;t=0;t--)this._sceneComponents[t].enabled&&this._sceneComponents[t].update();this.entityProcessors&&this.entityProcessors.update(),this.entities.update(),this.entityProcessors&&this.entityProcessors.lateUpdate(),this.renderableComponents.updateList()},i.prototype.render=function(){if(0!=this._renderers.length)for(var t=0;te.x?-1:1,n=t.Vector2.normalize(t.Vector2.subtract(this.position,e));this.rotation=i*Math.acos(t.Vector2.dot(n,t.Vector2.unitY))},n.prototype.setLocalRotation=function(t){return this._localRotation=t,this._localDirty=this._positionDirty=this._localPositionDirty=this._localRotationDirty=this._localScaleDirty=!0,this.setDirty(e.rotationDirty),this},n.prototype.setLocalRotationDegrees=function(e){return this.setLocalRotation(t.MathHelper.toRadians(e))},n.prototype.setScale=function(e){return this._scale=e,this.parent?this.localScale=t.Vector2.divide(e,this.parent._scale):this.localScale=e,this},n.prototype.setLocalScale=function(t){return this._localScale=t,this._localDirty=this._positionDirty=this._localScaleDirty=!0,this.setDirty(e.scaleDirty),this},n.prototype.roundPosition=function(){this.position=this._position.round()},n.prototype.updateTransform=function(){this.hierarchyDirty!=e.clean&&(this.parent&&this.parent.updateTransform(),this._localDirty&&(this._localPositionDirty&&(this._translationMatrix=t.Matrix2D.create().translate(this._localPosition.x,this._localPosition.y),this._localPositionDirty=!1),this._localRotationDirty&&(this._rotationMatrix=t.Matrix2D.create().rotate(this._localRotation),this._localRotationDirty=!1),this._localScaleDirty&&(this._scaleMatrix=t.Matrix2D.create().scale(this._localScale.x,this._localScale.y),this._localScaleDirty=!1),this._localTransform=this._scaleMatrix.multiply(this._rotationMatrix),this._localTransform=this._localTransform.multiply(this._translationMatrix),this.parent||(this._worldTransform=this._localTransform,this._rotation=this._localRotation,this._scale=this._localScale,this._worldInverseDirty=!0),this._localDirty=!1),this.parent&&(this._worldTransform=this._localTransform.multiply(this.parent._worldTransform),this._rotation=this._localRotation+this.parent._rotation,this._scale=t.Vector2.multiply(this.parent._scale,this._localScale),this._worldInverseDirty=!0),this._worldToLocalDirty=!0,this._positionDirty=!0,this.hierarchyDirty=e.clean)},n.prototype.setDirty=function(e){if(0==(this.hierarchyDirty&e)){switch(this.hierarchyDirty|=e,e){case t.DirtyType.positionDirty:this.entity.onTransformChanged(transform.Component.position);break;case t.DirtyType.rotationDirty:this.entity.onTransformChanged(transform.Component.rotation);break;case t.DirtyType.scaleDirty:this.entity.onTransformChanged(transform.Component.scale)}this._children||(this._children=[]);for(var i=0;it&&(this._zoom=t),this._maximumZoom=t,this;console.error("maximumZoom must be greater than zero")},r.prototype.onEntityTransformChanged=function(t){this._areMatrixedDirty=!0},r.prototype.zoomIn=function(t){this.zoom+=t},r.prototype.zoomOut=function(t){this.zoom-=t},r.prototype.worldToScreenPoint=function(e){return this.updateMatrixes(),e=t.Vector2.transform(e,this._transformMatrix)},r.prototype.screenToWorldPoint=function(e){return this.updateMatrixes(),e=t.Vector2.transform(e,this._inverseTransformMatrix)},r.prototype.mouseToWorldPoint=function(){return this.screenToWorldPoint(t.Input.touchPosition)},r.prototype.onAddedToEntity=function(){this.follow(this._targetEntity,this._cameraStyle)},r.prototype.update=function(){var e=t.Vector2.multiply(new t.Vector2(this.bounds.width,this.bounds.height),new t.Vector2(.5));this._worldSpaceDeadZone.x=this.position.x-e.x*t.Core.scene.scaleX+this.deadzone.x+this.focusOffset.x,this._worldSpaceDeadZone.y=this.position.y-e.y*t.Core.scene.scaleY+this.deadzone.y+this.focusOffset.y,this._worldSpaceDeadZone.width=this.deadzone.width,this._worldSpaceDeadZone.height=this.deadzone.height,this._targetEntity&&this.updateFollow(),this.position=t.Vector2.lerp(this.position,t.Vector2.add(this.position,this._desiredPositionDelta),this.followLerp),this.entity.transform.roundPosition(),this.mapLockEnabled&&(this.position=this.clampToMapSize(this.position),this.entity.transform.roundPosition())},r.prototype.clampToMapSize=function(e){var i=t.Vector2.multiply(new t.Vector2(this.bounds.width,this.bounds.height),new t.Vector2(.5)).add(new t.Vector2(this.mapSize.x,this.mapSize.y)),n=new t.Vector2(this.mapSize.width-i.x,this.mapSize.height-i.y);return t.Vector2.clamp(e,i,n)},r.prototype.updateFollow=function(){if(this._desiredPositionDelta.x=this._desiredPositionDelta.y=0,this._cameraStyle==e.lockOn){var i=this._targetEntity.transform.position.x,n=this._targetEntity.transform.position.y;this._worldSpaceDeadZone.x>i?this._desiredPositionDelta.x=i-this._worldSpaceDeadZone.x:this._worldSpaceDeadZone.xn&&(this._desiredPositionDelta.y=n-this._worldSpaceDeadZone.y)}else{if(!this._targetCollider&&(this._targetCollider=this._targetEntity.getComponent(t.Collider),!this._targetCollider))return;var r=this._targetEntity.getComponent(t.Collider).bounds;this._worldSpaceDeadZone.containsRect(r)||(this._worldSpaceDeadZone.left>r.left?this._desiredPositionDelta.x=r.left-this._worldSpaceDeadZone.left:this._worldSpaceDeadZone.rightr.top&&(this._desiredPositionDelta.y=r.top-this._worldSpaceDeadZone.top))}},r.prototype.follow=function(i,n){switch(void 0===n&&(n=e.cameraWindow),this._targetEntity=i,this._cameraStyle=n,this._cameraStyle){case e.cameraWindow:var r=this.bounds.width/6,o=this.bounds.height/3;this.deadzone=new t.Rectangle((this.bounds.width-r)/2,(this.bounds.height-o)/2,r,o);break;case e.lockOn:this.deadzone=new t.Rectangle(this.bounds.width/2,this.bounds.height/2,10,10)}},r.prototype.setCenteredDeadzone=function(e,i){this.deadzone=new t.Rectangle((this.bounds.width-e)/2,(this.bounds.height-i)/2,e,i)},r.prototype.updateMatrixes=function(){var e;this._areMatrixedDirty&&(this._transformMatrix=t.Matrix2D.create().translate(-this.entity.transform.position.x,-this.entity.transform.position.y),1!=this._zoom&&(e=t.Matrix2D.create().scale(this._zoom,this._zoom),this._transformMatrix=this._transformMatrix.multiply(e)),0!=this.entity.transform.rotation&&(e=t.Matrix2D.create().rotate(this.entity.transform.rotation),this._transformMatrix=this._transformMatrix.multiply(e)),e=t.Matrix2D.create().translate(this._origin.x,this._origin.y),this._transformMatrix=this._transformMatrix.multiply(e),this._inverseTransformMatrix=this._transformMatrix.invert(),this._areBoundsDirty=!0,this._areMatrixedDirty=!1)},r}(t.Component);t.Camera=n}(es||(es={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._shakeDirection=t.Vector2.zero,i._shakeOffset=t.Vector2.zero,i._shakeIntensity=0,i._shakeDegredation=.95,i}return __extends(i,e),i.prototype.shake=function(e,i,n){void 0===e&&(e=15),void 0===i&&(i=.9),void 0===n&&(n=t.Vector2.zero),this.enabled=!0,this._shakeIntensity=1)&&(i=.95),this._shakeDegredation=i)},i.prototype.update=function(){Math.abs(this._shakeIntensity)>0&&(this._shakeOffset=this._shakeDirection,0!=this._shakeOffset.x||0!=this._shakeOffset.y?this._shakeOffset.normalize():(this._shakeOffset.x=this._shakeOffset.x+Math.random()-.5,this._shakeOffset.y=this._shakeOffset.y+Math.random()-.5),this._shakeOffset.multiply(new t.Vector2(this._shakeIntensity)),this._shakeIntensity*=-this._shakeDegredation,Math.abs(this._shakeIntensity)<=.01&&(this._shakeIntensity=0,this.enabled=!1)),this.entity.scene.camera.position.add(this._shakeOffset)},i}(t.Component);t.CameraShake=e}(es||(es={})),function(t){var e=function(){function t(t){this._type=t,this._cache=[]}return t.prototype.obtain=function(){try{return this._cache.length>0?this._cache.shift():new this._type}catch(t){throw new Error(this._type+t)}},t.prototype.free=function(t){t.reset(),this._cache.push(t)},t}();t.ComponentPool=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.compare=function(t,e){return t.updateOrder-e.updateOrder},t}();t.IUpdatableComparer=e}(es||(es={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(t.Component);t.PooledComponent=e}(es||(es={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.displayObject=new egret.DisplayObject,i.color=0,i._areBoundsDirty=!0,i._localOffset=t.Vector2.zero,i._renderLayer=0,i._bounds=new t.Rectangle,i}return __extends(i,e),Object.defineProperty(i.prototype,"width",{get:function(){return this.bounds.width},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.bounds.height},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"localOffset",{get:function(){return this._localOffset},set:function(t){this.setLocalOffset(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"renderLayer",{get:function(){return this._renderLayer},set:function(t){this.setRenderLayer(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._areBoundsDirty&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,t.Vector2.zero,this.entity.transform.scale,this.entity.transform.rotation,this.width,this.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!=t&&(this._isVisible=t,this._isVisible?this.onBecameVisible():this.onBecameInvisible())},enumerable:!0,configurable:!0}),i.prototype.onEntityTransformChanged=function(t){this._areBoundsDirty=!0},i.prototype.isVisibleFromCamera=function(t){return!!t&&(this.isVisible=t.bounds.intersects(this.displayObject.getBounds().union(this.bounds)),this.isVisible)},i.prototype.setRenderLayer=function(t){if(t!=this._renderLayer){var e=this._renderLayer;this._renderLayer=t,this.entity&&this.entity.scene&&this.entity.scene.renderableComponents.updateRenderableRenderLayer(this,e,this._renderLayer)}return this},i.prototype.setColor=function(t){return this.color=t,this},i.prototype.setLocalOffset=function(t){return this._localOffset!=t&&(this._localOffset=t),this},i.prototype.sync=function(e){var i=new t.Vector2(this.entity.position.x+this.localOffset.x-e.position.x+e.origin.x,this.entity.position.y+this.localOffset.y-e.position.y+e.origin.y);this.displayObject.x!=i.x&&(this.displayObject.x=i.x),this.displayObject.y!=i.y&&(this.displayObject.y=i.y),this.displayObject.scaleX!=this.entity.scale.x&&(this.displayObject.scaleX=this.entity.scale.x),this.displayObject.scaleY!=this.entity.scale.y&&(this.displayObject.scaleY=this.entity.scale.y),this.displayObject.rotation!=this.entity.rotation&&(this.displayObject.rotation=this.entity.rotation)},i.prototype.toString=function(){return"[RenderableComponent] renderLayer: "+this.renderLayer},i.prototype.onBecameVisible=function(){this.displayObject.visible=this.isVisible},i.prototype.onBecameInvisible=function(){this.displayObject.visible=this.isVisible},i}(t.Component);t.RenderableComponent=e}(es||(es={})),function(t){var e=function(){function e(){this.updateOrder=0,this._enabled=!0}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),e.prototype.onEnabled=function(){},e.prototype.onDisabled=function(){},e.prototype.onRemovedFromScene=function(){},e.prototype.update=function(){},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled),this},e.prototype.setUpdateOrder=function(e){return this.updateOrder!=e&&(this.updateOrder=e,t.Core.scene._sceneComponents.sort(this.compareTo)),this},e.prototype.compareTo=function(t){return this.updateOrder-t.updateOrder},e}();t.SceneComponent=e}(es||(es={})),function(t){var e=egret.Bitmap,i=function(i){function n(e){void 0===e&&(e=null);var n=i.call(this)||this;return e instanceof t.Sprite?n.setSprite(e):e instanceof egret.Texture&&n.setSprite(new t.Sprite(e)),n}return __extends(n,i),Object.defineProperty(n.prototype,"bounds",{get:function(){return this._areBoundsDirty&&this._sprite&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,this._origin,this.entity.transform.scale,this.entity.transform.rotation,this._sprite.sourceRect.width,this._sprite.sourceRect.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"originNormalized",{get:function(){return new t.Vector2(this._origin.x/this.width*this.entity.transform.scale.x,this._origin.y/this.height*this.entity.transform.scale.y)},set:function(e){this.setOrigin(new t.Vector2(e.x*this.width/this.entity.transform.scale.x,e.y*this.height/this.entity.transform.scale.y))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"origin",{get:function(){return this._origin},set:function(t){this.setOrigin(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sprite",{get:function(){return this._sprite},set:function(t){this.setSprite(t)},enumerable:!0,configurable:!0}),n.prototype.setSprite=function(t){return this._sprite=t,this._sprite&&(this._origin=this._sprite.origin,this.displayObject.anchorOffsetX=this._origin.x,this.displayObject.anchorOffsetY=this._origin.y),this.displayObject=new e(t.texture2D),this},n.prototype.setOrigin=function(t){return this._origin!=t&&(this._origin=t,this.displayObject.anchorOffsetX=this._origin.x,this.displayObject.anchorOffsetY=this._origin.y,this._areBoundsDirty=!0),this},n.prototype.setOriginNormalized=function(e){return this.setOrigin(new t.Vector2(e.x*this.width/this.entity.transform.scale.x,e.y*this.height/this.entity.transform.scale.y)),this},n.prototype.render=function(e){this.sync(e);var i=new t.Vector2(this.entity.position.x+this.localOffset.x-e.position.x+e.origin.x,this.entity.position.y+this.localOffset.y-e.position.y+e.origin.y);this.displayObject.x!=i.x&&(this.displayObject.x=i.x),this.displayObject.y!=i.y&&(this.displayObject.y=i.y)},n}(t.RenderableComponent);t.SpriteRenderer=i}(es||(es={})),function(t){var e=egret.Bitmap,i=egret.RenderTexture,n=function(n){function r(e){var i=n.call(this,e)||this;return i._textureScale=t.Vector2.one,i._inverseTexScale=t.Vector2.one,i._gapX=0,i._gapY=0,i._sourceRect=e.sourceRect,i.displayObject.$fillMode=egret.BitmapFillMode.REPEAT,i}return __extends(r,n),Object.defineProperty(r.prototype,"bounds",{get:function(){return this._areBoundsDirty&&this._sprite&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,this._origin,this.entity.transform.scale,this.entity.transform.rotation,this.width,this.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollX",{get:function(){return this._sourceRect.x},set:function(t){this._sourceRect.x=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollY",{get:function(){return this._sourceRect.y},set:function(t){this._sourceRect.y=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"textureScale",{get:function(){return this._textureScale},set:function(e){this._textureScale=e,this._inverseTexScale=new t.Vector2(1/this._textureScale.x,1/this._textureScale.y),this._sourceRect.width=this._sprite.sourceRect.width*this._inverseTexScale.x,this._sourceRect.height=this._sprite.sourceRect.height*this._inverseTexScale.y},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this._sourceRect.width},set:function(t){this._areBoundsDirty=!0,this._sourceRect.width=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this._sourceRect.height},set:function(t){this._areBoundsDirty=!0,this._sourceRect.height=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"gapXY",{get:function(){return new t.Vector2(this._gapX,this._gapY)},set:function(t){this._gapX=t.x,this._gapY=t.y;var n=new i,r=this.sprite.sourceRect;r.x=0,r.y=0,r.width+=this._gapX,r.height+=this._gapY,n.drawToTexture(this.displayObject,r),this.displayObject?this.displayObject.texture=n:this.displayObject=new e(n)},enumerable:!0,configurable:!0}),r.prototype.setGapXY=function(t){return this.gapXY=t,this},r.prototype.render=function(t){n.prototype.render.call(this,t);var e=this.displayObject;e.width=this.width,e.height=this.height,e.scrollRect=this._sourceRect},r}(t.SpriteRenderer);t.TiledSpriteRenderer=n}(es||(es={})),function(t){var e=function(e){function i(t){var i=e.call(this,t)||this;return i.scrollSpeedX=15,i.scroolSpeedY=0,i._scrollX=0,i._scrollY=0,i._scrollWidth=0,i._scrollHeight=0,i._scrollWidth=i.width,i._scrollHeight=i.height,i}return __extends(i,e),Object.defineProperty(i.prototype,"textureScale",{get:function(){return this._textureScale},set:function(e){this._textureScale=e,this._inverseTexScale=new t.Vector2(1/this._textureScale.x,1/this._textureScale.y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollWidth",{get:function(){return this._scrollWidth},set:function(t){this._scrollWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollHeight",{get:function(){return this._scrollHeight},set:function(t){this._scrollHeight=t},enumerable:!0,configurable:!0}),i.prototype.update=function(){this.sprite&&(this._scrollX+=this.scrollSpeedX*t.Time.deltaTime,this._scrollY+=this.scroolSpeedY*t.Time.deltaTime,this._sourceRect.x=this._scrollX,this._sourceRect.y=this._scrollY,this._sourceRect.width=this._scrollWidth+Math.abs(this._scrollX),this._sourceRect.height=this._scrollHeight+Math.abs(this._scrollY))},i}(t.TiledSpriteRenderer);t.ScrollingSpriteRenderer=e}(es||(es={})),function(t){var e=egret.SpriteSheet,i=function(){function i(e,i,n){void 0===i&&(i=new t.Rectangle(0,0,e.textureWidth,e.textureHeight)),void 0===n&&(n=i.getHalfSize()),this.uvs=new t.Rectangle,this.texture2D=e,this.sourceRect=i,this.center=new t.Vector2(.5*i.width,.5*i.height),this.origin=n;var r=1/e.textureWidth,o=1/e.textureHeight;this.uvs.x=i.x*r,this.uvs.y=i.y*o,this.uvs.width=i.width*r,this.uvs.height=i.height*o}return i.spritesFromAtlas=function(t,n,r,o,s){void 0===o&&(o=0),void 0===s&&(s=Number.MAX_VALUE);for(var a=[],h=t.textureWidth/n,c=t.textureHeight/r,u=0,l=new e(t),p=0;po||this._loopMode==e.pingPongOnce&&s>2*o)return this.animationState=i.completed,this._elapsedTime=0,this.currentFrame=0,void(this.displayObject.texture=n.sprites[this.currentFrame].texture2D);var a=Math.floor(s/r),h=n.sprites.length;if(h>2&&(this._loopMode==e.pingPong||this._loopMode==e.pingPongOnce)){var c=h-1;this.currentFrame=c-Math.abs(c-a%(2*c))}else this.currentFrame=a%h;this.displayObject.texture=n.sprites[this.currentFrame].texture2D}},r.prototype.addAnimation=function(t,e){return!this.sprite&&e.sprites.length>0&&this.setSprite(e.sprites[0]),this._animations[t]=e,this},r.prototype.play=function(t,n){void 0===n&&(n=null),this.currentAnimation=this._animations[t],this.currentAnimationName=t,this.currentFrame=0,this.animationState=i.running,this.displayObject.texture=this.currentAnimation.sprites[0].texture2D,this._elapsedTime=0,this._loopMode=n||e.loop},r.prototype.isAnimationActive=function(t){return this.currentAnimation&&this.currentAnimationName==t},r.prototype.pause=function(){this.animationState=i.paused},r.prototype.unPause=function(){this.animationState=i.running},r.prototype.stop=function(){this.currentAnimation=null,this.currentAnimationName=null,this.currentFrame=0,this.animationState=i.none},r}(t.SpriteRenderer);t.SpriteAnimator=n}(es||(es={})),function(t){var e=function(){function t(){}return Object.defineProperty(t.prototype,"hasCollision",{get:function(){return this.below||this.right||this.left||this.above},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.becameGroundedThisFrame=this.isGroundedOnOnewayPlatform=this.right=this.left=this.above=this.below=!1,this.slopAngle=0},t.prototype.toString=function(){return"[CollisionState] r: "+this.right+", l: "+this.left+", a: "+this.above+", b: "+this.below+", angle: "+this.slopAngle+", wasGroundedLastFrame: "+this.wasGroundedLastFrame+", becameGroundedThisFrame: "+this.becameGroundedThisFrame},t}();t.CollisionState=e;var i=function(e){function i(){var t=e.call(this)||this;return t.colliderHorizontalInset=2,t.colliderVerticalInset=6,t}return __extends(i,e),i.prototype.testCollisions=function(e,i,n){this._boxColliderBounds=i,n.wasGroundedLastFrame=n.below,n.reset();var r=e.x;e.y;if(0!=r){var o=r>0?t.Edge.right:t.Edge.left,s=this.collisionRectForSide(o,r);this.testMapCollision(s,o,n,0)?(e.x=0-t.RectangleExt.getSide(i,o),n.left=o==t.Edge.left,n.right=o==t.Edge.right,n._movementRemainderX.reset()):(n.left=!1,n.right=!1)}},i.prototype.testMapCollision=function(e,i,n,r){var o=t.EdgeExt.oppositeEdge(i);t.EdgeExt.isVertical(o)?e.center.x:e.center.y,t.RectangleExt.getSide(e,i),t.EdgeExt.isVertical(o)},i.prototype.collisionRectForSide=function(e,i){var n;return n=t.EdgeExt.isHorizontal(e)?t.RectangleExt.getRectEdgePortion(this._boxColliderBounds,e):t.RectangleExt.getHalfRect(this._boxColliderBounds,e),t.EdgeExt.isVertical(e)?t.RectangleExt.contract(n,this.colliderHorizontalInset,0):t.RectangleExt.contract(n,0,this.colliderVerticalInset),t.RectangleExt.expandSide(n,e,i),n},i}(t.Component);t.TiledMapMover=i}(es||(es={})),function(t){var e=function(e){function i(t,i,n){void 0===i&&(i=null),void 0===n&&(n=!0);var r=e.call(this)||this;return r.physicsLayer=1,r.toContainer=!1,r.tiledMap=t,r._shouldCreateColliders=n,r.displayObject=new egret.DisplayObjectContainer,i&&(r.collisionLayer=t.tileLayers[i]),r}return __extends(i,e),Object.defineProperty(i.prototype,"width",{get:function(){return this.tiledMap.width*this.tiledMap.tileWidth},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.tiledMap.height*this.tiledMap.tileHeight},enumerable:!0,configurable:!0}),i.prototype.setLayerToRender=function(t){this.layerIndicesToRender=[],this.layerIndicesToRender[0]=this.getLayerIndex(t)},i.prototype.setLayersToRender=function(){for(var t=[],e=0;e>6;0!=(e&t.LONG_MASK)&&i++,this._bits=new Array(i)}return t.prototype.and=function(t){for(var e,i=Math.min(this._bits.length,t._bits.length),n=0;n=0;)this._bits[e]&=~t._bits[e]},t.prototype.cardinality=function(){for(var t=0,e=this._bits.length-1;e>=0;e--){var i=this._bits[e];if(0!=i)if(-1!=i){var n=((i=((i=(i>>1&0x5555555555555400)+(0x5555555555555400&i))>>2&0x3333333333333400)+(0x3333333333333400&i))>>32)+i;t+=((n=((n=(n>>4&252645135)+(252645135&n))>>8&16711935)+(16711935&n))>>16&65535)+(65535&n)}else t+=64}return t},t.prototype.clear=function(t){if(null!=t){var e=t>>6;this.ensure(e),this._bits[e]&=~(1<>6;return!(e>=this._bits.length)&&0!=(this._bits[e]&1<=0;)if(0!=(this._bits[e]&t._bits[e]))return!0;return!1},t.prototype.isEmpty=function(){for(var t=this._bits.length-1;t>=0;t--)if(this._bits[t])return!1;return!0},t.prototype.nextSetBit=function(t){for(var e=t>>6,i=1<>6;this.ensure(i),this._bits[i]|=1<=this._bits.length){var e=new Number[t+1];e=this._bits.copyWithin(0,0,this._bits.length),this._bits=e}},t.LONG_MASK=63,t}();t.BitSet=e}(es||(es={})),function(t){var e=function(){function e(t){this._components=[],this._componentsToAdd=[],this._componentsToRemove=[],this._tempBufferList=[],this._entity=t}return Object.defineProperty(e.prototype,"count",{get:function(){return this._components.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._components},enumerable:!0,configurable:!0}),e.prototype.markEntityListUnsorted=function(){this._isComponentListUnsorted=!0},e.prototype.add=function(t){this._componentsToAdd.push(t)},e.prototype.remove=function(t){this._componentsToRemove.contains(t)&&console.warn("You are trying to remove a Component ("+t+") that you already removed"),this._componentsToAdd.contains(t)?this._componentsToAdd.remove(t):this._componentsToRemove.push(t)},e.prototype.removeAllComponents=function(){for(var t=0;t0){for(var i=0;i0){i=0;for(var n=this._componentsToAdd.length;i0){var e=this._entitiesToRemove;this._entitiesToRemove=this._tempEntityList,this._tempEntityList=e,this._tempEntityList.forEach(function(e){t.removeFromTagList(e),t._entities.remove(e),e.onRemovedFromScene(),e.scene=null,t.scene.entityProcessors.onEntityRemoved(e)}),this._tempEntityList.length=0}if(this._entitiesToAdded.length>0){e=this._entitiesToAdded;this._entitiesToAdded=this._tempEntityList,this._tempEntityList=e,this._tempEntityList.forEach(function(e){t._entities.contains(e)||(t._entities.push(e),e.scene=t.scene,t.addToTagList(e),t.scene.entityProcessors.onEntityAdded(e))}),this._tempEntityList.forEach(function(t){return t.onAddedToScene()}),this._tempEntityList.length=0,this._isEntityListUnsorted=!0}this._isEntityListUnsorted&&(this._entities.sort(),this._isEntityListUnsorted=!1),this._unsortedTags.length>0&&(this._unsortedTags.forEach(function(e){t._entityDict.get(e).sort()}),this._unsortedTags.length=0)},e.prototype.findEntity=function(t){for(var e=0;e=0;e=this.allSet.nextSetBit(e+1))if(!t.componentBits.get(e))return!1;return!(!this.exclusionSet.isEmpty()&&this.exclusionSet.intersects(t.componentBits))&&!(!this.oneSet.isEmpty()&&!this.oneSet.intersects(t.componentBits))},e.prototype.all=function(){for(var e=this,i=[],n=0;n0){for(var t=0,i=this._unsortedRenderLayers.length;t=e)return t;var n=!1;"-"==t.substr(0,1)&&(n=!0,t=t.substr(1));for(var r=e-i,o=0;o1?this.reverse(t.substring(1))+t.substring(0,1):t},t.cutOff=function(t,e,i,n){void 0===n&&(n=!0),e=Math.floor(e),i=Math.floor(i);var r=t.length;e>r&&(e=r);var o,s=e,a=e+i;return n?o=t.substring(0,s)+t.substr(a,r):(a=(s=r-1-e-i)+i,o=t.substring(0,s+1)+t.substr(a+1,r)),o},t.strReplace=function(t,e){for(var i=0,n=e.length;i",">",'"',""","'","'","®","®","©","©","™","™"],t}();!function(t){var e=function(){function e(){}return e.convertImageToCanvas=function(e,i){this.sharedCanvas||(this.sharedCanvas=egret.sys.createCanvas(),this.sharedContext=this.sharedCanvas.getContext("2d"));var n=e.$getTextureWidth(),r=e.$getTextureHeight();i||((i=egret.$TempRectangle).x=0,i.y=0,i.width=n,i.height=r),i.x=Math.min(i.x,n-1),i.y=Math.min(i.y,r-1),i.width=Math.min(i.width,n-i.x),i.height=Math.min(i.height,r-i.y);var o=Math.floor(i.width),s=Math.floor(i.height),a=this.sharedCanvas;if(a.style.width=o+"px",a.style.height=s+"px",this.sharedCanvas.width=o,this.sharedCanvas.height=s,"webgl"==egret.Capabilities.renderMode){var h=void 0;e.$renderBuffer?h=e:(egret.sys.systemRenderer.renderClear&&egret.sys.systemRenderer.renderClear(),(h=new egret.RenderTexture).drawToTexture(new egret.Bitmap(e)));for(var c=h.$renderBuffer.getPixels(i.x,i.y,o,s),u=0,l=0,p=0;p=0?"png":"jpg"});return wx.getFileSystemManager().saveFile({tempFilePath:o,filePath:wx.env.USER_DATA_PATH+"/"+i,success:function(t){}}),o},e.getPixel32=function(t,e,i){return egret.$warn(1041,"getPixel32","getPixels"),t.getPixels(e,i)},e.getPixels=function(t,e,i,n,r){if(void 0===n&&(n=1),void 0===r&&(r=1),"webgl"==egret.Capabilities.renderMode){var o=void 0;return t.$renderBuffer?o=t:(o=new egret.RenderTexture).drawToTexture(new egret.Bitmap(t)),o.$renderBuffer.getPixels(e,i,n,r)}try{this.convertImageToCanvas(t);return this.sharedContext.getImageData(e,i,n,r).data}catch(t){egret.$error(1039)}},e}();t.TextureUtils=e}(es||(es={})),function(t){var e=function(){function t(){}return t.update=function(t){var e=(t-this._lastTime)/1e3;this.deltaTime=e*this.timeScale,this.unscaledDeltaTime=e,this._timeSinceSceneLoad+=e,this.frameCount++,this._lastTime=t},t.sceneChanged=function(){this._timeSinceSceneLoad=0},t.checkEvery=function(t){return this._timeSinceSceneLoad/t>(this._timeSinceSceneLoad-this.deltaTime)/t},t.deltaTime=0,t.timeScale=1,t.frameCount=0,t._lastTime=0,t}();t.Time=e}(es||(es={}));var TimeUtils=function(){function t(){}return t.monthId=function(t){void 0===t&&(t=null);var e=(t=t||new Date).getFullYear(),i=t.getMonth()+1;return parseInt(e+(i<10?"0":"")+i)},t.dateId=function(t){void 0===t&&(t=null);var e=(t=t||new Date).getMonth()+1,i=e<10?"0":"",n=t.getDate(),r=n<10?"0":"";return parseInt(t.getFullYear()+i+e+r+n)},t.weekId=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!0),t=t||new Date;var i=new Date;i.setTime(t.getTime()),i.setDate(1),i.setMonth(0);var n=i.getFullYear(),r=i.getDay();0==r&&(r=7);var o=!1;r<=4?(o=r>1,i.setDate(i.getDate()-(r-1))):i.setDate(i.getDate()+7-r+1);var s=this.diffDay(t,i,!1);if(s<0)return i.setDate(1),i.setMonth(0),i.setDate(i.getDate()-1),this.weekId(i,!1);var a=s/7,h=Math.floor(a)+1;if(53==h){i.setTime(t.getTime()),i.setDate(i.getDate()-1);var c=i.getDay();if(0==c&&(c=7),e&&(!o||c<4))return i.setFullYear(i.getFullYear()+1),i.setDate(1),i.setMonth(0),this.weekId(i,!1)}return parseInt(n+"00"+(h>9?"":"0")+h)},t.diffDay=function(t,e,i){void 0===i&&(i=!1);var n=(t.getTime()-e.getTime())/864e5;return i?Math.ceil(n):Math.floor(n)},t.getFirstDayOfWeek=function(t){var e=(t=t||new Date).getDay()||7;return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1-e,0,0,0,0)},t.getFirstOfDay=function(t){return(t=t||new Date).setHours(0,0,0,0),t},t.getNextFirstOfDay=function(t){return new Date(this.getFirstOfDay(t).getTime()+864e5)},t.formatDate=function(t){var e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();return e+"-"+i+"-"+(n=n<10?"0"+n:n)},t.formatDateTime=function(t){var e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();n=n<10?"0"+n:n;var r=t.getHours(),o=t.getMinutes();o=o<10?"0"+o:o;var s=t.getSeconds();return e+"-"+i+"-"+n+" "+r+":"+o+":"+(s=s<10?"0"+s:s)},t.parseDate=function(t){var e=Date.parse(t);return isNaN(e)?new Date:new Date(Date.parse(t.replace(/-/g,"/")))},t.secondToTime=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=":"),void 0===i&&(i=!0);var n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=Math.floor(t%3600%60),s=n.toString(),a=r.toString(),h=o.toString();return n<10&&(s="0"+s),r<10&&(a="0"+a),o<10&&(h="0"+h),i?s+e+a+e+h:a+e+h},t.timeToMillisecond=function(t,e){void 0===e&&(e=":");for(var i=t.split(e),n=0,r=i.length,o=0;o-1?this.os="iOS":n.indexOf("android")>-1&&(this.os="Android");var r=i.language;r=r.indexOf("zh")>-1?"zh-CN":"en-US",this.language=r}},e}(egret.Capabilities);t.GraphicsCapabilities=e}(es||(es={})),function(t){var e=function(){function e(){this.setup(),this.graphicsCapabilities=new t.GraphicsCapabilities,this.graphicsCapabilities.initialize(this)}return Object.defineProperty(e.prototype,"viewport",{get:function(){return this._viewport},enumerable:!0,configurable:!0}),e.prototype.setup=function(){this._viewport=new t.Viewport(0,0,t.Core._instance.stage.stageWidth,t.Core._instance.stage.stageHeight)},e}();t.GraphicsDevice=e}(es||(es={})),function(t){var e=function(){function e(t,e,i,n){this._x=t,this._y=e,this._width=i,this._height=n,this._minDepth=0,this._maxDepth=1}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatio",{get:function(){return 0!=this._height&&0!=this._width?this._width/this._height:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){return new t.Rectangle(this._x,this._y,this._width,this._height)},set:function(t){this._x=t.x,this._y=t.y,this._width=t.width,this._height=t.height},enumerable:!0,configurable:!0}),e}();t.Viewport=e}(es||(es={})),function(t){var e=function(e){function i(){return e.call(this,t.PostProcessor.default_vert,i.blur_frag,{screenWidth:t.Core.graphicsDevice.viewport.width,screenHeight:t.Core.graphicsDevice.viewport.height})||this}return __extends(i,e),i.blur_frag="precision mediump float;\nuniform sampler2D uSampler;\nuniform float screenWidth;\nuniform float screenHeight;\nfloat normpdf(in float x, in float sigma)\n{\nreturn 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;\n}\nvoid main()\n{\nvec3 c = texture2D(uSampler, gl_FragCoord.xy / vec2(screenWidth, screenHeight).xy).rgb;\nconst int mSize = 11;\nconst int kSize = (mSize - 1)/2;\nfloat kernel[mSize];\nvec3 final_colour = vec3(0.0);\nfloat sigma = 7.0;\nfloat z = 0.0;\nfor (int j = 0; j <= kSize; ++j)\n{\nkernel[kSize+j] = kernel[kSize-j] = normpdf(float(j),sigma);\n}\nfor (int j = 0; j < mSize; ++j)\n{\nz += kernel[j];\n}\nfor (int i = -kSize; i <= kSize; ++i)\n{\nfor (int j = -kSize; j <= kSize; ++j)\n{\nfinal_colour += kernel[kSize+j]*kernel[kSize+i]*texture2D(uSampler, (gl_FragCoord.xy+vec2(float(i),float(j))) / vec2(screenWidth, screenHeight).xy).rgb;\n}\n}\ngl_FragColor = vec4(final_colour/(z*z), 1.0);\n}",i}(egret.CustomFilter);t.GaussianBlurEffect=e}(es||(es={})),function(t){var e=function(t){function e(){return t.call(this,e.vertSrc,e.fragmentSrc)||this}return __extends(e,t),e.vertSrc="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\n gl_Position = vec4( (aVertexPosition / projectionVector) + center , 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e.fragmentSrc="precision lowp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n#define SAMPLE_COUNT 15\nuniform vec2 _sampleOffsets[SAMPLE_COUNT];\nuniform float _sampleWeights[SAMPLE_COUNT];\nvoid main(void) {\nvec4 c = vec4(0, 0, 0, 0);\nfor( int i = 0; i < SAMPLE_COUNT; i++ )\n c += texture2D( uSampler, vTextureCoord + _sampleOffsets[i] ) * _sampleWeights[i];\ngl_FragColor = c;\n}",e}(egret.CustomFilter);t.PolygonLightEffect=e}(es||(es={})),function(t){var e=function(){function e(t){void 0===t&&(t=null),this.enabled=!0,this.effect=t}return e.prototype.onAddedToScene=function(e){this.scene=e,this.shape=new egret.Shape,this.shape.graphics.beginFill(16777215,1),this.shape.graphics.drawRect(0,0,t.Core.graphicsDevice.viewport.width,t.Core.graphicsDevice.viewport.height),this.shape.graphics.endFill(),e.addChild(this.shape)},e.prototype.process=function(){this.drawFullscreenQuad()},e.prototype.onSceneBackBufferSizeChanged=function(t,e){},e.prototype.unload=function(){this.effect&&(this.effect=null),this.scene.removeChild(this.shape),this.scene=null},e.prototype.drawFullscreenQuad=function(){this.scene.filters=[this.effect]},e.default_vert="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aColor;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\ngl_Position = vec4( (aVertexPosition / projectionVector) + center , 0.0, 1.0);\nvTextureCoord = aTextureCoord;\nvColor = vec4(aColor.x, aColor.x, aColor.x, aColor.x);\n}",e}();t.PostProcessor=e}(es||(es={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return __extends(i,e),i.prototype.onAddedToScene=function(i){e.prototype.onAddedToScene.call(this,i),this.effect=new t.GaussianBlurEffect},i}(t.PostProcessor);t.GaussianBlurPostProcessor=e}(es||(es={})),function(t){var e=function(){function t(t,e){void 0===e&&(e=null),this.renderOrder=0,this.shouldDebugRender=!0,this.camera=e,this.renderOrder=t}return Object.defineProperty(t.prototype,"wantsToRenderToSceneRenderTarget",{get:function(){return!!this.renderTexture},enumerable:!0,configurable:!0}),t.prototype.onAddedToScene=function(t){},t.prototype.unload=function(){},t.prototype.onSceneBackBufferSizeChanged=function(t,e){},t.prototype.compareTo=function(t){return this.renderOrder-t.renderOrder},t.prototype.beginRender=function(t){},t.prototype.renderAfterStateCheck=function(t,e){t.render(e)},t.prototype.debugRender=function(t,e){for(var i=0;ii?i:t},e.pointOnCirlce=function(i,n,r){var o=e.toRadians(r);return new t.Vector2(Math.cos(o)*o+i.x,Math.sin(o)*o+i.y)},e.isEven=function(t){return t%2==0},e.clamp01=function(t){return t<0?0:t>1?1:t},e.angleBetweenVectors=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},e.incrementWithWrap=function(t,e){return++t==e?0:t},e.approach=function(t,e,i){return tn&&(n=s.x),s.yr&&(r=s.y)}return this.fromMinMax(e,i,n,r)},i.prototype.intersects=function(t){return t.leftthis.x+this.width)return e}else{var n=1/t.direction.x,r=(this.x-t.start.x)*n,o=(this.x+this.width-t.start.x)*n;if(r>o){var s=r;r=o,o=s}if((e=Math.max(r,e))>(i=Math.min(o,i)))return e}if(Math.abs(t.direction.y)<1e-6){if(t.start.ythis.y+this.height)return e}else{var a=1/t.direction.y,h=(this.y-t.start.y)*a,c=(this.y+this.height-t.start.y)*a;if(h>c){var u=h;h=c,c=u}if((e=Math.max(h,e))>(i=Math.max(c,i)))return e}return e},i.prototype.containsRect=function(t){return this.x<=t.x&&t.x1)return!1;var u=(h.x*o.y-h.y*o.x)/a;return!(u<0||u>1)},i.lineToLineIntersection=function(e,i,n,r){var o=new t.Vector2(0,0),s=t.Vector2.subtract(i,e),a=t.Vector2.subtract(r,n),h=s.x*a.y-s.y*a.x;if(0==h)return o;var c=t.Vector2.subtract(n,e),u=(c.x*a.y-c.y*a.x)/h;if(u<0||u>1)return o;var l=(c.x*s.y-c.y*s.x)/h;return l<0||l>1?o:o=t.Vector2.add(e,new t.Vector2(u*s.x,u*s.y))},i.closestPointOnLine=function(e,i,n){var r=t.Vector2.subtract(i,e),o=t.Vector2.subtract(n,e),s=t.Vector2.dot(o,r)/t.Vector2.dot(r,r);return s=t.MathHelper.clamp(s,0,1),t.Vector2.add(e,new t.Vector2(r.x*s,r.y*s))},i.isCircleToCircle=function(e,i,n,r){return t.Vector2.distanceSquared(e,n)<(i+r)*(i+r)},i.isCircleToLine=function(e,i,n,r){return t.Vector2.distanceSquared(e,this.closestPointOnLine(n,r,e))=t&&r.y>=e&&r.x=t+n&&(s|=e.right),o.y=i+r&&(s|=e.bottom),s},i}();t.Collisions=i}(es||(es={})),function(t){var e=function(){function e(e,i,n,r,o){this.fraction=0,this.distance=0,this.point=t.Vector2.zero,this.normal=t.Vector2.zero,this.collider=e,this.fraction=i,this.distance=n,this.point=r,this.centroid=t.Vector2.zero}return e.prototype.setValues=function(t,e,i,n){this.collider=t,this.fraction=e,this.distance=i,this.point=n},e.prototype.setValuesNonCollider=function(t,e,i,n){this.fraction=t,this.distance=e,this.point=i,this.normal=n},e.prototype.reset=function(){this.collider=null,this.fraction=this.distance=0},e.prototype.toString=function(){return"[RaycastHit] fraction: "+this.fraction+", distance: "+this.distance+", normal: "+this.normal+", centroid: "+this.centroid+", point: "+this.point},e}();t.RaycastHit=e}(es||(es={})),function(t){var e=function(){function e(){}return e.reset=function(){this._spatialHash=new t.SpatialHash(this.spatialHashCellSize)},e.clear=function(){this._spatialHash.clear()},e.overlapCircleAll=function(t,e,i,n){if(void 0===n&&(n=-1),0!=i.length)return this._spatialHash.overlapCircle(t,e,i,n);console.error("An empty results array was passed in. No results will ever be returned.")},e.boxcastBroadphase=function(t,e){return void 0===e&&(e=this.allLayers),this._spatialHash.aabbBroadphase(t,null,e)},e.boxcastBroadphaseExcludingSelf=function(t,e,i){return void 0===i&&(i=this.allLayers),this._spatialHash.aabbBroadphase(e,t,i)},e.addCollider=function(t){e._spatialHash.register(t)},e.removeCollider=function(t){e._spatialHash.remove(t)},e.updateCollider=function(t){this._spatialHash.remove(t),this._spatialHash.register(t)},e.linecast=function(t,i,n){return void 0===n&&(n=e.allLayers),this._hitArray[0].reset(),this.linecastAll(t,i,this._hitArray,n),this._hitArray[0]},e.linecastAll=function(t,i,n,r){return void 0===r&&(r=e.allLayers),0==n.length?(console.warn("传入了一个空的hits数组。没有点击会被返回"),0):this._spatialHash.linecast(t,i,n,r)},e.debugDraw=function(t){this._spatialHash.debugDraw(t,2)},e.spatialHashCellSize=100,e.allLayers=-1,e.raycastsHitTriggers=!1,e.raycastsStartInColliders=!1,e._hitArray=[new t.RaycastHit],e}();t.Physics=e}(es||(es={})),function(t){var e=function(){return function(e,i){this.start=e,this.end=i,this.direction=t.Vector2.subtract(this.end,this.start)}}();t.Ray2D=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.clone=function(){return ObjectUtils.clone(this)},t}();t.Shape=e}(es||(es={})),function(t){var e=function(e){function i(t,i){var n=e.call(this)||this;return n._areEdgeNormalsDirty=!0,n.isUnrotated=!0,n.setPoints(t),n.isBox=i,n}return __extends(i,e),Object.defineProperty(i.prototype,"edgeNormals",{get:function(){return this._areEdgeNormalsDirty&&this.buildEdgeNormals(),this._edgeNormals},enumerable:!0,configurable:!0}),i.prototype.setPoints=function(t){this.points=t,this.recalculateCenterAndEdgeNormals(),this._originalPoints=[];for(var e=0;e=this.points.length?this.points[0]:this.points[n+1];var o=t.Vector2Ext.perpendicular(r,e);o=t.Vector2.normalize(o),this._edgeNormals[n]=o}},i.buildSymmetricalPolygon=function(e,i){for(var n=new Array(e),r=0;rr&&(r=s,n=o)}return e[n]},i.getClosestPointOnPolygonToPoint=function(e,i,n,r){n=Number.MAX_VALUE,r=new t.Vector2(0,0);for(var o,s=new t.Vector2(0,0),a=0;ae.y!=this.points[r].y>e.y&&e.x<(this.points[r].x-this.points[n].x)*(e.y-this.points[n].y)/(this.points[r].y-this.points[n].y)+this.points[n].x&&(i=!i);return i},i.prototype.pointCollidesWithShape=function(e,i){return t.ShapeCollisions.pointToPoly(e,this,i)},i}(t.Shape);t.Polygon=e}(es||(es={})),function(t){var e=function(e){function i(t,n){var r=e.call(this,i.buildBox(t,n),!0)||this;return r.width=t,r.height=n,r}return __extends(i,e),i.buildBox=function(e,i){var n=e/2,r=i/2,o=new Array(4);return o[0]=new t.Vector2(-n,-r),o[1]=new t.Vector2(n,-r),o[2]=new t.Vector2(n,r),o[3]=new t.Vector2(-n,r),o},i.prototype.updateBox=function(e,i){this.width=e,this.height=i;var n=e/2,r=i/2;this.points[0]=new t.Vector2(-n,-r),this.points[1]=new t.Vector2(n,-r),this.points[2]=new t.Vector2(n,r),this.points[3]=new t.Vector2(-n,r);for(var o=0;o1)return s;var a,h=t.Vector2.add(o.start,t.Vector2.add(o.direction,new t.Vector2(s))),c=0;h.xi.bounds.right&&(c|=1),h.yi.bounds.bottom&&(c|=2);var u=a+c;return 3==u&&console.log("m == 3. corner "+t.Time.frameCount),s},e}();t.RealtimeCollisions=e}(es||(es={})),function(t){var e=function(){function e(){}return e.polygonToPolygon=function(e,i,n){for(var r,o=!0,s=e.edgeNormals,a=i.edgeNormals,h=Number.POSITIVE_INFINITY,c=new t.Vector2,u=t.Vector2.subtract(e.position,i.position),l=0;l0&&(o=!1),!o)return!1;(m=Math.abs(m))r&&(r=o);return{min:n,max:r}},e.circleToPolygon=function(e,i,n){var r,o=t.Vector2.subtract(e.position,i.position),s=t.Polygon.getClosestPointOnPolygonToPoint(i.points,o,0,n.normal),a=i.containsPoint(e.position);if(0>e.radius*e.radius&&!a)return!1;a?r=t.Vector2.multiply(n.normal,new t.Vector2(Math.sqrt(0)-e.radius)):r=t.Vector2.multiply(n.normal,new t.Vector2(e.radius));return n.minimumTranslationVector=r,n.point=t.Vector2.add(s,i.position),!0},e.circleToBox=function(e,i,n){var r=i.bounds.getClosestPointOnRectangleBorderToPoint(e.position,n.normal);if(i.containsPoint(e.position)){n.point=r;var o=t.Vector2.add(r,t.Vector2.multiply(n.normal,new t.Vector2(e.radius)));return n.minimumTranslationVector=t.Vector2.subtract(e.position,o),!0}var s=t.Vector2.distanceSquared(r,e.position);if(0==s)n.minimumTranslationVector=t.Vector2.multiply(n.normal,new t.Vector2(e.radius));else if(s<=e.radius*e.radius){n.normal=t.Vector2.subtract(e.position,r);var a=n.normal.length()-e.radius;return n.point=r,n.normal=t.Vector2Ext.normalize(n.normal),n.minimumTranslationVector=t.Vector2.multiply(new t.Vector2(a),n.normal),!0}return!1},e.pointToCircle=function(e,i,n){var r=t.Vector2.distanceSquared(e,i.position),o=1+i.radius;if(r1)return!1;var l=(c.x*s.y-c.y*s.x)/h;return!(l<0||l>1)&&(o=o.add(e).add(t.Vector2.multiply(new t.Vector2(u),s)),!0)},e.lineToCircle=function(e,i,n,r){var o=t.Vector2.distance(e,i),s=t.Vector2.divide(t.Vector2.subtract(i,e),new t.Vector2(o)),a=t.Vector2.subtract(e,n.position),h=t.Vector2.dot(a,s),c=t.Vector2.dot(a,a)-n.radius*n.radius;if(c>0&&h>0)return!1;var u=h*h-c;return!(u<0)&&(r.fraction=-h-Math.sqrt(u),r.fraction<0&&(r.fraction=0),r.point=t.Vector2.add(e,t.Vector2.multiply(new t.Vector2(r.fraction),s)),r.distance=t.Vector2.distance(e,r.point),r.normal=t.Vector2.normalize(t.Vector2.subtract(r.point,n.position)),r.fraction=r.distance/o,!0)},e.boxToBoxCast=function(e,i,n,r){var o=this.minkowskiDifference(e,i);if(o.contains(0,0)){var s=o.getClosestPointOnBoundsToOrigin();return!s.equals(t.Vector2.zero)&&(r.normal=new t.Vector2(-s.x),r.normal=r.normal.normalize(),r.distance=0,r.fraction=0,!0)}var a=new t.Ray2D(t.Vector2.zero,new t.Vector2(-n.x)),h=o.rayIntersects(a);return h<=1&&(r.fraction=h,r.distance=n.length()*h,r.normal=new t.Vector2(-n.x),r.normal=r.normal.normalize(),r.centroid=t.Vector2.add(e.bounds.center,t.Vector2.multiply(n,new t.Vector2(h))),!0)},e}();t.ShapeCollisions=e}(es||(es={})),function(t){var e=function(){function e(e){void 0===e&&(e=100),this.gridBounds=new t.Rectangle,this._overlapTestCircle=new t.Circle(0),this._cellDict=new i,this._tempHashSet=[],this._cellSize=e,this._inverseCellSize=1/this._cellSize,this._raycastParser=new n}return e.prototype.register=function(e){var i=e.bounds;e.registeredPhysicsBounds=i;var n=this.cellCoords(i.x,i.y),r=this.cellCoords(i.right,i.bottom);this.gridBounds.contains(n.x,n.y)||(this.gridBounds=t.RectangleExt.union(this.gridBounds,n)),this.gridBounds.contains(r.x,r.y)||(this.gridBounds=t.RectangleExt.union(this.gridBounds,r));for(var o=n.x;o<=r.x;o++)for(var s=n.y;s<=r.y;s++){var a=this.cellAtPosition(o,s,!0);a.firstOrDefault(function(t){return t.hashCode==e.hashCode})||a.push(e)}},e.prototype.remove=function(t){for(var e=t.registeredPhysicsBounds,i=this.cellCoords(e.x,e.y),n=this.cellCoords(e.right,e.bottom),r=i.x;r<=n.x;r++)for(var o=i.y;o<=n.y;o++){var s=this.cellAtPosition(r,o);s?s.remove(t):console.log("从不存在碰撞器的单元格中移除碰撞器: ["+t+"]")}},e.prototype.removeWithBruteForce=function(t){this._cellDict.remove(t)},e.prototype.clear=function(){this._cellDict.clear()},e.prototype.debugDraw=function(t,e){void 0===e&&(e=1);for(var i=this.gridBounds.x;i<=this.gridBounds.right;i++)for(var n=this.gridBounds.y;n<=this.gridBounds.bottom;n++){var r=this.cellAtPosition(i,n);r&&r.length>0&&this.debugDrawCellDetails(i,n,r.length,t,e)}},e.prototype.aabbBroadphase=function(e,i,n){this._tempHashSet.length=0;for(var r=this.cellCoords(e.x,e.y),o=this.cellCoords(e.right,e.bottom),s=r.x;s<=o.x;s++)for(var a=r.y;a<=o.y;a++){var h=this.cellAtPosition(s,a);if(h)for(var c=function(r){var o=h[r];if(o==i||!t.Flags.isFlagSet(n,o.physicsLayer))return"continue";e.intersects(o.bounds)&&(u._tempHashSet.firstOrDefault(function(t){return t.hashCode==o.hashCode})||u._tempHashSet.push(o))},u=this,l=0;l=0&&(e.push(this.findBoundsRect(i,o,r,t)),i=-1)}i>=0&&(e.push(this.findBoundsRect(i,this.map.width,r,t)),i=-1)}return e},e.prototype.findBoundsRect=function(e,i,n,r){for(var o=-1,s=n+1;sthis.tileHeight||this.maxTileWidth>this.tileWidth},enumerable:!0,configurable:!0}),i.prototype.getTilesetForTileGid=function(t){if(0==t)return null;for(var e=this.tilesets.length-1;e>=0;e--)if(this.tilesets[e].firstGid<=t)return this.tilesets[e];console.error("tile gid"+t+"未在任何tileset中找到")},i.prototype.worldToTilePositionX=function(e,i){void 0===i&&(i=!0);var n=Math.floor(e/this.tileWidth);return i?t.MathHelper.clamp(n,0,this.width-1):n},i.prototype.worldToTilePositionY=function(e,i){void 0===i&&(i=!0);var n=Math.floor(e/this.tileHeight);return i?t.MathHelper.clamp(n,0,this.height-1):n},i.prototype.getLayer=function(t){return this.layers[t]},i.prototype.update=function(){this.tilesets.forEach(function(t){t.update()})},i.prototype.dispose=function(t){void 0===t&&(t=!0),this._isDisposed||(t&&(this.tilesets.forEach(function(t){t.image&&t.image.dispose()}),this.imageLayers.forEach(function(t){t.image&&t.image.dispose()})),this._isDisposed=!0)},i}(t.TmxDocument);t.TmxMap=e,function(t){t[t.unknown=0]="unknown",t[t.orthogonal=1]="orthogonal",t[t.isometric=2]="isometric",t[t.staggered=3]="staggered",t[t.hexagonal=4]="hexagonal"}(t.OrientationType||(t.OrientationType={})),function(t){t[t.x=0]="x",t[t.y=1]="y"}(t.StaggerAxisType||(t.StaggerAxisType={})),function(t){t[t.odd=0]="odd",t[t.even=1]="even"}(t.StaggerIndexType||(t.StaggerIndexType={})),function(t){t[t.rightDown=0]="rightDown",t[t.rightUp=1]="rightUp",t[t.leftDown=2]="leftDown",t[t.leftUp=3]="leftUp"}(t.RenderOrderType||(t.RenderOrderType={}))}(es||(es={})),function(t){var e=function(){return function(){}}();t.TmxObjectGroup=e;var i=function(){return function(){this.shape=new egret.Shape,this.textField=new egret.TextField}}();t.TmxObject=i;var n=function(){return function(){}}();t.TmxText=n;var r=function(){return function(){}}();t.TmxAlignment=r,function(t){t[t.basic=0]="basic",t[t.point=1]="point",t[t.tile=2]="tile",t[t.ellipse=3]="ellipse",t[t.polygon=4]="polygon",t[t.polyline=5]="polyline",t[t.text=6]="text"}(t.TmxObjectType||(t.TmxObjectType={})),function(t){t[t.unkownOrder=-1]="unkownOrder",t[t.TopDown=0]="TopDown",t[t.IndexOrder=1]="IndexOrder"}(t.DrawOrderType||(t.DrawOrderType={})),function(t){t[t.left=0]="left",t[t.center=1]="center",t[t.right=2]="right",t[t.justify=3]="justify"}(t.TmxHorizontalAlignment||(t.TmxHorizontalAlignment={})),function(t){t[t.top=0]="top",t[t.center=1]="center",t[t.bottom=2]="bottom"}(t.TmxVerticalAlignment||(t.TmxVerticalAlignment={}))}(es||(es={})),function(t){var e=function(){function e(){}return e.loadTmxMap=function(t,e){var i=RES.getRes(e);return this.loadTmxMapData(t,i)},e.loadTmxMapData=function(e,i){return __awaiter(this,void 0,void 0,function(){var n,r,o,s;return __generator(this,function(a){switch(a.label){case 0:e.version=i.version,e.tiledVersion=i.tiledversion,e.width=i.width,e.height=i.height,e.tileWidth=i.tilewidth,e.tileHeight=i.tileheight,e.hexSideLength=i.hexsidelength,e.orientation=this.parseOrientationType(i.orientation),e.staggerAxis=this.parseStaggerAxisType(i.staggeraxis),e.staggerIndex=this.parseStaggerIndexType(i.staggerindex),e.renderOrder=this.parseRenderOrderType(i.renderorder),e.nextObjectID=i.nextobjectid,e.backgroundColor=t.TmxUtils.color16ToUnit(i.color),e.properties=this.parsePropertyDict(i.properties),e.maxTileWidth=e.tileWidth,e.maxTileHeight=e.tileHeight,e.tilesets=[],n=0,r=i.tilesets,a.label=1;case 1:return nt.map.maxTileWidth&&(t.map.maxTileWidth=e.image.width),e.image.height>t.map.maxTileHeight&&(t.map.maxTileHeight=e.image.height))}),t.tileRegions.forEach(function(e){var i=e.width,n=e.height;i>t.map.maxTileWidth&&(t.map.maxTileWidth=i),i>t.map.maxTileHeight&&(t.map.maxTileHeight=n)})},e.parseOrientationType=function(e){return"unknown"==e?t.OrientationType.unknown:"orthogonal"==e?t.OrientationType.orthogonal:"isometric"==e?t.OrientationType.isometric:"staggered"==e?t.OrientationType.staggered:"hexagonal"==e?t.OrientationType.hexagonal:t.OrientationType.unknown},e.parseStaggerAxisType=function(e){return"y"==e?t.StaggerAxisType.y:t.StaggerAxisType.x},e.parseStaggerIndexType=function(e){return"even"==e?t.StaggerIndexType.even:t.StaggerIndexType.odd},e.parseRenderOrderType=function(e){return"right-up"==e?t.RenderOrderType.rightUp:"left-down"==e?t.RenderOrderType.leftDown:"left-up"==e?t.RenderOrderType.leftUp:t.RenderOrderType.rightDown},e.parsePropertyDict=function(e){if(!e)return null;for(var i=new Map,n=0,r=e;n=e.columns));y+=e.tileWidth+e.spacing);else e.tiles.forEach(function(i,n){e.tileRegions.set(n,new t.Rectangle(0,0,i.image.width,i.image.height))});return[2,e]}})})},e.loadTmxTilesetTile=function(e,i,n,r,o){return __awaiter(this,void 0,void 0,function(){var s,a,h,c,u,l,p,d,f,g,m,y,_;return __generator(this,function(v){switch(v.label){case 0:if(e.tileset=i,e.id=n.id,s=n.terrain)for(e.terrainEdges=new Array(4),a=0,h=0,c=s;h0){a.shape.x=h.x,a.shape.y=h.y,i.addChild(a.shape),a.shape.graphics.clear(),a.shape.graphics.lineStyle(1,10526884);for(l=0;l0&&(u=l.currentAnimationFrameGid);var p=i.tileset.tileRegions.get(u),d=Math.floor(i.x)*s,f=Math.floor(i.y)*a;i.horizontalFlip&&i.verticalFlip?(d+=a+(p.height*o.y-a),f-=p.width*o.x-s):i.horizontalFlip?d+=s+(p.height*o.y-a):i.verticalFlip?f+=s-p.width*o.x:f+=a-p.height*o.y;var g=new t.Vector2(d,f).add(r);if(i.tileset.image){if(n){var m=i.tileset.image.bitmap.getTexture(""+u);m||(m=i.tileset.image.bitmap.createTexture(""+u,p.x,p.y,p.width,p.height)),i.tileset.image.texture=new e(m),n.addChild(i.tileset.image.texture),i.tileset.image.texture.x!=g.x&&(i.tileset.image.texture.x=g.x),i.tileset.image.texture.y!=g.y&&(i.tileset.image.texture.y=g.y),i.verticalFlip&&i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=-1):i.verticalFlip?(i.tileset.image.texture.scaleX=o.x,i.tileset.image.texture.scaleY=-1):i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=o.y):(i.tileset.image.texture.scaleX=o.x,i.tileset.image.texture.scaleY=o.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 l.image.texture&&(l.image.bitmap.getTexture(u.toString())||(l.image.texture=new e(l.image.bitmap.createTexture(u.toString(),p.x,p.y,p.width,p.height)),n.addChild(l.image.texture)),l.image.texture.x=g.x,l.image.texture.y=g.y,l.image.texture.scaleX=o.x,l.image.texture.scaleY=o.y,l.image.texture.rotation=0,l.image.texture.anchorOffsetX=0,l.image.texture.anchorOffsetY=0,l.image.texture.filters=[h])},i}();t.TiledRendering=i}(es||(es={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e.prototype.update=function(){this.tiles.forEach(function(t){t.updateAnimatedTiles()})},e}(t.TmxDocument);t.TmxTileset=e;var i=function(){return function(){}}();t.TmxTileOffset=i;var n=function(){return function(){}}();t.TmxTerrain=n}(es||(es={})),function(t){var e=function(){function e(){}return Object.defineProperty(e.prototype,"currentAnimationFrameGid",{get:function(){return this.animationFrames[this._animationCurrentFrame].gid+this.tileset.firstGid},enumerable:!0,configurable:!0}),e.prototype.processProperties=function(){var t;(t=this.properties.get("engine.isDestructable"))&&(this.isDestructable=Boolean(t)),(t=this.properties.get("engine:isSlope"))&&(this.isSlope=Boolean(t)),(t=this.properties.get("engine:isOneWayPlatform"))&&(this.isOneWayPlatform=Boolean(t)),(t=this.properties.get("engine:slopeTopLeft"))&&(this.slopeTopLeft=Number(t)),(t=this.properties.get("engine:slopeTopRight"))&&(this.slopeTopRight=Number(t))},e.prototype.updateAnimatedTiles=function(){0!=this.animationFrames.length&&(this._animationElapsedTime+=t.Time.deltaTime,this._animationElapsedTime>this.animationFrames[this._animationCurrentFrame].duration&&(this._animationCurrentFrame=t.MathHelper.incrementWithWrap(this._animationCurrentFrame,this.animationFrames.length),this._animationElapsedTime=0))},e}();t.TmxTilesetTile=e;var i=function(){return function(){}}();t.TmxAnimationFrame=i}(es||(es={})),function(t){var e=function(){function e(){}return e.decode=function(e,i,n){switch(n=n||"none",i=i||"none"){case"base64":var r=t.Base64Utils.decodeBase64AsArray(e,4);return"none"===n?r:t.Base64Utils.decompress(e,r,n);case"csv":return t.Base64Utils.decodeCSV(e);case"none":for(var o=[],s=0;si;n--)if(t[n]0&&t[r-1]>n;r--)t[r]=t[r-1];t[r]=n}},t.binarySearch=function(t,e){for(var i=0,n=t.length,r=i+n>>1;i=t[r]&&(i=r+1),r=i+n>>1;return t[i]==e?i:-1},t.findElementIndex=function(t,e){for(var i=t.length,n=0;nt[e]&&(e=n);return e},t.getMinElementIndex=function(t){for(var e=0,i=t.length,n=1;n=0;--r)i.unshift(e[r]);return i},t.getDifferAry=function(t,e){t=this.getUniqueAry(t),e=this.getUniqueAry(e);for(var i=t.concat(e),n={},r=[],o=i.length,s=0;s=0;e-=1)t.splice(e,1)},t.cloneList=function(t){return t?t.slice(0,t.length):null},t.equals=function(t,e){if(t==e)return!0;var i=t.length;if(i!=e.length)return!1;for(;i--;)if(t[i]!=e[i])return!1;return!0},t.insert=function(t,e,i){if(!t)return null;var n=t.length;if(e>n&&(e=n),e<0&&(e=0),e==n)t.push(i);else if(0==e)t.unshift(i);else{for(var r=n-1;r>=e;r-=1)t[r+1]=t[r];t[e]=i}return i},t}();!function(t){var e=function(){function t(){}return Object.defineProperty(t,"nativeBase64",{get:function(){return"function"==typeof window.atob},enumerable:!0,configurable:!0}),t.decode=function(t){if(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),this.nativeBase64)return window.atob(t);for(var e,i,n,r,o,s,a=[],h=0;h>4,i=(15&r)<<4|(o=this._keyStr.indexOf(t.charAt(h++)))>>2,n=(3&o)<<6|(s=this._keyStr.indexOf(t.charAt(h++))),a.push(String.fromCharCode(e)),64!==o&&a.push(String.fromCharCode(i)),64!==s&&a.push(String.fromCharCode(n));return a=a.join("")},t.encode=function(t){if(t=t.replace(/\r\n/g,"\n"),!this.nativeBase64){for(var e,i,n,r,o,s,a,h=[],c=0;c>2,o=(3&e)<<4|(i=t.charCodeAt(c++))>>4,s=(15&i)<<2|(n=t.charCodeAt(c++))>>6,a=63&n,isNaN(i)?s=a=64:isNaN(n)&&(a=64),h.push(this._keyStr.charAt(r)),h.push(this._keyStr.charAt(o)),h.push(this._keyStr.charAt(s)),h.push(this._keyStr.charAt(a));return h=h.join("")}window.btoa(t)},t.decodeBase64AsArray=function(e,i){i=i||1;var n,r,o,s=t.decode(e),a=new Uint32Array(s.length/i);for(n=0,o=s.length/i;n=0;--r)a[n]+=s.charCodeAt(n*i+r)<<(r<<3);return a},t.decompress=function(t,e,i){throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!")},t.decodeCSV=function(t){for(var e=t.replace("\n","").trim().split(","),i=[],n=0;n>16},set:function(t){this._packedValue=4278255615&this._packedValue|t<<16},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"g",{get:function(){return this._packedValue>>8},set:function(t){this._packedValue=4294902015&this._packedValue|t<<8},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"r",{get:function(){return this._packedValue},set:function(t){this._packedValue=4294967040&this._packedValue|t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"a",{get:function(){return this._packedValue>>24},set:function(t){this._packedValue=16777215&this._packedValue|t<<24},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"packedValue",{get:function(){return this._packedValue},set:function(t){this._packedValue=t},enumerable:!0,configurable:!0}),e.prototype.equals=function(t){return this._packedValue==t._packedValue},e}();t.Color=e}(es||(es={})),function(t){var e=function(){function t(){this.loadedAssets=new Map}return t.prototype.loadRes=function(t,e){var i=this;return void 0===e&&(e=!0),new Promise(function(n,r){var o=i.loadedAssets.get(t);o?n(o):e?RES.getResAsync(t).then(function(e){i.loadedAssets.set(t,e),n(e)}).catch(function(e){console.error("资源加载错误:",t,e),r(e)}):RES.getResByUrl(t).then(function(e){i.loadedAssets.set(t,e),n(e)}).catch(function(e){console.error("资源加载错误:",t,e),r(e)})})},t.prototype.dispose=function(){this.loadedAssets.forEach(function(t){var e=t;RES.destroyRes(e)&&e.dispose()}),this.loadedAssets.clear()},t}();t.ContentManager=e}(es||(es={})),function(t){var e=function(){function t(){}return t.getColorMatrix=function(t){var e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];return e[0]=Math.floor(t/256/256)/255,e[6]=Math.floor(t/256%256)/255,e[12]=t%256/255,new egret.ColorMatrixFilter(e)},t}();t.DrawUtils=e}(es||(es={})),function(t){var e=function(){function e(){}return e.oppositeEdge=function(e){switch(e){case t.Edge.bottom:return t.Edge.top;case t.Edge.top:return t.Edge.bottom;case t.Edge.left:return t.Edge.right;case t.Edge.right:return t.Edge.left}},e.isHorizontal=function(e){return e==t.Edge.right||e==t.Edge.left},e.isVertical=function(e){return e==t.Edge.top||e==t.Edge.bottom},e}();t.EdgeExt=e}(es||(es={})),function(t){var e=function(){return function(t,e){this.func=t,this.context=e}}();t.FuncPack=e;var i=function(){function t(){this._messageTable=new Map}return t.prototype.addObserver=function(t,i,n){var r=this._messageTable.get(t);r||(r=[],this._messageTable.set(t,r)),-1!=r.findIndex(function(t){return t.func==i})&&console.warn("您试图添加相同的观察者两次"),r.push(new e(i,n))},t.prototype.removeObserver=function(t,e){var i=this._messageTable.get(t),n=i.findIndex(function(t){return t.func==e});-1!=n&&i.removeAt(n)},t.prototype.emit=function(t,e){var i=this._messageTable.get(t);if(i)for(var n=i.length-1;n>=0;n--)i[n].func.call(i[n].context,e)},t}();t.Emitter=i}(es||(es={})),function(t){!function(t){t[t.top=0]="top",t[t.bottom=1]="bottom",t[t.left=2]="left",t[t.right=3]="right"}(t.Edge||(t.Edge={}))}(es||(es={})),function(t){var e=function(){function t(){}return t.repeat=function(t,e){for(var i=[];e--;)i.push(t);return i},t}();t.Enumerable=e}(es||(es={})),function(t){var e=function(){function t(){}return Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),t.prototype.setEnabled=function(t){this._enabled!=t&&(this._enabled=t,this._enabled?this.onEnabled():this.onDisabled())},t.prototype.onEnabled=function(){},t.prototype.onDisabled=function(){},t.prototype.update=function(){},t}();t.GlobalManager=e}(es||(es={})),function(t){var e=function(){function e(){this.x=0,this.y=0,this.touchPoint=-1,this.touchDown=!1}return Object.defineProperty(e.prototype,"position",{get:function(){return new t.Vector2(this.x,this.y)},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this.x=0,this.y=0,this.touchDown=!1,this.touchPoint=-1},e}();t.TouchState=e;var i=function(){function i(){}return Object.defineProperty(i,"gameTouchs",{get:function(){return this._gameTouchs},enumerable:!0,configurable:!0}),Object.defineProperty(i,"resolutionScale",{get:function(){return this._resolutionScale},enumerable:!0,configurable:!0}),Object.defineProperty(i,"totalTouchCount",{get:function(){return this._totalTouchCount},enumerable:!0,configurable:!0}),Object.defineProperty(i,"touchPosition",{get:function(){return this._gameTouchs[0]?this._gameTouchs[0].position:t.Vector2.zero},enumerable:!0,configurable:!0}),Object.defineProperty(i,"maxSupportedTouch",{get:function(){return t.Core._instance.stage.maxTouches},set:function(e){t.Core._instance.stage.maxTouches=e,this.initTouchCache()},enumerable:!0,configurable:!0}),Object.defineProperty(i,"touchPositionDelta",{get:function(){var e=t.Vector2.subtract(this.touchPosition,this._previousTouchState.position);return e.length()>0&&this.setpreviousTouchState(this._gameTouchs[0]),e},enumerable:!0,configurable:!0}),i.initialize=function(){this._init||(this._init=!0,t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.touchBegin,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.touchMove,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_END,this.touchEnd,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_CANCEL,this.touchEnd,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_RELEASE_OUTSIDE,this.touchEnd,this),this.initTouchCache())},i.scaledPosition=function(e){var i=new t.Vector2(e.x-this._resolutionOffset.x,e.y-this._resolutionOffset.y);return t.Vector2.multiply(i,this.resolutionScale)},i.initTouchCache=function(){this._totalTouchCount=0,this._touchIndex=0,this._gameTouchs.length=0;for(var t=0;t0)for(var e=0;ethis._objectQueue.length;)this._objectQueue.shift()},t.clearCache=function(){this._objectQueue.length=0},t.obtain=function(){return this._objectQueue.length>0?this._objectQueue.shift():[]},t.free=function(t){this._objectQueue.unshift(t),t.length=0},t._objectQueue=[],t}();t.ListPool=e}(es||(es={}));var THREAD_ID=Math.floor(1e3*Math.random())+"-"+Date.now(),nextTick=function(t){setTimeout(t,0)},LockUtils=function(){function t(t){this._keyX="mutex_key_"+t+"_X",this._keyY="mutex_key_"+t+"_Y",this.setItem=egret.localStorage.setItem.bind(localStorage),this.getItem=egret.localStorage.getItem.bind(localStorage),this.removeItem=egret.localStorage.removeItem.bind(localStorage)}return t.prototype.lock=function(){var t=this;return new Promise(function(e,i){var n=function(){t.setItem(t._keyX,THREAD_ID),null===!t.getItem(t._keyY)&&nextTick(n),t.setItem(t._keyY,THREAD_ID),t.getItem(t._keyX)!==THREAD_ID?setTimeout(function(){t.getItem(t._keyY)===THREAD_ID?(e(),t.removeItem(t._keyY)):nextTick(n)},10):(e(),t.removeItem(t._keyY))};n()})},t}();!function(t){var e=function(){function t(t,e){this.first=t,this.second=e}return t.prototype.clear=function(){this.first=this.second=null},t.prototype.equals=function(t){return this.first==t.first&&this.second==t.second},t}();t.Pair=e}(es||(es={}));var RandomUtils=function(){function t(){}return t.randrange=function(t,e,i){if(void 0===i&&(i=1),0==i)throw new Error("step 不能为 0");var n=e-t;if(0==n)throw new Error("没有可用的范围("+t+","+e+")");n<0&&(n=t-e);var r=Math.floor((n+i-1)/i);return Math.floor(this.random()*r)*i+Math.min(t,e)},t.randint=function(t,e){return(t=Math.floor(t))>(e=Math.floor(e))?t++:e++,this.randrange(t,e)},t.randnum=function(t,e){return this.random()*(e-t)+t},t.shuffle=function(t){return t.sort(this._randomCompare),t},t.choice=function(t){if(!t.hasOwnProperty("length"))throw new Error("无法对此对象执行此操作");var e=Math.floor(this.random()*t.length);return t instanceof String?String(t).charAt(e):t[e]},t.sample=function(t,e){var i=t.length;if(e<=0||i=0;)s=Math.floor(this.random()*i);n.push(t[s]),r.push(s)}return n},t.random=function(){return Math.random()},t.boolean=function(t){return void 0===t&&(t=.5),this.random().5?1:-1},t}();!function(t){var e=function(){function e(){}return e.getSide=function(e,i){switch(i){case t.Edge.top:return e.top;case t.Edge.bottom:return e.bottom;case t.Edge.left:return e.left;case t.Edge.right:return e.right}},e.union=function(e,i){var n=new t.Rectangle(i.x,i.y,0,0),r=new t.Rectangle;return r.x=Math.min(e.x,n.x),r.y=Math.min(e.y,n.y),r.width=Math.max(e.right,n.right)-r.x,r.height=Math.max(e.bottom,r.bottom)-r.y,r},e.getHalfRect=function(e,i){switch(i){case t.Edge.top:return new t.Rectangle(e.x,e.y,e.width,e.height/2);case t.Edge.bottom:return new t.Rectangle(e.x,e.y+e.height/2,e.width,e.height/2);case t.Edge.left:return new t.Rectangle(e.x,e.y,e.width/2,e.height);case t.Edge.right:return new t.Rectangle(e.x+e.width/2,e.y,e.width/2,e.height)}},e.getRectEdgePortion=function(e,i,n){switch(void 0===n&&(n=1),i){case t.Edge.top:return new t.Rectangle(e.x,e.y,e.width,n);case t.Edge.bottom:return new t.Rectangle(e.x,e.y+e.height-n,e.width,n);case t.Edge.left:return new t.Rectangle(e.x,e.y,n,e.height);case t.Edge.right:return new t.Rectangle(e.x+e.width-n,e.y,n,e.height)}},e.expandSide=function(e,i,n){switch(n=Math.abs(n),i){case t.Edge.top:e.y-=n,e.height+=n;break;case t.Edge.bottom:e.height+=n;break;case t.Edge.left:e.x-=n,e.width+=n;break;case t.Edge.right:e.width+=n}},e.contract=function(t,e,i){t.x+=e,t.y+=i,t.width-=2*e,t.height-=2*i},e}();t.RectangleExt=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.update=function(t){this.remainder+=t;var e=Math.trunc(this.remainder);return this.remainder-=e,e},t.prototype.reset=function(){this.remainder=0},t}();t.SubpixelNumber=e}(es||(es={})),function(t){var e=function(){function e(){this.triangleIndices=[],this._triPrev=new Array(12),this._triNext=new Array(12)}return e.testPointTriangle=function(e,i,n,r){return!(t.Vector2Ext.cross(t.Vector2.subtract(e,i),t.Vector2.subtract(n,i))<0)&&(!(t.Vector2Ext.cross(t.Vector2.subtract(e,n),t.Vector2.subtract(r,n))<0)&&!(t.Vector2Ext.cross(t.Vector2.subtract(e,r),t.Vector2.subtract(i,r))<0))},e.prototype.triangulate=function(i,n){void 0===n&&(n=!0);var r=i.length;this.initialize(r);for(var o=0,s=0;r>3&&o<500;){o++;var a=!0,h=i[this._triPrev[s]],c=i[s],u=i[this._triNext[s]];if(t.Vector2Ext.isTriangleCCW(h,c,u)){var l=this._triNext[this._triNext[s]];do{if(e.testPointTriangle(i[l],h,c,u)){a=!1;break}l=this._triNext[l]}while(l!=this._triPrev[s])}else a=!1;a?(this.triangleIndices.push(this._triPrev[s]),this.triangleIndices.push(s),this.triangleIndices.push(this._triNext[s]),this._triNext[this._triPrev[s]]=this._triNext[s],this._triPrev[this._triNext[s]]=this._triPrev[s],r--,s=this._triPrev[s]):s=this._triNext[s]}this.triangleIndices.push(this._triPrev[s]),this.triangleIndices.push(s),this.triangleIndices.push(this._triNext[s]),n||this.triangleIndices.reverse()},e.prototype.initialize=function(t){this.triangleIndices.length=0,this._triNext.lengtht.MathHelper.Epsilon?e=t.Vector2.divide(e,new t.Vector2(i)):e.x=e.y=0,e},e.transformA=function(t,e,i,n,r,o){for(var s=0;sthis.safeArea.right&&(s.x=this.safeArea.right-s.width),s.topthis.safeArea.bottom&&(s.y=this.safeArea.bottom-s.height),s},i}();t.Layout=i,function(t){t[t.none=0]="none",t[t.left=1]="left",t[t.right=2]="right",t[t.horizontalCenter=4]="horizontalCenter",t[t.top=8]="top",t[t.bottom=16]="bottom",t[t.verticalCenter=32]="verticalCenter",t[t.topLeft=9]="topLeft",t[t.topRight=10]="topRight",t[t.topCenter=12]="topCenter",t[t.bottomLeft=17]="bottomLeft",t[t.bottomRight=18]="bottomRight",t[t.bottomCenter=20]="bottomCenter",t[t.centerLeft=33]="centerLeft",t[t.centerRight=34]="centerRight",t[t.center=36]="center"}(e=t.Alignment||(t.Alignment={}))}(es||(es={})),function(t){var e,i=function(){function t(t){void 0===t&&(t=n),this.getSystemTime=t,this._stopDuration=0,this._completeSlices=[]}return t.prototype.getState=function(){return void 0===this._startSystemTime?e.IDLE:void 0===this._stopSystemTime?e.RUNNING:e.STOPPED},t.prototype.isIdle=function(){return this.getState()===e.IDLE},t.prototype.isRunning=function(){return this.getState()===e.RUNNING},t.prototype.isStopped=function(){return this.getState()===e.STOPPED},t.prototype.slice=function(){return this.recordPendingSlice()},t.prototype.getCompletedSlices=function(){return Array.from(this._completeSlices)},t.prototype.getCompletedAndPendingSlices=function(){return this._completeSlices.concat([this.getPendingSlice()])},t.prototype.getPendingSlice=function(){return this.calculatePendingSlice()},t.prototype.getTime=function(){return this.caculateStopwatchTime()},t.prototype.reset=function(){this._startSystemTime=this._pendingSliceStartStopwatchTime=this._stopSystemTime=void 0,this._stopDuration=0,this._completeSlices=[]},t.prototype.start=function(t){if(void 0===t&&(t=!1),t&&this.reset(),void 0!==this._stopSystemTime){var e=(i=this.getSystemTime())-this._stopSystemTime;this._stopDuration+=e,this._stopSystemTime=void 0}else if(void 0===this._startSystemTime){var i=this.getSystemTime();this._startSystemTime=i,this._pendingSliceStartStopwatchTime=0}},t.prototype.stop=function(t){if(void 0===t&&(t=!1),void 0===this._startSystemTime)return 0;var e=this.getSystemTimeOfCurrentStopwatchTime();return t&&this.recordPendingSlice(this.caculateStopwatchTime(e)),this._stopSystemTime=e,this.getTime()},t.prototype.calculatePendingSlice=function(t){return void 0===this._pendingSliceStartStopwatchTime?Object.freeze({startTime:0,endTime:0,duration:0}):(void 0===t&&(t=this.getTime()),Object.freeze({startTime:this._pendingSliceStartStopwatchTime,endTime:t,duration:t-this._pendingSliceStartStopwatchTime}))},t.prototype.caculateStopwatchTime=function(t){return void 0===this._startSystemTime?0:(void 0===t&&(t=this.getSystemTimeOfCurrentStopwatchTime()),t-this._startSystemTime-this._stopDuration)},t.prototype.getSystemTimeOfCurrentStopwatchTime=function(){return void 0===this._stopSystemTime?this.getSystemTime():this._stopSystemTime},t.prototype.recordPendingSlice=function(t){if(void 0!==this._pendingSliceStartStopwatchTime){void 0===t&&(t=this.getTime());var e=this.calculatePendingSlice(t);return this._pendingSliceStartStopwatchTime=e.endTime,this._completeSlices.push(e),e}return this.calculatePendingSlice()},t}();t.Stopwatch=i,function(t){t.IDLE="IDLE",t.RUNNING="RUNNING",t.STOPPED="STOPPED"}(e||(e={})),t.setDefaultSystemTimeGetter=function(t){void 0===t&&(t=Date.now),n=t};var n=Date.now}(stopwatch||(stopwatch={})),function(t){var e=function(){function e(){this.showLog=!1,this._frameKey="frame",this._logKey="log",this.markers=[],this.stopwacth=new stopwatch.Stopwatch,this._markerNameToIdMap=new Map,this._logs=new Array(2);for(var e=0;e=e.logSnapDuration&&(l.logs[r].snapMin=l.logs[r].min,l.logs[r].snapMax=l.logs[r].max,l.logs[r].snapAvg=l.logs[r].avg,l.logs[r].samples=0)):(l.logs[r].min=c,l.logs[r].max=c,l.logs[r].avg=c,l.logs[r].initialized=!0)}s.markCount=o.nestCount,s.nestCount=o.nestCount}t.stopwacth.reset(),t.stopwacth.start()}})},e.prototype.beginMark=function(t,i,n){var r=this;void 0===n&&(n=0),new LockUtils(this._frameKey).lock().then(function(){if(n<0||n>=e.maxBars)throw new Error("barIndex argument out of range");var o=r._curLog.bars[n];if(o.markCount>=e.maxSamples)throw new Error("exceeded sample count. either set larger number to timeruler.maxsaple or lower sample count");if(o.nestCount>=e.maxNestCall)throw new Error("exceeded nest count. either set larger number to timeruler.maxnestcall or lower nest calls");var s=r._markerNameToIdMap.get(t);isNaN(s)&&(s=r.markers.length,r._markerNameToIdMap.set(t,s)),o.markerNests[o.nestCount++]=o.markCount,o.markers[o.markCount].markerId=s,o.markers[o.markCount].color=i,o.markers[o.markCount].beginTime=r.stopwacth.getTime(),o.markers[o.markCount].endTime=-1})},e.prototype.endMark=function(t,i){var n=this;void 0===i&&(i=0),new LockUtils(this._frameKey).lock().then(function(){if(i<0||i>=e.maxBars)throw new Error("barIndex argument out of range");var r=n._curLog.bars[i];if(r.nestCount<=0)throw new Error("call beginMark method before calling endMark method");var o=n._markerNameToIdMap.get(t);if(isNaN(o))throw new Error("Marker "+t+" is not registered. Make sure you specifed same name as you used for beginMark method");var s=r.markerNests[--r.nestCount];if(r.markers[s].markerId!=o)throw new Error("Incorrect call order of beginMark/endMark method. beginMark(A), beginMark(B), endMark(B), endMark(A) But you can't called it like beginMark(A), beginMark(B), endMark(A), endMark(B).");r.markers[s].endTime=n.stopwacth.getTime()})},e.prototype.getAverageTime=function(t,i){if(t<0||t>=e.maxBars)throw new Error("barIndex argument out of range");var n=0,r=this._markerNameToIdMap.get(i);return r&&(n=this.markers[r].logs[t].avg),n},e.prototype.resetLog=function(){var t=this;new LockUtils(this._logKey).lock().then(function(){var e=parseInt(egret.localStorage.getItem(t._logKey),10);e+=1,egret.localStorage.setItem(t._logKey,e.toString()),t.markers.forEach(function(t){for(var e=0;e0&&(n+=e.barHeight+2*e.barPadding,r=Math.max(r,t.markers[t.markCount-1].endTime))});var o=this.sampleFrames*(1/60*1e3);this._frameAdjust=r>o?Math.max(0,this._frameAdjust)+1:Math.min(0,this._frameAdjust)-1,Math.max(this._frameAdjust)>e.autoAdjustDelay&&(this.sampleFrames=Math.min(e.maxSampleFrames,this.sampleFrames),this.sampleFrames=Math.max(this.targetSampleFrames,r/(1/60*1e3)+1),this._frameAdjust=0);t.y,e.barHeight}},e.prototype.onGraphicsDeviceReset=function(){var i=new t.Layout;this._position=i.place(new t.Vector2(this.width,e.barHeight),0,.01,t.Alignment.bottomCenter).location},e.maxBars=8,e.maxSamples=256,e.maxNestCall=32,e.barHeight=8,e.maxSampleFrames=4,e.logSnapDuration=120,e.barPadding=2,e.autoAdjustDelay=30,e}();t.TimeRuler=e;var i=function(){return function(){this.bars=new Array(e.maxBars),this.bars.fill(new n,0,e.maxBars)}}();t.FrameLog=i;var n=function(){return function(){this.markers=new Array(e.maxSamples),this.markCount=0,this.markerNests=new Array(e.maxNestCall),this.nestCount=0,this.markers.fill(new r,0,e.maxSamples),this.markerNests.fill(0,0,e.maxNestCall)}}();t.MarkerCollection=n;var r=function(){return function(){this.markerId=0,this.beginTime=0,this.endTime=0,this.color=0}}();t.Marker=r;var o=function(){return function(t){this.logs=new Array(e.maxBars),this.name=t,this.logs.fill(new s,0,e.maxBars)}}();t.MarkerInfo=o;var s=function(){return function(){this.snapMin=0,this.snapMax=0,this.snapAvg=0,this.min=0,this.max=0,this.avg=0,this.samples=0,this.color=0,this.initialized=!1}}();t.MarkerLog=s}(es||(es={})),function(t){var e=egret.Bitmap,i=function(){function i(){this.itemsToRaster=[],this.useCache=!1,this.cacheName="",this._sprites=new Map,this.allow4096Textures=!1}return i.prototype.addTextureToPack=function(e,i){this.itemsToRaster.push(new t.TextureToPack(e,i))},i.prototype.process=function(t){return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.allow4096Textures=t,this.useCache?""==this.cacheName?(console.error("未指定缓存名称"),[2]):[4,RES.getResByUrl(this.cacheName)]:[3,2];case 1:return e.sent()?this.loadPack():this.createPack(),[3,3];case 2:this.createPack(),e.label=3;case 3:return[2]}})})},i.prototype.loadPack=function(){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,RES.getResByUrl(this.cacheName)];case 1:return t=e.sent(),this.onProcessCompleted&&this.onProcessCompleted(),[2,t]}})})},i.prototype.createPack=function(){for(var i=[],n=[],r=0,o=this.itemsToRaster;ra||i[c].height>a)throw new Error("一个纹理的大小比图集的大小大");h.push(new t.Rectangle(0,0,i[c].width,i[c].height))}for(;h.length>0;){var u=new egret.RenderTexture,l=new t.RectanglePacker(a,a,1);for(c=0;c0){for(var p=new t.IntegerRectangle,d=[],f=[],g=[],m=[],y=0;y0;)this.freeRectangle(this._insertedRectangles.pop());for(;this._freeAreas.length>0;)this.freeRectangle(this._freeAreas.pop());for(this._width=t,this._height=e,this._packedWidth=0,this._packedHeight=0,this._freeAreas.push(this.allocateRectangle(0,0,this._width,this._height));this._insertedRectangles.length>0;)this.freeSize(this._insertList.pop());this._padding=i},e.prototype.insertRectangle=function(t,e,i){var n=this.allocateSize(t,e,i);this._insertList.push(n)},e.prototype.packRectangles=function(t){for(void 0===t&&(t=!0),t&&this._insertList.sort(function(t,e){return t.width-e.width});this._insertList.length>0;){var e=this._insertList.pop(),i=e.width,n=e.height,r=this.getFreeAreaIndex(i,n);if(r>=0){var o=this._freeAreas[r],s=this.allocateRectangle(o.x,o.y,i,n);for(s.id=e.id,this.generateNewFreeAreas(s,this._freeAreas,this._newFreeAreas);this._newFreeAreas.length>0;)this._freeAreas.push(this._newFreeAreas.pop());this._insertedRectangles.push(s),s.right>this._packedWidth&&(this._packedWidth=s.right),s.bottom>this._packedHeight&&(this._packedHeight=s.bottom)}this.freeSize(e)}return this.rectangleCount},e.prototype.getRectangle=function(t,e){var i=this._insertedRectangles[t];return e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height,e},e.prototype.getRectangleId=function(t){return this._insertedRectangles[t].id},e.prototype.generateNewFreeAreas=function(t,e,i){var n=t.x,r=t.y,o=t.right+1+this._padding,s=t.bottom+1+this._padding,a=null;0==this._padding&&(a=t);for(var h=e.length-1;h>=0;h--){var c=e[h];if(!(n>=c.right||o<=c.x||r>=c.bottom||s<=c.y)){null==a&&(a=this.allocateRectangle(t.x,t.y,t.width+this._padding,t.height+this._padding)),this.generateDividedAreas(a,c,i);var u=e.pop();h=0;e--)for(var i=t[e],n=t.length-1;n>=0;n--)if(e!=n){var r=t[n];if(i.x>=r.x&&i.y>=r.y&&i.right<=r.right&&i.bottom<=r.bottom){this.freeRectangle(i);var o=t.pop();e0&&(i.push(this.allocateRectangle(t.right,e.y,r,e.height)),n++);var o=t.x-e.x;o>0&&(i.push(this.allocateRectangle(e.x,e.y,o,e.height)),n++);var s=e.bottom-t.bottom;s>0&&(i.push(this.allocateRectangle(e.x,t.bottom,e.width,s)),n++);var a=t.y-e.y;a>0&&(i.push(this.allocateRectangle(e.x,e.y,e.width,a)),n++),0==n&&(t.width=0;s--){var a=this._freeAreas[s];if(a.x0){var r=this._sortableSizeStack.pop();return r.width=e,r.height=i,r.id=n,r}return new t.SortableSize(e,i,n)},e.prototype.freeSize=function(t){this._sortableSizeStack.push(t)},e.prototype.allocateRectangle=function(e,i,n,r){if(this._rectangleStack.length>0){var o=this._rectangleStack.pop();return o.x=e,o.y=i,o.width=n,o.height=r,o.right=e+n,o.bottom=i+r,o}return new t.IntegerRectangle(e,i,n,r)},e.prototype.freeRectangle=function(t){this._rectangleStack.push(t)},e}();t.RectanglePacker=e}(es||(es={})),function(t){var e=function(){return function(t,e,i){this.width=t,this.height=e,this.id=i}}();t.SortableSize=e}(es||(es={})),function(t){var e=function(){return function(t){this.assets=t}}();t.TextureAssets=e;var i=function(){return function(){}}();t.TextureAsset=i}(es||(es={})),function(t){var e=function(){return function(t,e){this.texture=t,this.id=e}}();t.TextureToPack=e}(es||(es={})); \ No newline at end of file diff --git a/demo/manifest.json b/demo/manifest.json index e7053c78..a8718627 100644 --- a/demo/manifest.json +++ b/demo/manifest.json @@ -17,7 +17,7 @@ "bin-debug/UI/mvc/BaseView.js", "bin-debug/SampleHelpers/SampleScene.js", "bin-debug/UI/loading/LoadingView.js", - "bin-debug/Scenes/LineCasting/LineCaster.js", + "bin-debug/Scenes/LineCasting/LineCastingScene.js", "bin-debug/Fgui/common/UI_com_tips.js", "bin-debug/Fgui/loading/loadingBinder.js", "bin-debug/Fgui/loading/UI_View_loading.js", @@ -27,8 +27,10 @@ "bin-debug/Platform.js", "bin-debug/Scenes/Animated Tiles/AnimatedTilesScene.js", "bin-debug/Scenes/Empty Scene/BasicScene.js", + "bin-debug/Scenes/LineCasting/LineCaster.js", "bin-debug/Main.js", - "bin-debug/Scenes/LineCasting/LineCastingScene.js", + "bin-debug/Scenes/Ninja Adventure/Ninja.js", + "bin-debug/Scenes/Ninja Adventure/NinjaAdventureScene.js", "bin-debug/UI/PopManager.js", "bin-debug/UI/loading/LoadingControl.js", "bin-debug/UI/loading/LoadingEvents.js", diff --git a/demo/resource/characters/1.png b/demo/resource/characters/1.png new file mode 100644 index 0000000000000000000000000000000000000000..fc1ef1d3d2680b52d005fad81211acfdda198ca8 GIT binary patch literal 4980 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 Rzd-;1002ovPDHLkV1hbwOA7!1 literal 0 HcmV?d00001 diff --git a/demo/resource/characters/5.png b/demo/resource/characters/5.png new file mode 100644 index 0000000000000000000000000000000000000000..9209fabb1f5d64ff64f91477ff55e965a4453758 GIT binary patch literal 5263 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 V^<_3WX;1(F002ovPDHLkV1i#Y|Jncm literal 0 HcmV?d00001 diff --git a/demo/resource/characters/6.png b/demo/resource/characters/6.png new file mode 100644 index 0000000000000000000000000000000000000000..cb325998ecaa08c59dab8b412cd9882abecc45a0 GIT binary patch literal 4999 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 R(G>sy002ovPDHLkV1l(RaSQ+e literal 0 HcmV?d00001 diff --git a/demo/resource/default.res.json b/demo/resource/default.res.json index a694d201..89a63324 100644 --- a/demo/resource/default.res.json +++ b/demo/resource/default.res.json @@ -15,6 +15,10 @@ { "keys": "common", "name": "common" + }, + { + "keys": "1_png,2_png,3_png,4_png,5_png,6_png", + "name": "characters" } ], "resources": [ @@ -67,6 +71,36 @@ "url": "preload/orthogonal-outside.json", "type": "json", "name": "orthogonal-outside_json" + }, + { + "url": "characters/1.png", + "type": "image", + "name": "1_png" + }, + { + "url": "characters/2.png", + "type": "image", + "name": "2_png" + }, + { + "url": "characters/3.png", + "type": "image", + "name": "3_png" + }, + { + "url": "characters/4.png", + "type": "image", + "name": "4_png" + }, + { + "url": "characters/5.png", + "type": "image", + "name": "5_png" + }, + { + "url": "characters/6.png", + "type": "image", + "name": "6_png" } ] } \ No newline at end of file diff --git a/demo/src/Scenes/Ninja Adventure/Ninja.ts b/demo/src/Scenes/Ninja Adventure/Ninja.ts new file mode 100644 index 00000000..b23de2c6 --- /dev/null +++ b/demo/src/Scenes/Ninja Adventure/Ninja.ts @@ -0,0 +1,50 @@ +module samples { + import SpriteAnimator = es.SpriteAnimator; + import Mover = es.Mover; + + export class Ninja extends es.Component { + public _animator: SpriteAnimator; + + public _mover: Mover; + + public onAddedToEntity(): void { + let characterPng = RandomUtils.randint(1, 6); + this.entity.scene.content.loadRes(`${characterPng}_png`).then(texture => { + let sprites = es.Sprite.spritesFromAtlas(texture, 16, 16); + + this._mover = this.entity.addComponent(new Mover()); + this._animator = this.entity.addComponent(new SpriteAnimator()); + + this._animator.addAnimation("walkLeft", new es.SpriteAnimation([ + sprites[2], + sprites[6], + sprites[10], + sprites[14] + ], 4)); + + this._animator.addAnimation("walkRight", new es.SpriteAnimation([ + sprites[3], + sprites[7], + sprites[11], + sprites[15] + ], 4)); + + this._animator.addAnimation("walkDown", new es.SpriteAnimation([ + sprites[0], + sprites[4], + sprites[8], + sprites[12] + ], 4)); + + this._animator.addAnimation("walkUp", new es.SpriteAnimation([ + sprites[1], + sprites[5], + sprites[9], + sprites[13] + ], 4)); + + this._animator.play("walkDown"); + }); + } + } +} \ No newline at end of file diff --git a/demo/src/Scenes/Ninja Adventure/NinjaAdventureScene.ts b/demo/src/Scenes/Ninja Adventure/NinjaAdventureScene.ts new file mode 100644 index 00000000..0e223f38 --- /dev/null +++ b/demo/src/Scenes/Ninja Adventure/NinjaAdventureScene.ts @@ -0,0 +1,32 @@ +module samples { + import CircleCollider = es.CircleCollider; + import Flags = es.Flags; + import SpriteRenderer = es.SpriteRenderer; + + export class NinjaAdventureScene extends SampleScene { + constructor() { + super(true, true); + } + + public initialize(): void { + super.initialize(); + + let playerEntity = this.createEntity("player"); + playerEntity.position = new es.Vector2(256, 224); + playerEntity.addComponent(new Ninja()); + let collider = playerEntity.addComponent(new CircleCollider()); + + // 我们只希望与默认图层0上的组件发生冲突 + Flags.setFlagExclusive(collider.collidesWithLayers, 0); + // 移动到第1层 保证自己的图层不会如果增加攻击方式则不会攻击到自身 + Flags.setFlagExclusive(collider.physicsLayer, 1); + + this.content.loadRes("moon_png").then(moonTexture => { + let moonEntity = this.createEntity("moon"); + moonEntity.position = new es.Vector2(412, 460); + moonEntity.addComponent(new SpriteRenderer(moonTexture)); + moonEntity.addComponent(new CircleCollider()); + }); + } + } +} \ No newline at end of file diff --git a/demo/src/UI/loading/LoadingView.ts b/demo/src/UI/loading/LoadingView.ts index 8c047279..d6694074 100644 --- a/demo/src/UI/loading/LoadingView.ts +++ b/demo/src/UI/loading/LoadingView.ts @@ -4,7 +4,7 @@ module loading { export class LoadingView extends BaseView implements RES.PromiseTaskReporter { private _ui: FUI.loading.UI_View_loading; - private _loadGroup = ["preload", "common"]; + private _loadGroup = ["preload", "common", "characters"]; private _maxProgress = 0; private _currentProgress = 0; diff --git a/demo/src/UI/sc/ScView.ts b/demo/src/UI/sc/ScView.ts index b9f5cf84..38377c3e 100644 --- a/demo/src/UI/sc/ScView.ts +++ b/demo/src/UI/sc/ScView.ts @@ -5,6 +5,7 @@ module sc { new SceneData("空白场景", samples.BasicScene), new SceneData("Tiled Tiles", samples.AnimatedTilesScene), new SceneData("Linecasting", samples.LineCastingScene), + new SceneData("Ninja Adventure", samples.NinjaAdventureScene), ]; constructor() { diff --git a/source/bin/framework.d.ts b/source/bin/framework.d.ts index 06b2d2a3..08994893 100644 --- a/source/bin/framework.d.ts +++ b/source/bin/framework.d.ts @@ -658,6 +658,7 @@ declare module es { origin: Vector2; readonly uvs: Rectangle; constructor(texture: egret.Texture, sourceRect?: Rectangle, origin?: Vector2); + static spritesFromAtlas(texture: egret.Texture, cellWidth: number, cellHeight: number, cellOffset?: number, maxCellsToInclude?: number): Sprite[]; } } declare module es { @@ -1331,6 +1332,21 @@ declare module es { calculateBounds(parentPosition: Vector2, position: Vector2, origin: Vector2, scale: Vector2, rotation: number, width: number, height: number): void; } } +declare module es { + class SubpixelFloat { + remainder: number; + update(amount: number): number; + reset(): void; + } +} +declare module es { + class SubpixelVector2 { + _x: SubpixelFloat; + _y: SubpixelFloat; + update(amount: Vector2): void; + reset(): void; + } +} declare module es { class Vector3 { x: number; diff --git a/source/bin/framework.js b/source/bin/framework.js index 1985ccd9..d537a03d 100644 --- a/source/bin/framework.js +++ b/source/bin/framework.js @@ -1255,7 +1255,8 @@ var es; this._scene.update(); } if (!this._nextScene) return [3, 2]; - this.removeChild(this._scene); + if (this._scene.parent) + this._scene.parent.removeChild(this._scene); this._scene.end(); this._scene = this._nextScene; this._nextScene = null; @@ -3094,6 +3095,7 @@ var es; })(es || (es = {})); var es; (function (es) { + var SpriteSheet = egret.SpriteSheet; var Sprite = (function () { function Sprite(texture, sourceRect, origin) { if (sourceRect === void 0) { sourceRect = new es.Rectangle(0, 0, texture.textureWidth, texture.textureHeight); } @@ -3110,6 +3112,28 @@ var es; this.uvs.width = sourceRect.width * inverseTexW; this.uvs.height = sourceRect.height * inverseTexH; } + Sprite.spritesFromAtlas = function (texture, cellWidth, cellHeight, cellOffset, maxCellsToInclude) { + if (cellOffset === void 0) { cellOffset = 0; } + if (maxCellsToInclude === void 0) { maxCellsToInclude = Number.MAX_VALUE; } + var sprites = []; + var cols = texture.textureWidth / cellWidth; + var rows = texture.textureHeight / cellHeight; + var i = 0; + var spriteSheet = new SpriteSheet(texture); + for (var y = 0; y < rows; y++) { + for (var x = 0; x < cols; x++) { + if (i++ < cellOffset) + continue; + var texture_1 = spriteSheet.getTexture(y + "_" + x); + if (!texture_1) + texture_1 = spriteSheet.createTexture(y + "_" + x, x * cellWidth, y * cellHeight, cellWidth, cellHeight); + sprites.push(new Sprite(texture_1)); + if (sprites.length == maxCellsToInclude) + return sprites; + } + } + return sprites; + }; return Sprite; }()); es.Sprite = Sprite; @@ -3179,7 +3203,7 @@ var es; this.animationState = State.completed; this._elapsedTime = 0; this.currentFrame = 0; - this.sprite = animation.sprites[this.currentFrame]; + this.displayObject.texture = animation.sprites[this.currentFrame].texture2D; return; } var i = Math.floor(time / secondsPerFrame); @@ -3191,7 +3215,7 @@ var es; else { this.currentFrame = i % n; } - this.sprite = animation.sprites[this.currentFrame]; + this.displayObject.texture = animation.sprites[this.currentFrame].texture2D; }; SpriteAnimator.prototype.addAnimation = function (name, animation) { if (!this.sprite && animation.sprites.length > 0) @@ -3205,7 +3229,7 @@ var es; this.currentAnimationName = name; this.currentFrame = 0; this.animationState = State.running; - this.sprite = this.currentAnimation.sprites[0]; + this.displayObject.texture = this.currentAnimation.sprites[0].texture2D; this._elapsedTime = 0; this._loopMode = loopMode ? loopMode : LoopMode.loop; }; @@ -4154,7 +4178,8 @@ var es; }; ComponentList.prototype.handleRemove = function (component) { if (component instanceof es.RenderableComponent) { - this._entity.scene.removeChild(component.displayObject); + if (component.displayObject.parent) + component.displayObject.parent.removeChild(component.displayObject); this._entity.scene.renderableComponents.remove(component); } this._entity.componentBits.set(es.ComponentTypeManager.getIndexFor(component), false); @@ -4727,7 +4752,7 @@ var es; var component = this_1._components[i]; var egretDisplayObject = scene.$children.find(function (a) { return a.hashCode == component.displayObject.hashCode; }); var displayIndex = scene.getChildIndex(egretDisplayObject); - if (displayIndex != i) + if (displayIndex != -1 && displayIndex != i) scene.swapChildrenAt(displayIndex, i); }; var this_1 = this; @@ -6384,6 +6409,45 @@ var es; es.Rectangle = Rectangle; })(es || (es = {})); var es; +(function (es) { + var SubpixelFloat = (function () { + function SubpixelFloat() { + this.remainder = 0; + } + SubpixelFloat.prototype.update = function (amount) { + this.remainder += amount; + var motion = Math.trunc(this.remainder); + this.remainder -= motion; + amount = motion; + return amount; + }; + SubpixelFloat.prototype.reset = function () { + this.remainder = 0; + }; + return SubpixelFloat; + }()); + es.SubpixelFloat = SubpixelFloat; +})(es || (es = {})); +var es; +(function (es) { + var SubpixelVector2 = (function () { + function SubpixelVector2() { + this._x = new es.SubpixelFloat(); + this._y = new es.SubpixelFloat(); + } + SubpixelVector2.prototype.update = function (amount) { + amount.x = this._x.update(amount.x); + amount.y = this._y.update(amount.y); + }; + SubpixelVector2.prototype.reset = function () { + this._x.reset(); + this._y.reset(); + }; + return SubpixelVector2; + }()); + es.SubpixelVector2 = SubpixelVector2; +})(es || (es = {})); +var es; (function (es) { var Vector3 = (function () { function Vector3(x, y, z) { @@ -9441,7 +9505,8 @@ var es; ContentManager.prototype.dispose = function () { this.loadedAssets.forEach(function (value) { var assetsToRemove = value; - assetsToRemove.dispose(); + if (RES.destroyRes(assetsToRemove)) + assetsToRemove.dispose(); }); this.loadedAssets.clear(); }; diff --git a/source/bin/framework.min.js b/source/bin/framework.min.js index 590dade7..e962e610 100644 --- a/source/bin/framework.min.js +++ b/source/bin/framework.min.js @@ -1 +1 @@ -window.es={},window.__extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var transform,__awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(r,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(s,a)}h((n=n.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]-1}(this,t)},Array.prototype.firstOrDefault=function(t){return function(t,e){var i=t.findIndex(e);return-1==i?null:t[i]}(this,t)},Array.prototype.find=function(t){return function(t,e){return t.firstOrDefault(e)}(this,t)},Array.prototype.where=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(i,n,r){return e.call(arguments[2],n,r,t)&&i.push(n),i},[]);for(var i=[],n=0,r=t.length;n=0&&t.splice(i,1)}while(i>=0)}(this,t)},Array.prototype.remove=function(t){return function(t,e){var i=t.findIndex(function(t){return t===e});return i>=0&&(t.splice(i,1),!0)}(this,t)},Array.prototype.removeAt=function(t){return function(t,e){t.splice(e,1)}(this,t)},Array.prototype.removeRange=function(t,e){return function(t,e,i){t.splice(e,i)}(this,t,e)},Array.prototype.select=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(i,n,r){return i.push(e.call(arguments[2],n,r,t)),i},[]);for(var i=[],n=0,r=t.length;no?1:-1}),t}(this,t,e)},Array.prototype.orderByDescending=function(t,e){return function(t,e,i){return t.sort(function(t,n){var r=e(t),o=e(n);return i?-i(r,o):r0;){if("break"===u())break}return s?this.recontructPath(a,n,r):null},e.recontructPath=function(t,e,i){var n=[],r=i;for(n.push(i);r!=e;)r=this.getKey(t,r),n.push(r);return n.reverse(),n},e.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},e.getKey=function(t,e){for(var i,n,r=t.keys(),o=t.values();i=r.next(),n=o.next(),!i.done;)if(JSON.stringify(i.value)==JSON.stringify(e))return n.value;return null},e}();t.AStarPathfinder=e;var i=function(t){function e(e){var i=t.call(this)||this;return i.data=e,i}return __extends(e,t),e}(t.PriorityQueueNode);t.AStarNode=i}(es||(es={})),function(t){var e=function(){function e(e,i){this.dirs=[new t.Vector2(1,0),new t.Vector2(0,-1),new t.Vector2(-1,0),new t.Vector2(0,1)],this.walls=[],this.weightedNodes=[],this.defaultWeight=1,this.weightedNodeWeight=5,this._neighbors=new Array(4),this._width=e,this._height=i}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x=this._nodes.length?(console.error("node.QueueIndex has been corrupted. Did you change it manually? Or add this node to another queue?"),!1):this._nodes[t.queueIndex]==t:(console.error("node cannot be null"),!1)},t.prototype.enqueue=function(t,e){t.priority=e,this._numNodes++,this._nodes[this._numNodes]=t,t.queueIndex=this._numNodes,t.insertionIndex=this._numNodesEverEnqueued++,this.cascadeUp(this._nodes[this._numNodes])},t.prototype.dequeue=function(){var t=this._nodes[1];return this.remove(t),t},t.prototype.remove=function(t){if(t.queueIndex==this._numNodes)return this._nodes[this._numNodes]=null,void this._numNodes--;var e=this._nodes[this._numNodes];this.swap(t,e),delete this._nodes[this._numNodes],this._numNodes--,this.onNodeUpdated(e)},t.prototype.isValidQueue=function(){for(var t=1;t0&&this.hasHigherPriority(t,i)?this.cascadeUp(t):this.cascadeDown(t)},t.prototype.cascadeDown=function(t){for(var e,i=t.queueIndex;;){e=t;var n=2*i;if(n>this._numNodes){t.queueIndex=i,this._nodes[i]=t;break}var r=this._nodes[n];this.hasHigherPriority(r,e)&&(e=r);var o=n+1;if(o<=this._numNodes){var s=this._nodes[o];this.hasHigherPriority(s,e)&&(e=s)}if(e==t){t.queueIndex=i,this._nodes[i]=t;break}this._nodes[i]=e;var a=e.queueIndex;e.queueIndex=i,i=a}},t.prototype.cascadeUp=function(t){for(var e=Math.floor(t.queueIndex/2);e>=1;){var i=this._nodes[e];if(this.hasHigherPriority(i,t))break;this.swap(t,i),e=Math.floor(t.queueIndex/2)}},t.prototype.swap=function(t,e){this._nodes[t.queueIndex]=e,this._nodes[e.queueIndex]=t;var i=t.queueIndex;t.queueIndex=e.queueIndex,e.queueIndex=i},t.prototype.hasHigherPriority=function(t,e){return t.priority0;){if("break"===h())break}return o?t.AStarPathfinder.recontructPath(a,i,n):null},e.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},e}();t.BreadthFirstPathfinder=e}(es||(es={})),function(t){var e=function(){function t(){this.edges=new Map}return t.prototype.addEdgesForNode=function(t,e){return this.edges.set(t,e),this},t.prototype.getNeighbors=function(t){return this.edges.get(t)},t}();t.UnweightedGraph=e}(es||(es={})),function(t){var e=function(){function e(t,e){this.x=0,this.y=0,this.x=t||0,this.y=null!=e?e:this.x}return Object.defineProperty(e,"zero",{get:function(){return e.zeroVector2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"one",{get:function(){return e.unitVector2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unitX",{get:function(){return e.unitXVector},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unitY",{get:function(){return e.unitYVector},enumerable:!0,configurable:!0}),e.add=function(t,i){var n=new e(0,0);return n.x=t.x+i.x,n.y=t.y+i.y,n},e.divide=function(t,i){var n=new e(0,0);return n.x=t.x/i.x,n.y=t.y/i.y,n},e.multiply=function(t,i){var n=new e(0,0);return n.x=t.x*i.x,n.y=t.y*i.y,n},e.subtract=function(t,i){var n=new e(0,0);return n.x=t.x-i.x,n.y=t.y-i.y,n},e.normalize=function(t){var e=1/Math.sqrt(t.x*t.x+t.y*t.y);return t.x*=e,t.y*=e,t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.distanceSquared=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},e.clamp=function(i,n,r){return new e(t.MathHelper.clamp(i.x,n.x,r.x),t.MathHelper.clamp(i.y,n.y,r.y))},e.lerp=function(i,n,r){return new e(t.MathHelper.lerp(i.x,n.x,r),t.MathHelper.lerp(i.y,n.y,r))},e.transform=function(t,i){return new e(t.x*i.m11+t.y*i.m21+i.m31,t.x*i.m12+t.y*i.m22+i.m32)},e.distance=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},e.angle=function(i,n){return i=e.normalize(i),n=e.normalize(n),Math.acos(t.MathHelper.clamp(e.dot(i,n),-1,1))*t.MathHelper.Rad2Deg},e.negate=function(t){var i=new e;return i.x=-t.x,i.y=-t.y,i},e.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},e.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},e.prototype.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},e.prototype.normalize=function(){var t=1/Math.sqrt(this.x*this.x+this.y*this.y);return this.x*=t,this.y*=t,this},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.prototype.round=function(){return new e(Math.round(this.x),Math.round(this.y))},e.prototype.equals=function(t){return t.x==this.x&&t.y==this.y},e.unitYVector=new e(0,1),e.unitXVector=new e(1,0),e.unitVector2=new e(1,1),e.zeroVector2=new e(0,0),e}();t.Vector2=e}(es||(es={})),function(t){var e=function(){function e(t,i,n){void 0===n&&(n=!1),this.walls=[],this._neighbors=new Array(4),this._width=t,this._hegiht=i,this._dirs=n?e.COMPASS_DIRS:e.CARDINAL_DIRS}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x0;){if("break"===u())break}return s?this.recontructPath(a,n,r):null},i.recontructPath=function(t,e,i){var n=[],r=i;for(n.push(i);r!=e;)r=this.getKey(t,r),n.push(r);return n.reverse(),n},i.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},i.getKey=function(t,e){for(var i,n,r=t.keys(),o=t.values();i=r.next(),n=o.next(),!i.done;)if(JSON.stringify(i.value)==JSON.stringify(e))return n.value;return null},i}();t.WeightedPathfinder=i}(es||(es={})),function(t){var e=function(){function e(){}return e.drawHollowRect=function(e,i,n){void 0===n&&(n=0),this._debugDrawItems.push(new t.DebugDrawItem(e,i,n))},e.render=function(){if(this._debugDrawItems.length>0){var e=new egret.Shape;t.Core.scene&&t.Core.scene.addChild(e);for(var i=this._debugDrawItems.length-1;i>=0;i--){this._debugDrawItems[i].draw(e)&&this._debugDrawItems.removeAt(i)}}},e._debugDrawItems=[],e}();t.Debug=e}(es||(es={})),function(t){var e=function(){function t(){}return t.verletParticle=14431326,t.verletConstraintEdge=4406838,t}();t.DebugDefaults=e}(es||(es={})),function(t){var e;!function(t){t[t.line=0]="line",t[t.hollowRectangle=1]="hollowRectangle",t[t.pixel=2]="pixel",t[t.text=3]="text"}(e=t.DebugDrawType||(t.DebugDrawType={}));var i=function(){function i(t,i,n){this.rectangle=t,this.color=i,this.duration=n,this.drawType=e.hollowRectangle}return i.prototype.draw=function(i){switch(this.drawType){case e.line:case e.hollowRectangle:case e.pixel:case e.text:}return this.duration-=t.Time.deltaTime,this.duration<0},i}();t.DebugDrawItem=i}(es||(es={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.updateInterval=1,e._enabled=!0,e._updateOrder=0,e}return __extends(e,t),Object.defineProperty(e.prototype,"transform",{get:function(){return this.entity.transform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this.entity?this.entity.enabled&&this._enabled:this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateOrder",{get:function(){return this._updateOrder},set:function(t){this.setUpdateOrder(t)},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){},e.prototype.onAddedToEntity=function(){},e.prototype.onRemovedFromEntity=function(){},e.prototype.onEntityTransformChanged=function(t){},e.prototype.debugRender=function(){},e.prototype.onEnabled=function(){},e.prototype.onDisabled=function(){},e.prototype.update=function(){},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled?this.onEnabled():this.onDisabled()),this},e.prototype.setUpdateOrder=function(t){return this._updateOrder!=t&&(this._updateOrder=t),this},e.prototype.clone=function(){var t=ObjectUtils.clone(this);return t.entity=null,t},e}(egret.HashObject);t.Component=e}(es||(es={})),function(t){var e=function(e){function i(){var n=e.call(this)||this;return n._globalManagers=[],i._instance=n,i.emitter=new t.Emitter,i.content=new t.ContentManager,n.addEventListener(egret.Event.ADDED_TO_STAGE,n.onAddToStage,n),n}return __extends(i,e),Object.defineProperty(i,"Instance",{get:function(){return this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(i,"scene",{get:function(){return this._instance?this._instance._scene:null},set:function(t){t?null==this._instance._scene?(this._instance._scene=t,this._instance.addChild(t),this._instance._scene.begin(),i.Instance.onSceneChanged()):this._instance._nextScene=t:console.error("场景不能为空")},enumerable:!0,configurable:!0}),i.startSceneTransition=function(t){if(!this._instance._sceneTransition)return this._instance._sceneTransition=t,t;console.warn("在前一个场景完成之前,不能开始一个新的场景转换。")},i.registerGlobalManager=function(t){this._instance._globalManagers.push(t),t.enabled=!0},i.unregisterGlobalManager=function(t){this._instance._globalManagers.remove(t),t.enabled=!1},i.getGlobalManager=function(t){for(var e=0;e=0;e--)this._globalManagers[e].enabled&&this._globalManagers[e].update();return this._sceneTransition&&(!this._sceneTransition||this._sceneTransition.loadsNewScene&&!this._sceneTransition.isNewSceneLoaded)||this._scene.update(),this._nextScene?(this.removeChild(this._scene),this._scene.end(),this._scene=this._nextScene,this._nextScene=null,this.onSceneChanged(),this.addChild(this._scene),[4,this._scene.begin()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[4,this.draw()];case 3:return i.sent(),[2]}})})},i.prototype.onAddToStage=function(){i.graphicsDevice=new t.GraphicsDevice,this.addEventListener(egret.Event.RESIZE,this.onGraphicsDeviceReset,this),this.addEventListener(egret.StageOrientationEvent.ORIENTATION_CHANGE,this.onOrientationChanged,this),this.addEventListener(egret.Event.ENTER_FRAME,this.update,this),t.Input.initialize(),KeyboardUtils.init(),this.initialize()},i.debugRenderEndabled=!1,i}(egret.DisplayObjectContainer);t.Core=e}(es||(es={})),function(t){!function(t){t[t.GraphicsDeviceReset=0]="GraphicsDeviceReset",t[t.SceneChanged=1]="SceneChanged",t[t.OrientationChanged=2]="OrientationChanged"}(t.CoreEvents||(t.CoreEvents={}))}(es||(es={})),function(t){var e=function(){function e(i){this.updateInterval=1,this._tag=0,this._enabled=!0,this._updateOrder=0,this.components=new t.ComponentList(this),this.transform=new t.Transform(this),this.name=i,this.id=e._idGenerator++,this.componentBits=new t.BitSet}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this._isDestroyed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tag",{get:function(){return this._tag},set:function(t){this.setTag(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateOrder",{get:function(){return this._updateOrder},set:function(t){this.setUpdateOrder(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.transform.parent},set:function(t){this.transform.setParent(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childCount",{get:function(){return this.transform.childCount},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.setPosition(t.x,t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localPosition",{get:function(){return this.transform.localPosition},set:function(t){this.transform.setLocalPosition(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.setRotation(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationDegrees",{get:function(){return this.transform.rotationDegrees},set:function(t){this.transform.setRotationDegrees(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localRotation",{get:function(){return this.transform.localRotation},set:function(t){this.transform.setLocalRotation(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localRotationDegrees",{get:function(){return this.transform.localRotationDegrees},set:function(t){this.transform.setLocalRotationDegrees(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.setScale(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localScale",{get:function(){return this.transform.localScale},set:function(t){this.transform.setLocalScale(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"worldInverseTransform",{get:function(){return this.transform.worldInverseTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localToWorldTransform",{get:function(){return this.transform.localToWorldTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"worldToLocalTransform",{get:function(){return this.transform.worldToLocalTransform},enumerable:!0,configurable:!0}),e.prototype.onTransformChanged=function(t){this.components.onEntityTransformChanged(t)},e.prototype.setTag=function(t){return this._tag!=t&&(this.scene&&this.scene.entities.removeFromTagList(this),this._tag=t,this.scene&&this.scene.entities.addToTagList(this)),this},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled?this.components.onEntityEnabled():this.components.onEntityDisabled()),this},e.prototype.setUpdateOrder=function(t){if(this._updateOrder!=t)return this._updateOrder=t,this.scene&&(this.scene.entities.markEntityListUnsorted(),this.scene.entities.markTagUnsorted(this.tag)),this},e.prototype.destroy=function(){this._isDestroyed=!0,this.scene.entities.remove(this),this.transform.parent=null;for(var t=this.transform.childCount-1;t>=0;t--){this.transform.getChild(t).entity.destroy()}},e.prototype.detachFromScene=function(){this.scene.entities.remove(this),this.components.deregisterAllComponents();for(var t=0;t=0;t--)this._sceneComponents[t].enabled&&this._sceneComponents[t].update();this.entityProcessors&&this.entityProcessors.update(),this.entities.update(),this.entityProcessors&&this.entityProcessors.lateUpdate(),this.renderableComponents.updateList()},i.prototype.render=function(){if(0!=this._renderers.length)for(var t=0;te.x?-1:1,n=t.Vector2.normalize(t.Vector2.subtract(this.position,e));this.rotation=i*Math.acos(t.Vector2.dot(n,t.Vector2.unitY))},n.prototype.setLocalRotation=function(t){return this._localRotation=t,this._localDirty=this._positionDirty=this._localPositionDirty=this._localRotationDirty=this._localScaleDirty=!0,this.setDirty(e.rotationDirty),this},n.prototype.setLocalRotationDegrees=function(e){return this.setLocalRotation(t.MathHelper.toRadians(e))},n.prototype.setScale=function(e){return this._scale=e,this.parent?this.localScale=t.Vector2.divide(e,this.parent._scale):this.localScale=e,this},n.prototype.setLocalScale=function(t){return this._localScale=t,this._localDirty=this._positionDirty=this._localScaleDirty=!0,this.setDirty(e.scaleDirty),this},n.prototype.roundPosition=function(){this.position=this._position.round()},n.prototype.updateTransform=function(){this.hierarchyDirty!=e.clean&&(this.parent&&this.parent.updateTransform(),this._localDirty&&(this._localPositionDirty&&(this._translationMatrix=t.Matrix2D.create().translate(this._localPosition.x,this._localPosition.y),this._localPositionDirty=!1),this._localRotationDirty&&(this._rotationMatrix=t.Matrix2D.create().rotate(this._localRotation),this._localRotationDirty=!1),this._localScaleDirty&&(this._scaleMatrix=t.Matrix2D.create().scale(this._localScale.x,this._localScale.y),this._localScaleDirty=!1),this._localTransform=this._scaleMatrix.multiply(this._rotationMatrix),this._localTransform=this._localTransform.multiply(this._translationMatrix),this.parent||(this._worldTransform=this._localTransform,this._rotation=this._localRotation,this._scale=this._localScale,this._worldInverseDirty=!0),this._localDirty=!1),this.parent&&(this._worldTransform=this._localTransform.multiply(this.parent._worldTransform),this._rotation=this._localRotation+this.parent._rotation,this._scale=t.Vector2.multiply(this.parent._scale,this._localScale),this._worldInverseDirty=!0),this._worldToLocalDirty=!0,this._positionDirty=!0,this.hierarchyDirty=e.clean)},n.prototype.setDirty=function(e){if(0==(this.hierarchyDirty&e)){switch(this.hierarchyDirty|=e,e){case t.DirtyType.positionDirty:this.entity.onTransformChanged(transform.Component.position);break;case t.DirtyType.rotationDirty:this.entity.onTransformChanged(transform.Component.rotation);break;case t.DirtyType.scaleDirty:this.entity.onTransformChanged(transform.Component.scale)}this._children||(this._children=[]);for(var i=0;it&&(this._zoom=t),this._maximumZoom=t,this;console.error("maximumZoom must be greater than zero")},r.prototype.onEntityTransformChanged=function(t){this._areMatrixedDirty=!0},r.prototype.zoomIn=function(t){this.zoom+=t},r.prototype.zoomOut=function(t){this.zoom-=t},r.prototype.worldToScreenPoint=function(e){return this.updateMatrixes(),e=t.Vector2.transform(e,this._transformMatrix)},r.prototype.screenToWorldPoint=function(e){return this.updateMatrixes(),e=t.Vector2.transform(e,this._inverseTransformMatrix)},r.prototype.mouseToWorldPoint=function(){return this.screenToWorldPoint(t.Input.touchPosition)},r.prototype.onAddedToEntity=function(){this.follow(this._targetEntity,this._cameraStyle)},r.prototype.update=function(){var e=t.Vector2.multiply(new t.Vector2(this.bounds.width,this.bounds.height),new t.Vector2(.5));this._worldSpaceDeadZone.x=this.position.x-e.x*t.Core.scene.scaleX+this.deadzone.x+this.focusOffset.x,this._worldSpaceDeadZone.y=this.position.y-e.y*t.Core.scene.scaleY+this.deadzone.y+this.focusOffset.y,this._worldSpaceDeadZone.width=this.deadzone.width,this._worldSpaceDeadZone.height=this.deadzone.height,this._targetEntity&&this.updateFollow(),this.position=t.Vector2.lerp(this.position,t.Vector2.add(this.position,this._desiredPositionDelta),this.followLerp),this.entity.transform.roundPosition(),this.mapLockEnabled&&(this.position=this.clampToMapSize(this.position),this.entity.transform.roundPosition())},r.prototype.clampToMapSize=function(e){var i=t.Vector2.multiply(new t.Vector2(this.bounds.width,this.bounds.height),new t.Vector2(.5)).add(new t.Vector2(this.mapSize.x,this.mapSize.y)),n=new t.Vector2(this.mapSize.width-i.x,this.mapSize.height-i.y);return t.Vector2.clamp(e,i,n)},r.prototype.updateFollow=function(){if(this._desiredPositionDelta.x=this._desiredPositionDelta.y=0,this._cameraStyle==e.lockOn){var i=this._targetEntity.transform.position.x,n=this._targetEntity.transform.position.y;this._worldSpaceDeadZone.x>i?this._desiredPositionDelta.x=i-this._worldSpaceDeadZone.x:this._worldSpaceDeadZone.xn&&(this._desiredPositionDelta.y=n-this._worldSpaceDeadZone.y)}else{if(!this._targetCollider&&(this._targetCollider=this._targetEntity.getComponent(t.Collider),!this._targetCollider))return;var r=this._targetEntity.getComponent(t.Collider).bounds;this._worldSpaceDeadZone.containsRect(r)||(this._worldSpaceDeadZone.left>r.left?this._desiredPositionDelta.x=r.left-this._worldSpaceDeadZone.left:this._worldSpaceDeadZone.rightr.top&&(this._desiredPositionDelta.y=r.top-this._worldSpaceDeadZone.top))}},r.prototype.follow=function(i,n){switch(void 0===n&&(n=e.cameraWindow),this._targetEntity=i,this._cameraStyle=n,this._cameraStyle){case e.cameraWindow:var r=this.bounds.width/6,o=this.bounds.height/3;this.deadzone=new t.Rectangle((this.bounds.width-r)/2,(this.bounds.height-o)/2,r,o);break;case e.lockOn:this.deadzone=new t.Rectangle(this.bounds.width/2,this.bounds.height/2,10,10)}},r.prototype.setCenteredDeadzone=function(e,i){this.deadzone=new t.Rectangle((this.bounds.width-e)/2,(this.bounds.height-i)/2,e,i)},r.prototype.updateMatrixes=function(){var e;this._areMatrixedDirty&&(this._transformMatrix=t.Matrix2D.create().translate(-this.entity.transform.position.x,-this.entity.transform.position.y),1!=this._zoom&&(e=t.Matrix2D.create().scale(this._zoom,this._zoom),this._transformMatrix=this._transformMatrix.multiply(e)),0!=this.entity.transform.rotation&&(e=t.Matrix2D.create().rotate(this.entity.transform.rotation),this._transformMatrix=this._transformMatrix.multiply(e)),e=t.Matrix2D.create().translate(this._origin.x,this._origin.y),this._transformMatrix=this._transformMatrix.multiply(e),this._inverseTransformMatrix=this._transformMatrix.invert(),this._areBoundsDirty=!0,this._areMatrixedDirty=!1)},r}(t.Component);t.Camera=n}(es||(es={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._shakeDirection=t.Vector2.zero,i._shakeOffset=t.Vector2.zero,i._shakeIntensity=0,i._shakeDegredation=.95,i}return __extends(i,e),i.prototype.shake=function(e,i,n){void 0===e&&(e=15),void 0===i&&(i=.9),void 0===n&&(n=t.Vector2.zero),this.enabled=!0,this._shakeIntensity=1)&&(i=.95),this._shakeDegredation=i)},i.prototype.update=function(){Math.abs(this._shakeIntensity)>0&&(this._shakeOffset=this._shakeDirection,0!=this._shakeOffset.x||0!=this._shakeOffset.y?this._shakeOffset.normalize():(this._shakeOffset.x=this._shakeOffset.x+Math.random()-.5,this._shakeOffset.y=this._shakeOffset.y+Math.random()-.5),this._shakeOffset.multiply(new t.Vector2(this._shakeIntensity)),this._shakeIntensity*=-this._shakeDegredation,Math.abs(this._shakeIntensity)<=.01&&(this._shakeIntensity=0,this.enabled=!1)),this.entity.scene.camera.position.add(this._shakeOffset)},i}(t.Component);t.CameraShake=e}(es||(es={})),function(t){var e=function(){function t(t){this._type=t,this._cache=[]}return t.prototype.obtain=function(){try{return this._cache.length>0?this._cache.shift():new this._type}catch(t){throw new Error(this._type+t)}},t.prototype.free=function(t){t.reset(),this._cache.push(t)},t}();t.ComponentPool=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.compare=function(t,e){return t.updateOrder-e.updateOrder},t}();t.IUpdatableComparer=e}(es||(es={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(t.Component);t.PooledComponent=e}(es||(es={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.displayObject=new egret.DisplayObject,i.color=0,i._areBoundsDirty=!0,i._localOffset=t.Vector2.zero,i._renderLayer=0,i._bounds=new t.Rectangle,i}return __extends(i,e),Object.defineProperty(i.prototype,"width",{get:function(){return this.bounds.width},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.bounds.height},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"localOffset",{get:function(){return this._localOffset},set:function(t){this.setLocalOffset(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"renderLayer",{get:function(){return this._renderLayer},set:function(t){this.setRenderLayer(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._areBoundsDirty&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,t.Vector2.zero,this.entity.transform.scale,this.entity.transform.rotation,this.width,this.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!=t&&(this._isVisible=t,this._isVisible?this.onBecameVisible():this.onBecameInvisible())},enumerable:!0,configurable:!0}),i.prototype.onEntityTransformChanged=function(t){this._areBoundsDirty=!0},i.prototype.isVisibleFromCamera=function(t){return!!t&&(this.isVisible=t.bounds.intersects(this.displayObject.getBounds().union(this.bounds)),this.isVisible)},i.prototype.setRenderLayer=function(t){if(t!=this._renderLayer){var e=this._renderLayer;this._renderLayer=t,this.entity&&this.entity.scene&&this.entity.scene.renderableComponents.updateRenderableRenderLayer(this,e,this._renderLayer)}return this},i.prototype.setColor=function(t){return this.color=t,this},i.prototype.setLocalOffset=function(t){return this._localOffset!=t&&(this._localOffset=t),this},i.prototype.sync=function(e){var i=new t.Vector2(this.entity.position.x+this.localOffset.x-e.position.x+e.origin.x,this.entity.position.y+this.localOffset.y-e.position.y+e.origin.y);this.displayObject.x!=i.x&&(this.displayObject.x=i.x),this.displayObject.y!=i.y&&(this.displayObject.y=i.y),this.displayObject.scaleX!=this.entity.scale.x&&(this.displayObject.scaleX=this.entity.scale.x),this.displayObject.scaleY!=this.entity.scale.y&&(this.displayObject.scaleY=this.entity.scale.y),this.displayObject.rotation!=this.entity.rotation&&(this.displayObject.rotation=this.entity.rotation)},i.prototype.toString=function(){return"[RenderableComponent] renderLayer: "+this.renderLayer},i.prototype.onBecameVisible=function(){this.displayObject.visible=this.isVisible},i.prototype.onBecameInvisible=function(){this.displayObject.visible=this.isVisible},i}(t.Component);t.RenderableComponent=e}(es||(es={})),function(t){var e=function(){function e(){this.updateOrder=0,this._enabled=!0}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),e.prototype.onEnabled=function(){},e.prototype.onDisabled=function(){},e.prototype.onRemovedFromScene=function(){},e.prototype.update=function(){},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled),this},e.prototype.setUpdateOrder=function(e){return this.updateOrder!=e&&(this.updateOrder=e,t.Core.scene._sceneComponents.sort(this.compareTo)),this},e.prototype.compareTo=function(t){return this.updateOrder-t.updateOrder},e}();t.SceneComponent=e}(es||(es={})),function(t){var e=egret.Bitmap,i=function(i){function n(e){void 0===e&&(e=null);var n=i.call(this)||this;return e instanceof t.Sprite?n.setSprite(e):e instanceof egret.Texture&&n.setSprite(new t.Sprite(e)),n}return __extends(n,i),Object.defineProperty(n.prototype,"bounds",{get:function(){return this._areBoundsDirty&&this._sprite&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,this._origin,this.entity.transform.scale,this.entity.transform.rotation,this._sprite.sourceRect.width,this._sprite.sourceRect.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"originNormalized",{get:function(){return new t.Vector2(this._origin.x/this.width*this.entity.transform.scale.x,this._origin.y/this.height*this.entity.transform.scale.y)},set:function(e){this.setOrigin(new t.Vector2(e.x*this.width/this.entity.transform.scale.x,e.y*this.height/this.entity.transform.scale.y))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"origin",{get:function(){return this._origin},set:function(t){this.setOrigin(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sprite",{get:function(){return this._sprite},set:function(t){this.setSprite(t)},enumerable:!0,configurable:!0}),n.prototype.setSprite=function(t){return this._sprite=t,this._sprite&&(this._origin=this._sprite.origin,this.displayObject.anchorOffsetX=this._origin.x,this.displayObject.anchorOffsetY=this._origin.y),this.displayObject=new e(t.texture2D),this},n.prototype.setOrigin=function(t){return this._origin!=t&&(this._origin=t,this.displayObject.anchorOffsetX=this._origin.x,this.displayObject.anchorOffsetY=this._origin.y,this._areBoundsDirty=!0),this},n.prototype.setOriginNormalized=function(e){return this.setOrigin(new t.Vector2(e.x*this.width/this.entity.transform.scale.x,e.y*this.height/this.entity.transform.scale.y)),this},n.prototype.render=function(e){this.sync(e);var i=new t.Vector2(this.entity.position.x+this.localOffset.x-e.position.x+e.origin.x,this.entity.position.y+this.localOffset.y-e.position.y+e.origin.y);this.displayObject.x!=i.x&&(this.displayObject.x=i.x),this.displayObject.y!=i.y&&(this.displayObject.y=i.y)},n}(t.RenderableComponent);t.SpriteRenderer=i}(es||(es={})),function(t){var e=egret.Bitmap,i=egret.RenderTexture,n=function(n){function r(e){var i=n.call(this,e)||this;return i._textureScale=t.Vector2.one,i._inverseTexScale=t.Vector2.one,i._gapX=0,i._gapY=0,i._sourceRect=e.sourceRect,i.displayObject.$fillMode=egret.BitmapFillMode.REPEAT,i}return __extends(r,n),Object.defineProperty(r.prototype,"bounds",{get:function(){return this._areBoundsDirty&&this._sprite&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,this._origin,this.entity.transform.scale,this.entity.transform.rotation,this.width,this.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollX",{get:function(){return this._sourceRect.x},set:function(t){this._sourceRect.x=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollY",{get:function(){return this._sourceRect.y},set:function(t){this._sourceRect.y=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"textureScale",{get:function(){return this._textureScale},set:function(e){this._textureScale=e,this._inverseTexScale=new t.Vector2(1/this._textureScale.x,1/this._textureScale.y),this._sourceRect.width=this._sprite.sourceRect.width*this._inverseTexScale.x,this._sourceRect.height=this._sprite.sourceRect.height*this._inverseTexScale.y},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this._sourceRect.width},set:function(t){this._areBoundsDirty=!0,this._sourceRect.width=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this._sourceRect.height},set:function(t){this._areBoundsDirty=!0,this._sourceRect.height=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"gapXY",{get:function(){return new t.Vector2(this._gapX,this._gapY)},set:function(t){this._gapX=t.x,this._gapY=t.y;var n=new i,r=this.sprite.sourceRect;r.x=0,r.y=0,r.width+=this._gapX,r.height+=this._gapY,n.drawToTexture(this.displayObject,r),this.displayObject?this.displayObject.texture=n:this.displayObject=new e(n)},enumerable:!0,configurable:!0}),r.prototype.setGapXY=function(t){return this.gapXY=t,this},r.prototype.render=function(t){n.prototype.render.call(this,t);var e=this.displayObject;e.width=this.width,e.height=this.height,e.scrollRect=this._sourceRect},r}(t.SpriteRenderer);t.TiledSpriteRenderer=n}(es||(es={})),function(t){var e=function(e){function i(t){var i=e.call(this,t)||this;return i.scrollSpeedX=15,i.scroolSpeedY=0,i._scrollX=0,i._scrollY=0,i._scrollWidth=0,i._scrollHeight=0,i._scrollWidth=i.width,i._scrollHeight=i.height,i}return __extends(i,e),Object.defineProperty(i.prototype,"textureScale",{get:function(){return this._textureScale},set:function(e){this._textureScale=e,this._inverseTexScale=new t.Vector2(1/this._textureScale.x,1/this._textureScale.y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollWidth",{get:function(){return this._scrollWidth},set:function(t){this._scrollWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollHeight",{get:function(){return this._scrollHeight},set:function(t){this._scrollHeight=t},enumerable:!0,configurable:!0}),i.prototype.update=function(){this.sprite&&(this._scrollX+=this.scrollSpeedX*t.Time.deltaTime,this._scrollY+=this.scroolSpeedY*t.Time.deltaTime,this._sourceRect.x=this._scrollX,this._sourceRect.y=this._scrollY,this._sourceRect.width=this._scrollWidth+Math.abs(this._scrollX),this._sourceRect.height=this._scrollHeight+Math.abs(this._scrollY))},i}(t.TiledSpriteRenderer);t.ScrollingSpriteRenderer=e}(es||(es={})),function(t){var e=function(){return function(e,i,n){void 0===i&&(i=new t.Rectangle(0,0,e.textureWidth,e.textureHeight)),void 0===n&&(n=i.getHalfSize()),this.uvs=new t.Rectangle,this.texture2D=e,this.sourceRect=i,this.center=new t.Vector2(.5*i.width,.5*i.height),this.origin=n;var r=1/e.textureWidth,o=1/e.textureHeight;this.uvs.x=i.x*r,this.uvs.y=i.y*o,this.uvs.width=i.width*r,this.uvs.height=i.height*o}}();t.Sprite=e}(es||(es={})),function(t){var e=function(){return function(t,e){this.sprites=t,this.frameRate=e}}();t.SpriteAnimation=e}(es||(es={})),function(t){var e,i;!function(t){t[t.loop=0]="loop",t[t.once=1]="once",t[t.clampForever=2]="clampForever",t[t.pingPong=3]="pingPong",t[t.pingPongOnce=4]="pingPongOnce"}(e=t.LoopMode||(t.LoopMode={})),function(t){t[t.none=0]="none",t[t.running=1]="running",t[t.paused=2]="paused",t[t.completed=3]="completed"}(i=t.State||(t.State={}));var n=function(n){function r(t){var e=n.call(this,t)||this;return e.speed=1,e.animationState=i.none,e._elapsedTime=0,e._animations=new Map,e}return __extends(r,n),Object.defineProperty(r.prototype,"isRunning",{get:function(){return this.animationState==i.running},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"animations",{get:function(){return this._animations},enumerable:!0,configurable:!0}),r.prototype.update=function(){if(this.animationState==i.running&&this.currentAnimation){var n=this.currentAnimation,r=1/(n.frameRate*this.speed),o=r*n.sprites.length;this._elapsedTime+=t.Time.deltaTime;var s=Math.abs(this._elapsedTime);if(this._loopMode==e.once&&s>o||this._loopMode==e.pingPongOnce&&s>2*o)return this.animationState=i.completed,this._elapsedTime=0,this.currentFrame=0,void(this.sprite=n.sprites[this.currentFrame]);var a=Math.floor(s/r),h=n.sprites.length;if(h>2&&(this._loopMode==e.pingPong||this._loopMode==e.pingPongOnce)){var c=h-1;this.currentFrame=c-Math.abs(c-a%(2*c))}else this.currentFrame=a%h;this.sprite=n.sprites[this.currentFrame]}},r.prototype.addAnimation=function(t,e){return!this.sprite&&e.sprites.length>0&&this.setSprite(e.sprites[0]),this._animations[t]=e,this},r.prototype.play=function(t,n){void 0===n&&(n=null),this.currentAnimation=this._animations[t],this.currentAnimationName=t,this.currentFrame=0,this.animationState=i.running,this.sprite=this.currentAnimation.sprites[0],this._elapsedTime=0,this._loopMode=n||e.loop},r.prototype.isAnimationActive=function(t){return this.currentAnimation&&this.currentAnimationName==t},r.prototype.pause=function(){this.animationState=i.paused},r.prototype.unPause=function(){this.animationState=i.running},r.prototype.stop=function(){this.currentAnimation=null,this.currentAnimationName=null,this.currentFrame=0,this.animationState=i.none},r}(t.SpriteRenderer);t.SpriteAnimator=n}(es||(es={})),function(t){var e=function(){function t(){}return Object.defineProperty(t.prototype,"hasCollision",{get:function(){return this.below||this.right||this.left||this.above},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.becameGroundedThisFrame=this.isGroundedOnOnewayPlatform=this.right=this.left=this.above=this.below=!1,this.slopAngle=0},t.prototype.toString=function(){return"[CollisionState] r: "+this.right+", l: "+this.left+", a: "+this.above+", b: "+this.below+", angle: "+this.slopAngle+", wasGroundedLastFrame: "+this.wasGroundedLastFrame+", becameGroundedThisFrame: "+this.becameGroundedThisFrame},t}();t.CollisionState=e;var i=function(e){function i(){var t=e.call(this)||this;return t.colliderHorizontalInset=2,t.colliderVerticalInset=6,t}return __extends(i,e),i.prototype.testCollisions=function(e,i,n){this._boxColliderBounds=i,n.wasGroundedLastFrame=n.below,n.reset();var r=e.x;e.y;if(0!=r){var o=r>0?t.Edge.right:t.Edge.left,s=this.collisionRectForSide(o,r);this.testMapCollision(s,o,n,0)?(e.x=0-t.RectangleExt.getSide(i,o),n.left=o==t.Edge.left,n.right=o==t.Edge.right,n._movementRemainderX.reset()):(n.left=!1,n.right=!1)}},i.prototype.testMapCollision=function(e,i,n,r){var o=t.EdgeExt.oppositeEdge(i);t.EdgeExt.isVertical(o)?e.center.x:e.center.y,t.RectangleExt.getSide(e,i),t.EdgeExt.isVertical(o)},i.prototype.collisionRectForSide=function(e,i){var n;return n=t.EdgeExt.isHorizontal(e)?t.RectangleExt.getRectEdgePortion(this._boxColliderBounds,e):t.RectangleExt.getHalfRect(this._boxColliderBounds,e),t.EdgeExt.isVertical(e)?t.RectangleExt.contract(n,this.colliderHorizontalInset,0):t.RectangleExt.contract(n,0,this.colliderVerticalInset),t.RectangleExt.expandSide(n,e,i),n},i}(t.Component);t.TiledMapMover=i}(es||(es={})),function(t){var e=function(e){function i(t,i,n){void 0===i&&(i=null),void 0===n&&(n=!0);var r=e.call(this)||this;return r.physicsLayer=1,r.toContainer=!1,r.tiledMap=t,r._shouldCreateColliders=n,r.displayObject=new egret.DisplayObjectContainer,i&&(r.collisionLayer=t.tileLayers[i]),r}return __extends(i,e),Object.defineProperty(i.prototype,"width",{get:function(){return this.tiledMap.width*this.tiledMap.tileWidth},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.tiledMap.height*this.tiledMap.tileHeight},enumerable:!0,configurable:!0}),i.prototype.setLayerToRender=function(t){this.layerIndicesToRender=[],this.layerIndicesToRender[0]=this.getLayerIndex(t)},i.prototype.setLayersToRender=function(){for(var t=[],e=0;e>6;0!=(e&t.LONG_MASK)&&i++,this._bits=new Array(i)}return t.prototype.and=function(t){for(var e,i=Math.min(this._bits.length,t._bits.length),n=0;n=0;)this._bits[e]&=~t._bits[e]},t.prototype.cardinality=function(){for(var t=0,e=this._bits.length-1;e>=0;e--){var i=this._bits[e];if(0!=i)if(-1!=i){var n=((i=((i=(i>>1&0x5555555555555400)+(0x5555555555555400&i))>>2&0x3333333333333400)+(0x3333333333333400&i))>>32)+i;t+=((n=((n=(n>>4&252645135)+(252645135&n))>>8&16711935)+(16711935&n))>>16&65535)+(65535&n)}else t+=64}return t},t.prototype.clear=function(t){if(null!=t){var e=t>>6;this.ensure(e),this._bits[e]&=~(1<>6;return!(e>=this._bits.length)&&0!=(this._bits[e]&1<=0;)if(0!=(this._bits[e]&t._bits[e]))return!0;return!1},t.prototype.isEmpty=function(){for(var t=this._bits.length-1;t>=0;t--)if(this._bits[t])return!1;return!0},t.prototype.nextSetBit=function(t){for(var e=t>>6,i=1<>6;this.ensure(i),this._bits[i]|=1<=this._bits.length){var e=new Number[t+1];e=this._bits.copyWithin(0,0,this._bits.length),this._bits=e}},t.LONG_MASK=63,t}();t.BitSet=e}(es||(es={})),function(t){var e=function(){function e(t){this._components=[],this._componentsToAdd=[],this._componentsToRemove=[],this._tempBufferList=[],this._entity=t}return Object.defineProperty(e.prototype,"count",{get:function(){return this._components.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._components},enumerable:!0,configurable:!0}),e.prototype.markEntityListUnsorted=function(){this._isComponentListUnsorted=!0},e.prototype.add=function(t){this._componentsToAdd.push(t)},e.prototype.remove=function(t){this._componentsToRemove.contains(t)&&console.warn("You are trying to remove a Component ("+t+") that you already removed"),this._componentsToAdd.contains(t)?this._componentsToAdd.remove(t):this._componentsToRemove.push(t)},e.prototype.removeAllComponents=function(){for(var t=0;t0){for(var i=0;i0){i=0;for(var n=this._componentsToAdd.length;i0){var e=this._entitiesToRemove;this._entitiesToRemove=this._tempEntityList,this._tempEntityList=e,this._tempEntityList.forEach(function(e){t.removeFromTagList(e),t._entities.remove(e),e.onRemovedFromScene(),e.scene=null,t.scene.entityProcessors.onEntityRemoved(e)}),this._tempEntityList.length=0}if(this._entitiesToAdded.length>0){e=this._entitiesToAdded;this._entitiesToAdded=this._tempEntityList,this._tempEntityList=e,this._tempEntityList.forEach(function(e){t._entities.contains(e)||(t._entities.push(e),e.scene=t.scene,t.addToTagList(e),t.scene.entityProcessors.onEntityAdded(e))}),this._tempEntityList.forEach(function(t){return t.onAddedToScene()}),this._tempEntityList.length=0,this._isEntityListUnsorted=!0}this._isEntityListUnsorted&&(this._entities.sort(),this._isEntityListUnsorted=!1),this._unsortedTags.length>0&&(this._unsortedTags.forEach(function(e){t._entityDict.get(e).sort()}),this._unsortedTags.length=0)},e.prototype.findEntity=function(t){for(var e=0;e=0;e=this.allSet.nextSetBit(e+1))if(!t.componentBits.get(e))return!1;return!(!this.exclusionSet.isEmpty()&&this.exclusionSet.intersects(t.componentBits))&&!(!this.oneSet.isEmpty()&&!this.oneSet.intersects(t.componentBits))},e.prototype.all=function(){for(var e=this,i=[],n=0;n0){for(var t=0,i=this._unsortedRenderLayers.length;t=e)return t;var n=!1;"-"==t.substr(0,1)&&(n=!0,t=t.substr(1));for(var r=e-i,o=0;o1?this.reverse(t.substring(1))+t.substring(0,1):t},t.cutOff=function(t,e,i,n){void 0===n&&(n=!0),e=Math.floor(e),i=Math.floor(i);var r=t.length;e>r&&(e=r);var o,s=e,a=e+i;return n?o=t.substring(0,s)+t.substr(a,r):(a=(s=r-1-e-i)+i,o=t.substring(0,s+1)+t.substr(a+1,r)),o},t.strReplace=function(t,e){for(var i=0,n=e.length;i",">",'"',""","'","'","®","®","©","©","™","™"],t}();!function(t){var e=function(){function e(){}return e.convertImageToCanvas=function(e,i){this.sharedCanvas||(this.sharedCanvas=egret.sys.createCanvas(),this.sharedContext=this.sharedCanvas.getContext("2d"));var n=e.$getTextureWidth(),r=e.$getTextureHeight();i||((i=egret.$TempRectangle).x=0,i.y=0,i.width=n,i.height=r),i.x=Math.min(i.x,n-1),i.y=Math.min(i.y,r-1),i.width=Math.min(i.width,n-i.x),i.height=Math.min(i.height,r-i.y);var o=Math.floor(i.width),s=Math.floor(i.height),a=this.sharedCanvas;if(a.style.width=o+"px",a.style.height=s+"px",this.sharedCanvas.width=o,this.sharedCanvas.height=s,"webgl"==egret.Capabilities.renderMode){var h=void 0;e.$renderBuffer?h=e:(egret.sys.systemRenderer.renderClear&&egret.sys.systemRenderer.renderClear(),(h=new egret.RenderTexture).drawToTexture(new egret.Bitmap(e)));for(var c=h.$renderBuffer.getPixels(i.x,i.y,o,s),u=0,l=0,p=0;p=0?"png":"jpg"});return wx.getFileSystemManager().saveFile({tempFilePath:o,filePath:wx.env.USER_DATA_PATH+"/"+i,success:function(t){}}),o},e.getPixel32=function(t,e,i){return egret.$warn(1041,"getPixel32","getPixels"),t.getPixels(e,i)},e.getPixels=function(t,e,i,n,r){if(void 0===n&&(n=1),void 0===r&&(r=1),"webgl"==egret.Capabilities.renderMode){var o=void 0;return t.$renderBuffer?o=t:(o=new egret.RenderTexture).drawToTexture(new egret.Bitmap(t)),o.$renderBuffer.getPixels(e,i,n,r)}try{this.convertImageToCanvas(t);return this.sharedContext.getImageData(e,i,n,r).data}catch(t){egret.$error(1039)}},e}();t.TextureUtils=e}(es||(es={})),function(t){var e=function(){function t(){}return t.update=function(t){var e=(t-this._lastTime)/1e3;this.deltaTime=e*this.timeScale,this.unscaledDeltaTime=e,this._timeSinceSceneLoad+=e,this.frameCount++,this._lastTime=t},t.sceneChanged=function(){this._timeSinceSceneLoad=0},t.checkEvery=function(t){return this._timeSinceSceneLoad/t>(this._timeSinceSceneLoad-this.deltaTime)/t},t.deltaTime=0,t.timeScale=1,t.frameCount=0,t._lastTime=0,t}();t.Time=e}(es||(es={}));var TimeUtils=function(){function t(){}return t.monthId=function(t){void 0===t&&(t=null);var e=(t=t||new Date).getFullYear(),i=t.getMonth()+1;return parseInt(e+(i<10?"0":"")+i)},t.dateId=function(t){void 0===t&&(t=null);var e=(t=t||new Date).getMonth()+1,i=e<10?"0":"",n=t.getDate(),r=n<10?"0":"";return parseInt(t.getFullYear()+i+e+r+n)},t.weekId=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!0),t=t||new Date;var i=new Date;i.setTime(t.getTime()),i.setDate(1),i.setMonth(0);var n=i.getFullYear(),r=i.getDay();0==r&&(r=7);var o=!1;r<=4?(o=r>1,i.setDate(i.getDate()-(r-1))):i.setDate(i.getDate()+7-r+1);var s=this.diffDay(t,i,!1);if(s<0)return i.setDate(1),i.setMonth(0),i.setDate(i.getDate()-1),this.weekId(i,!1);var a=s/7,h=Math.floor(a)+1;if(53==h){i.setTime(t.getTime()),i.setDate(i.getDate()-1);var c=i.getDay();if(0==c&&(c=7),e&&(!o||c<4))return i.setFullYear(i.getFullYear()+1),i.setDate(1),i.setMonth(0),this.weekId(i,!1)}return parseInt(n+"00"+(h>9?"":"0")+h)},t.diffDay=function(t,e,i){void 0===i&&(i=!1);var n=(t.getTime()-e.getTime())/864e5;return i?Math.ceil(n):Math.floor(n)},t.getFirstDayOfWeek=function(t){var e=(t=t||new Date).getDay()||7;return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1-e,0,0,0,0)},t.getFirstOfDay=function(t){return(t=t||new Date).setHours(0,0,0,0),t},t.getNextFirstOfDay=function(t){return new Date(this.getFirstOfDay(t).getTime()+864e5)},t.formatDate=function(t){var e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();return e+"-"+i+"-"+(n=n<10?"0"+n:n)},t.formatDateTime=function(t){var e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();n=n<10?"0"+n:n;var r=t.getHours(),o=t.getMinutes();o=o<10?"0"+o:o;var s=t.getSeconds();return e+"-"+i+"-"+n+" "+r+":"+o+":"+(s=s<10?"0"+s:s)},t.parseDate=function(t){var e=Date.parse(t);return isNaN(e)?new Date:new Date(Date.parse(t.replace(/-/g,"/")))},t.secondToTime=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=":"),void 0===i&&(i=!0);var n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=Math.floor(t%3600%60),s=n.toString(),a=r.toString(),h=o.toString();return n<10&&(s="0"+s),r<10&&(a="0"+a),o<10&&(h="0"+h),i?s+e+a+e+h:a+e+h},t.timeToMillisecond=function(t,e){void 0===e&&(e=":");for(var i=t.split(e),n=0,r=i.length,o=0;o-1?this.os="iOS":n.indexOf("android")>-1&&(this.os="Android");var r=i.language;r=r.indexOf("zh")>-1?"zh-CN":"en-US",this.language=r}},e}(egret.Capabilities);t.GraphicsCapabilities=e}(es||(es={})),function(t){var e=function(){function e(){this.setup(),this.graphicsCapabilities=new t.GraphicsCapabilities,this.graphicsCapabilities.initialize(this)}return Object.defineProperty(e.prototype,"viewport",{get:function(){return this._viewport},enumerable:!0,configurable:!0}),e.prototype.setup=function(){this._viewport=new t.Viewport(0,0,t.Core._instance.stage.stageWidth,t.Core._instance.stage.stageHeight)},e}();t.GraphicsDevice=e}(es||(es={})),function(t){var e=function(){function e(t,e,i,n){this._x=t,this._y=e,this._width=i,this._height=n,this._minDepth=0,this._maxDepth=1}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatio",{get:function(){return 0!=this._height&&0!=this._width?this._width/this._height:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){return new t.Rectangle(this._x,this._y,this._width,this._height)},set:function(t){this._x=t.x,this._y=t.y,this._width=t.width,this._height=t.height},enumerable:!0,configurable:!0}),e}();t.Viewport=e}(es||(es={})),function(t){var e=function(e){function i(){return e.call(this,t.PostProcessor.default_vert,i.blur_frag,{screenWidth:t.Core.graphicsDevice.viewport.width,screenHeight:t.Core.graphicsDevice.viewport.height})||this}return __extends(i,e),i.blur_frag="precision mediump float;\nuniform sampler2D uSampler;\nuniform float screenWidth;\nuniform float screenHeight;\nfloat normpdf(in float x, in float sigma)\n{\nreturn 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;\n}\nvoid main()\n{\nvec3 c = texture2D(uSampler, gl_FragCoord.xy / vec2(screenWidth, screenHeight).xy).rgb;\nconst int mSize = 11;\nconst int kSize = (mSize - 1)/2;\nfloat kernel[mSize];\nvec3 final_colour = vec3(0.0);\nfloat sigma = 7.0;\nfloat z = 0.0;\nfor (int j = 0; j <= kSize; ++j)\n{\nkernel[kSize+j] = kernel[kSize-j] = normpdf(float(j),sigma);\n}\nfor (int j = 0; j < mSize; ++j)\n{\nz += kernel[j];\n}\nfor (int i = -kSize; i <= kSize; ++i)\n{\nfor (int j = -kSize; j <= kSize; ++j)\n{\nfinal_colour += kernel[kSize+j]*kernel[kSize+i]*texture2D(uSampler, (gl_FragCoord.xy+vec2(float(i),float(j))) / vec2(screenWidth, screenHeight).xy).rgb;\n}\n}\ngl_FragColor = vec4(final_colour/(z*z), 1.0);\n}",i}(egret.CustomFilter);t.GaussianBlurEffect=e}(es||(es={})),function(t){var e=function(t){function e(){return t.call(this,e.vertSrc,e.fragmentSrc)||this}return __extends(e,t),e.vertSrc="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\n gl_Position = vec4( (aVertexPosition / projectionVector) + center , 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e.fragmentSrc="precision lowp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n#define SAMPLE_COUNT 15\nuniform vec2 _sampleOffsets[SAMPLE_COUNT];\nuniform float _sampleWeights[SAMPLE_COUNT];\nvoid main(void) {\nvec4 c = vec4(0, 0, 0, 0);\nfor( int i = 0; i < SAMPLE_COUNT; i++ )\n c += texture2D( uSampler, vTextureCoord + _sampleOffsets[i] ) * _sampleWeights[i];\ngl_FragColor = c;\n}",e}(egret.CustomFilter);t.PolygonLightEffect=e}(es||(es={})),function(t){var e=function(){function e(t){void 0===t&&(t=null),this.enabled=!0,this.effect=t}return e.prototype.onAddedToScene=function(e){this.scene=e,this.shape=new egret.Shape,this.shape.graphics.beginFill(16777215,1),this.shape.graphics.drawRect(0,0,t.Core.graphicsDevice.viewport.width,t.Core.graphicsDevice.viewport.height),this.shape.graphics.endFill(),e.addChild(this.shape)},e.prototype.process=function(){this.drawFullscreenQuad()},e.prototype.onSceneBackBufferSizeChanged=function(t,e){},e.prototype.unload=function(){this.effect&&(this.effect=null),this.scene.removeChild(this.shape),this.scene=null},e.prototype.drawFullscreenQuad=function(){this.scene.filters=[this.effect]},e.default_vert="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aColor;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\ngl_Position = vec4( (aVertexPosition / projectionVector) + center , 0.0, 1.0);\nvTextureCoord = aTextureCoord;\nvColor = vec4(aColor.x, aColor.x, aColor.x, aColor.x);\n}",e}();t.PostProcessor=e}(es||(es={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return __extends(i,e),i.prototype.onAddedToScene=function(i){e.prototype.onAddedToScene.call(this,i),this.effect=new t.GaussianBlurEffect},i}(t.PostProcessor);t.GaussianBlurPostProcessor=e}(es||(es={})),function(t){var e=function(){function t(t,e){void 0===e&&(e=null),this.renderOrder=0,this.shouldDebugRender=!0,this.camera=e,this.renderOrder=t}return Object.defineProperty(t.prototype,"wantsToRenderToSceneRenderTarget",{get:function(){return!!this.renderTexture},enumerable:!0,configurable:!0}),t.prototype.onAddedToScene=function(t){},t.prototype.unload=function(){},t.prototype.onSceneBackBufferSizeChanged=function(t,e){},t.prototype.compareTo=function(t){return this.renderOrder-t.renderOrder},t.prototype.beginRender=function(t){},t.prototype.renderAfterStateCheck=function(t,e){t.render(e)},t.prototype.debugRender=function(t,e){for(var i=0;ii?i:t},e.pointOnCirlce=function(i,n,r){var o=e.toRadians(r);return new t.Vector2(Math.cos(o)*o+i.x,Math.sin(o)*o+i.y)},e.isEven=function(t){return t%2==0},e.clamp01=function(t){return t<0?0:t>1?1:t},e.angleBetweenVectors=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},e.incrementWithWrap=function(t,e){return++t==e?0:t},e.approach=function(t,e,i){return tn&&(n=s.x),s.yr&&(r=s.y)}return this.fromMinMax(e,i,n,r)},i.prototype.intersects=function(t){return t.leftthis.x+this.width)return e}else{var n=1/t.direction.x,r=(this.x-t.start.x)*n,o=(this.x+this.width-t.start.x)*n;if(r>o){var s=r;r=o,o=s}if((e=Math.max(r,e))>(i=Math.min(o,i)))return e}if(Math.abs(t.direction.y)<1e-6){if(t.start.ythis.y+this.height)return e}else{var a=1/t.direction.y,h=(this.y-t.start.y)*a,c=(this.y+this.height-t.start.y)*a;if(h>c){var u=h;h=c,c=u}if((e=Math.max(h,e))>(i=Math.max(c,i)))return e}return e},i.prototype.containsRect=function(t){return this.x<=t.x&&t.x1)return!1;var u=(h.x*o.y-h.y*o.x)/a;return!(u<0||u>1)},i.lineToLineIntersection=function(e,i,n,r){var o=new t.Vector2(0,0),s=t.Vector2.subtract(i,e),a=t.Vector2.subtract(r,n),h=s.x*a.y-s.y*a.x;if(0==h)return o;var c=t.Vector2.subtract(n,e),u=(c.x*a.y-c.y*a.x)/h;if(u<0||u>1)return o;var l=(c.x*s.y-c.y*s.x)/h;return l<0||l>1?o:o=t.Vector2.add(e,new t.Vector2(u*s.x,u*s.y))},i.closestPointOnLine=function(e,i,n){var r=t.Vector2.subtract(i,e),o=t.Vector2.subtract(n,e),s=t.Vector2.dot(o,r)/t.Vector2.dot(r,r);return s=t.MathHelper.clamp(s,0,1),t.Vector2.add(e,new t.Vector2(r.x*s,r.y*s))},i.isCircleToCircle=function(e,i,n,r){return t.Vector2.distanceSquared(e,n)<(i+r)*(i+r)},i.isCircleToLine=function(e,i,n,r){return t.Vector2.distanceSquared(e,this.closestPointOnLine(n,r,e))=t&&r.y>=e&&r.x=t+n&&(s|=e.right),o.y=i+r&&(s|=e.bottom),s},i}();t.Collisions=i}(es||(es={})),function(t){var e=function(){function e(e,i,n,r,o){this.fraction=0,this.distance=0,this.point=t.Vector2.zero,this.normal=t.Vector2.zero,this.collider=e,this.fraction=i,this.distance=n,this.point=r,this.centroid=t.Vector2.zero}return e.prototype.setValues=function(t,e,i,n){this.collider=t,this.fraction=e,this.distance=i,this.point=n},e.prototype.setValuesNonCollider=function(t,e,i,n){this.fraction=t,this.distance=e,this.point=i,this.normal=n},e.prototype.reset=function(){this.collider=null,this.fraction=this.distance=0},e.prototype.toString=function(){return"[RaycastHit] fraction: "+this.fraction+", distance: "+this.distance+", normal: "+this.normal+", centroid: "+this.centroid+", point: "+this.point},e}();t.RaycastHit=e}(es||(es={})),function(t){var e=function(){function e(){}return e.reset=function(){this._spatialHash=new t.SpatialHash(this.spatialHashCellSize)},e.clear=function(){this._spatialHash.clear()},e.overlapCircleAll=function(t,e,i,n){if(void 0===n&&(n=-1),0!=i.length)return this._spatialHash.overlapCircle(t,e,i,n);console.error("An empty results array was passed in. No results will ever be returned.")},e.boxcastBroadphase=function(t,e){return void 0===e&&(e=this.allLayers),this._spatialHash.aabbBroadphase(t,null,e)},e.boxcastBroadphaseExcludingSelf=function(t,e,i){return void 0===i&&(i=this.allLayers),this._spatialHash.aabbBroadphase(e,t,i)},e.addCollider=function(t){e._spatialHash.register(t)},e.removeCollider=function(t){e._spatialHash.remove(t)},e.updateCollider=function(t){this._spatialHash.remove(t),this._spatialHash.register(t)},e.linecast=function(t,i,n){return void 0===n&&(n=e.allLayers),this._hitArray[0].reset(),this.linecastAll(t,i,this._hitArray,n),this._hitArray[0]},e.linecastAll=function(t,i,n,r){return void 0===r&&(r=e.allLayers),0==n.length?(console.warn("传入了一个空的hits数组。没有点击会被返回"),0):this._spatialHash.linecast(t,i,n,r)},e.debugDraw=function(t){this._spatialHash.debugDraw(t,2)},e.spatialHashCellSize=100,e.allLayers=-1,e.raycastsHitTriggers=!1,e.raycastsStartInColliders=!1,e._hitArray=[new t.RaycastHit],e}();t.Physics=e}(es||(es={})),function(t){var e=function(){return function(e,i){this.start=e,this.end=i,this.direction=t.Vector2.subtract(this.end,this.start)}}();t.Ray2D=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.clone=function(){return ObjectUtils.clone(this)},t}();t.Shape=e}(es||(es={})),function(t){var e=function(e){function i(t,i){var n=e.call(this)||this;return n._areEdgeNormalsDirty=!0,n.isUnrotated=!0,n.setPoints(t),n.isBox=i,n}return __extends(i,e),Object.defineProperty(i.prototype,"edgeNormals",{get:function(){return this._areEdgeNormalsDirty&&this.buildEdgeNormals(),this._edgeNormals},enumerable:!0,configurable:!0}),i.prototype.setPoints=function(t){this.points=t,this.recalculateCenterAndEdgeNormals(),this._originalPoints=[];for(var e=0;e=this.points.length?this.points[0]:this.points[n+1];var o=t.Vector2Ext.perpendicular(r,e);o=t.Vector2.normalize(o),this._edgeNormals[n]=o}},i.buildSymmetricalPolygon=function(e,i){for(var n=new Array(e),r=0;rr&&(r=s,n=o)}return e[n]},i.getClosestPointOnPolygonToPoint=function(e,i,n,r){n=Number.MAX_VALUE,r=new t.Vector2(0,0);for(var o,s=new t.Vector2(0,0),a=0;ae.y!=this.points[r].y>e.y&&e.x<(this.points[r].x-this.points[n].x)*(e.y-this.points[n].y)/(this.points[r].y-this.points[n].y)+this.points[n].x&&(i=!i);return i},i.prototype.pointCollidesWithShape=function(e,i){return t.ShapeCollisions.pointToPoly(e,this,i)},i}(t.Shape);t.Polygon=e}(es||(es={})),function(t){var e=function(e){function i(t,n){var r=e.call(this,i.buildBox(t,n),!0)||this;return r.width=t,r.height=n,r}return __extends(i,e),i.buildBox=function(e,i){var n=e/2,r=i/2,o=new Array(4);return o[0]=new t.Vector2(-n,-r),o[1]=new t.Vector2(n,-r),o[2]=new t.Vector2(n,r),o[3]=new t.Vector2(-n,r),o},i.prototype.updateBox=function(e,i){this.width=e,this.height=i;var n=e/2,r=i/2;this.points[0]=new t.Vector2(-n,-r),this.points[1]=new t.Vector2(n,-r),this.points[2]=new t.Vector2(n,r),this.points[3]=new t.Vector2(-n,r);for(var o=0;o1)return s;var a,h=t.Vector2.add(o.start,t.Vector2.add(o.direction,new t.Vector2(s))),c=0;h.xi.bounds.right&&(c|=1),h.yi.bounds.bottom&&(c|=2);var u=a+c;return 3==u&&console.log("m == 3. corner "+t.Time.frameCount),s},e}();t.RealtimeCollisions=e}(es||(es={})),function(t){var e=function(){function e(){}return e.polygonToPolygon=function(e,i,n){for(var r,o=!0,s=e.edgeNormals,a=i.edgeNormals,h=Number.POSITIVE_INFINITY,c=new t.Vector2,u=t.Vector2.subtract(e.position,i.position),l=0;l0&&(o=!1),!o)return!1;(m=Math.abs(m))r&&(r=o);return{min:n,max:r}},e.circleToPolygon=function(e,i,n){var r,o=t.Vector2.subtract(e.position,i.position),s=t.Polygon.getClosestPointOnPolygonToPoint(i.points,o,0,n.normal),a=i.containsPoint(e.position);if(0>e.radius*e.radius&&!a)return!1;a?r=t.Vector2.multiply(n.normal,new t.Vector2(Math.sqrt(0)-e.radius)):r=t.Vector2.multiply(n.normal,new t.Vector2(e.radius));return n.minimumTranslationVector=r,n.point=t.Vector2.add(s,i.position),!0},e.circleToBox=function(e,i,n){var r=i.bounds.getClosestPointOnRectangleBorderToPoint(e.position,n.normal);if(i.containsPoint(e.position)){n.point=r;var o=t.Vector2.add(r,t.Vector2.multiply(n.normal,new t.Vector2(e.radius)));return n.minimumTranslationVector=t.Vector2.subtract(e.position,o),!0}var s=t.Vector2.distanceSquared(r,e.position);if(0==s)n.minimumTranslationVector=t.Vector2.multiply(n.normal,new t.Vector2(e.radius));else if(s<=e.radius*e.radius){n.normal=t.Vector2.subtract(e.position,r);var a=n.normal.length()-e.radius;return n.point=r,n.normal=t.Vector2Ext.normalize(n.normal),n.minimumTranslationVector=t.Vector2.multiply(new t.Vector2(a),n.normal),!0}return!1},e.pointToCircle=function(e,i,n){var r=t.Vector2.distanceSquared(e,i.position),o=1+i.radius;if(r1)return!1;var l=(c.x*s.y-c.y*s.x)/h;return!(l<0||l>1)&&(o=o.add(e).add(t.Vector2.multiply(new t.Vector2(u),s)),!0)},e.lineToCircle=function(e,i,n,r){var o=t.Vector2.distance(e,i),s=t.Vector2.divide(t.Vector2.subtract(i,e),new t.Vector2(o)),a=t.Vector2.subtract(e,n.position),h=t.Vector2.dot(a,s),c=t.Vector2.dot(a,a)-n.radius*n.radius;if(c>0&&h>0)return!1;var u=h*h-c;return!(u<0)&&(r.fraction=-h-Math.sqrt(u),r.fraction<0&&(r.fraction=0),r.point=t.Vector2.add(e,t.Vector2.multiply(new t.Vector2(r.fraction),s)),r.distance=t.Vector2.distance(e,r.point),r.normal=t.Vector2.normalize(t.Vector2.subtract(r.point,n.position)),r.fraction=r.distance/o,!0)},e.boxToBoxCast=function(e,i,n,r){var o=this.minkowskiDifference(e,i);if(o.contains(0,0)){var s=o.getClosestPointOnBoundsToOrigin();return!s.equals(t.Vector2.zero)&&(r.normal=new t.Vector2(-s.x),r.normal=r.normal.normalize(),r.distance=0,r.fraction=0,!0)}var a=new t.Ray2D(t.Vector2.zero,new t.Vector2(-n.x)),h=o.rayIntersects(a);return h<=1&&(r.fraction=h,r.distance=n.length()*h,r.normal=new t.Vector2(-n.x),r.normal=r.normal.normalize(),r.centroid=t.Vector2.add(e.bounds.center,t.Vector2.multiply(n,new t.Vector2(h))),!0)},e}();t.ShapeCollisions=e}(es||(es={})),function(t){var e=function(){function e(e){void 0===e&&(e=100),this.gridBounds=new t.Rectangle,this._overlapTestCircle=new t.Circle(0),this._cellDict=new i,this._tempHashSet=[],this._cellSize=e,this._inverseCellSize=1/this._cellSize,this._raycastParser=new n}return e.prototype.register=function(e){var i=e.bounds;e.registeredPhysicsBounds=i;var n=this.cellCoords(i.x,i.y),r=this.cellCoords(i.right,i.bottom);this.gridBounds.contains(n.x,n.y)||(this.gridBounds=t.RectangleExt.union(this.gridBounds,n)),this.gridBounds.contains(r.x,r.y)||(this.gridBounds=t.RectangleExt.union(this.gridBounds,r));for(var o=n.x;o<=r.x;o++)for(var s=n.y;s<=r.y;s++){var a=this.cellAtPosition(o,s,!0);a.firstOrDefault(function(t){return t.hashCode==e.hashCode})||a.push(e)}},e.prototype.remove=function(t){for(var e=t.registeredPhysicsBounds,i=this.cellCoords(e.x,e.y),n=this.cellCoords(e.right,e.bottom),r=i.x;r<=n.x;r++)for(var o=i.y;o<=n.y;o++){var s=this.cellAtPosition(r,o);s?s.remove(t):console.log("从不存在碰撞器的单元格中移除碰撞器: ["+t+"]")}},e.prototype.removeWithBruteForce=function(t){this._cellDict.remove(t)},e.prototype.clear=function(){this._cellDict.clear()},e.prototype.debugDraw=function(t,e){void 0===e&&(e=1);for(var i=this.gridBounds.x;i<=this.gridBounds.right;i++)for(var n=this.gridBounds.y;n<=this.gridBounds.bottom;n++){var r=this.cellAtPosition(i,n);r&&r.length>0&&this.debugDrawCellDetails(i,n,r.length,t,e)}},e.prototype.aabbBroadphase=function(e,i,n){this._tempHashSet.length=0;for(var r=this.cellCoords(e.x,e.y),o=this.cellCoords(e.right,e.bottom),s=r.x;s<=o.x;s++)for(var a=r.y;a<=o.y;a++){var h=this.cellAtPosition(s,a);if(h)for(var c=function(r){var o=h[r];if(o==i||!t.Flags.isFlagSet(n,o.physicsLayer))return"continue";e.intersects(o.bounds)&&(u._tempHashSet.firstOrDefault(function(t){return t.hashCode==o.hashCode})||u._tempHashSet.push(o))},u=this,l=0;l=0&&(e.push(this.findBoundsRect(i,o,r,t)),i=-1)}i>=0&&(e.push(this.findBoundsRect(i,this.map.width,r,t)),i=-1)}return e},e.prototype.findBoundsRect=function(e,i,n,r){for(var o=-1,s=n+1;sthis.tileHeight||this.maxTileWidth>this.tileWidth},enumerable:!0,configurable:!0}),i.prototype.getTilesetForTileGid=function(t){if(0==t)return null;for(var e=this.tilesets.length-1;e>=0;e--)if(this.tilesets[e].firstGid<=t)return this.tilesets[e];console.error("tile gid"+t+"未在任何tileset中找到")},i.prototype.worldToTilePositionX=function(e,i){void 0===i&&(i=!0);var n=Math.floor(e/this.tileWidth);return i?t.MathHelper.clamp(n,0,this.width-1):n},i.prototype.worldToTilePositionY=function(e,i){void 0===i&&(i=!0);var n=Math.floor(e/this.tileHeight);return i?t.MathHelper.clamp(n,0,this.height-1):n},i.prototype.getLayer=function(t){return this.layers[t]},i.prototype.update=function(){this.tilesets.forEach(function(t){t.update()})},i.prototype.dispose=function(t){void 0===t&&(t=!0),this._isDisposed||(t&&(this.tilesets.forEach(function(t){t.image&&t.image.dispose()}),this.imageLayers.forEach(function(t){t.image&&t.image.dispose()})),this._isDisposed=!0)},i}(t.TmxDocument);t.TmxMap=e,function(t){t[t.unknown=0]="unknown",t[t.orthogonal=1]="orthogonal",t[t.isometric=2]="isometric",t[t.staggered=3]="staggered",t[t.hexagonal=4]="hexagonal"}(t.OrientationType||(t.OrientationType={})),function(t){t[t.x=0]="x",t[t.y=1]="y"}(t.StaggerAxisType||(t.StaggerAxisType={})),function(t){t[t.odd=0]="odd",t[t.even=1]="even"}(t.StaggerIndexType||(t.StaggerIndexType={})),function(t){t[t.rightDown=0]="rightDown",t[t.rightUp=1]="rightUp",t[t.leftDown=2]="leftDown",t[t.leftUp=3]="leftUp"}(t.RenderOrderType||(t.RenderOrderType={}))}(es||(es={})),function(t){var e=function(){return function(){}}();t.TmxObjectGroup=e;var i=function(){return function(){this.shape=new egret.Shape,this.textField=new egret.TextField}}();t.TmxObject=i;var n=function(){return function(){}}();t.TmxText=n;var r=function(){return function(){}}();t.TmxAlignment=r,function(t){t[t.basic=0]="basic",t[t.point=1]="point",t[t.tile=2]="tile",t[t.ellipse=3]="ellipse",t[t.polygon=4]="polygon",t[t.polyline=5]="polyline",t[t.text=6]="text"}(t.TmxObjectType||(t.TmxObjectType={})),function(t){t[t.unkownOrder=-1]="unkownOrder",t[t.TopDown=0]="TopDown",t[t.IndexOrder=1]="IndexOrder"}(t.DrawOrderType||(t.DrawOrderType={})),function(t){t[t.left=0]="left",t[t.center=1]="center",t[t.right=2]="right",t[t.justify=3]="justify"}(t.TmxHorizontalAlignment||(t.TmxHorizontalAlignment={})),function(t){t[t.top=0]="top",t[t.center=1]="center",t[t.bottom=2]="bottom"}(t.TmxVerticalAlignment||(t.TmxVerticalAlignment={}))}(es||(es={})),function(t){var e=function(){function e(){}return e.loadTmxMap=function(t,e){var i=RES.getRes(e);return this.loadTmxMapData(t,i)},e.loadTmxMapData=function(e,i){return __awaiter(this,void 0,void 0,function(){var n,r,o,s;return __generator(this,function(a){switch(a.label){case 0:e.version=i.version,e.tiledVersion=i.tiledversion,e.width=i.width,e.height=i.height,e.tileWidth=i.tilewidth,e.tileHeight=i.tileheight,e.hexSideLength=i.hexsidelength,e.orientation=this.parseOrientationType(i.orientation),e.staggerAxis=this.parseStaggerAxisType(i.staggeraxis),e.staggerIndex=this.parseStaggerIndexType(i.staggerindex),e.renderOrder=this.parseRenderOrderType(i.renderorder),e.nextObjectID=i.nextobjectid,e.backgroundColor=t.TmxUtils.color16ToUnit(i.color),e.properties=this.parsePropertyDict(i.properties),e.maxTileWidth=e.tileWidth,e.maxTileHeight=e.tileHeight,e.tilesets=[],n=0,r=i.tilesets,a.label=1;case 1:return nt.map.maxTileWidth&&(t.map.maxTileWidth=e.image.width),e.image.height>t.map.maxTileHeight&&(t.map.maxTileHeight=e.image.height))}),t.tileRegions.forEach(function(e){var i=e.width,n=e.height;i>t.map.maxTileWidth&&(t.map.maxTileWidth=i),i>t.map.maxTileHeight&&(t.map.maxTileHeight=n)})},e.parseOrientationType=function(e){return"unknown"==e?t.OrientationType.unknown:"orthogonal"==e?t.OrientationType.orthogonal:"isometric"==e?t.OrientationType.isometric:"staggered"==e?t.OrientationType.staggered:"hexagonal"==e?t.OrientationType.hexagonal:t.OrientationType.unknown},e.parseStaggerAxisType=function(e){return"y"==e?t.StaggerAxisType.y:t.StaggerAxisType.x},e.parseStaggerIndexType=function(e){return"even"==e?t.StaggerIndexType.even:t.StaggerIndexType.odd},e.parseRenderOrderType=function(e){return"right-up"==e?t.RenderOrderType.rightUp:"left-down"==e?t.RenderOrderType.leftDown:"left-up"==e?t.RenderOrderType.leftUp:t.RenderOrderType.rightDown},e.parsePropertyDict=function(e){if(!e)return null;for(var i=new Map,n=0,r=e;n=e.columns));y+=e.tileWidth+e.spacing);else e.tiles.forEach(function(i,n){e.tileRegions.set(n,new t.Rectangle(0,0,i.image.width,i.image.height))});return[2,e]}})})},e.loadTmxTilesetTile=function(e,i,n,r,o){return __awaiter(this,void 0,void 0,function(){var s,a,h,c,u,l,p,d,f,g,m,y,_;return __generator(this,function(v){switch(v.label){case 0:if(e.tileset=i,e.id=n.id,s=n.terrain)for(e.terrainEdges=new Array(4),a=0,h=0,c=s;h0){a.shape.x=h.x,a.shape.y=h.y,i.addChild(a.shape),a.shape.graphics.clear(),a.shape.graphics.lineStyle(1,10526884);for(l=0;l0&&(u=l.currentAnimationFrameGid);var p=i.tileset.tileRegions.get(u),d=Math.floor(i.x)*s,f=Math.floor(i.y)*a;i.horizontalFlip&&i.verticalFlip?(d+=a+(p.height*o.y-a),f-=p.width*o.x-s):i.horizontalFlip?d+=s+(p.height*o.y-a):i.verticalFlip?f+=s-p.width*o.x:f+=a-p.height*o.y;var g=new t.Vector2(d,f).add(r);if(i.tileset.image){if(n){var m=i.tileset.image.bitmap.getTexture(""+u);m||(m=i.tileset.image.bitmap.createTexture(""+u,p.x,p.y,p.width,p.height)),i.tileset.image.texture=new e(m),n.addChild(i.tileset.image.texture),i.tileset.image.texture.x!=g.x&&(i.tileset.image.texture.x=g.x),i.tileset.image.texture.y!=g.y&&(i.tileset.image.texture.y=g.y),i.verticalFlip&&i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=-1):i.verticalFlip?(i.tileset.image.texture.scaleX=o.x,i.tileset.image.texture.scaleY=-1):i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=o.y):(i.tileset.image.texture.scaleX=o.x,i.tileset.image.texture.scaleY=o.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 l.image.texture&&(l.image.bitmap.getTexture(u.toString())||(l.image.texture=new e(l.image.bitmap.createTexture(u.toString(),p.x,p.y,p.width,p.height)),n.addChild(l.image.texture)),l.image.texture.x=g.x,l.image.texture.y=g.y,l.image.texture.scaleX=o.x,l.image.texture.scaleY=o.y,l.image.texture.rotation=0,l.image.texture.anchorOffsetX=0,l.image.texture.anchorOffsetY=0,l.image.texture.filters=[h])},i}();t.TiledRendering=i}(es||(es={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e.prototype.update=function(){this.tiles.forEach(function(t){t.updateAnimatedTiles()})},e}(t.TmxDocument);t.TmxTileset=e;var i=function(){return function(){}}();t.TmxTileOffset=i;var n=function(){return function(){}}();t.TmxTerrain=n}(es||(es={})),function(t){var e=function(){function e(){}return Object.defineProperty(e.prototype,"currentAnimationFrameGid",{get:function(){return this.animationFrames[this._animationCurrentFrame].gid+this.tileset.firstGid},enumerable:!0,configurable:!0}),e.prototype.processProperties=function(){var t;(t=this.properties.get("engine.isDestructable"))&&(this.isDestructable=Boolean(t)),(t=this.properties.get("engine:isSlope"))&&(this.isSlope=Boolean(t)),(t=this.properties.get("engine:isOneWayPlatform"))&&(this.isOneWayPlatform=Boolean(t)),(t=this.properties.get("engine:slopeTopLeft"))&&(this.slopeTopLeft=Number(t)),(t=this.properties.get("engine:slopeTopRight"))&&(this.slopeTopRight=Number(t))},e.prototype.updateAnimatedTiles=function(){0!=this.animationFrames.length&&(this._animationElapsedTime+=t.Time.deltaTime,this._animationElapsedTime>this.animationFrames[this._animationCurrentFrame].duration&&(this._animationCurrentFrame=t.MathHelper.incrementWithWrap(this._animationCurrentFrame,this.animationFrames.length),this._animationElapsedTime=0))},e}();t.TmxTilesetTile=e;var i=function(){return function(){}}();t.TmxAnimationFrame=i}(es||(es={})),function(t){var e=function(){function e(){}return e.decode=function(e,i,n){switch(n=n||"none",i=i||"none"){case"base64":var r=t.Base64Utils.decodeBase64AsArray(e,4);return"none"===n?r:t.Base64Utils.decompress(e,r,n);case"csv":return t.Base64Utils.decodeCSV(e);case"none":for(var o=[],s=0;si;n--)if(t[n]0&&t[r-1]>n;r--)t[r]=t[r-1];t[r]=n}},t.binarySearch=function(t,e){for(var i=0,n=t.length,r=i+n>>1;i=t[r]&&(i=r+1),r=i+n>>1;return t[i]==e?i:-1},t.findElementIndex=function(t,e){for(var i=t.length,n=0;nt[e]&&(e=n);return e},t.getMinElementIndex=function(t){for(var e=0,i=t.length,n=1;n=0;--r)i.unshift(e[r]);return i},t.getDifferAry=function(t,e){t=this.getUniqueAry(t),e=this.getUniqueAry(e);for(var i=t.concat(e),n={},r=[],o=i.length,s=0;s=0;e-=1)t.splice(e,1)},t.cloneList=function(t){return t?t.slice(0,t.length):null},t.equals=function(t,e){if(t==e)return!0;var i=t.length;if(i!=e.length)return!1;for(;i--;)if(t[i]!=e[i])return!1;return!0},t.insert=function(t,e,i){if(!t)return null;var n=t.length;if(e>n&&(e=n),e<0&&(e=0),e==n)t.push(i);else if(0==e)t.unshift(i);else{for(var r=n-1;r>=e;r-=1)t[r+1]=t[r];t[e]=i}return i},t}();!function(t){var e=function(){function t(){}return Object.defineProperty(t,"nativeBase64",{get:function(){return"function"==typeof window.atob},enumerable:!0,configurable:!0}),t.decode=function(t){if(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),this.nativeBase64)return window.atob(t);for(var e,i,n,r,o,s,a=[],h=0;h>4,i=(15&r)<<4|(o=this._keyStr.indexOf(t.charAt(h++)))>>2,n=(3&o)<<6|(s=this._keyStr.indexOf(t.charAt(h++))),a.push(String.fromCharCode(e)),64!==o&&a.push(String.fromCharCode(i)),64!==s&&a.push(String.fromCharCode(n));return a=a.join("")},t.encode=function(t){if(t=t.replace(/\r\n/g,"\n"),!this.nativeBase64){for(var e,i,n,r,o,s,a,h=[],c=0;c>2,o=(3&e)<<4|(i=t.charCodeAt(c++))>>4,s=(15&i)<<2|(n=t.charCodeAt(c++))>>6,a=63&n,isNaN(i)?s=a=64:isNaN(n)&&(a=64),h.push(this._keyStr.charAt(r)),h.push(this._keyStr.charAt(o)),h.push(this._keyStr.charAt(s)),h.push(this._keyStr.charAt(a));return h=h.join("")}window.btoa(t)},t.decodeBase64AsArray=function(e,i){i=i||1;var n,r,o,s=t.decode(e),a=new Uint32Array(s.length/i);for(n=0,o=s.length/i;n=0;--r)a[n]+=s.charCodeAt(n*i+r)<<(r<<3);return a},t.decompress=function(t,e,i){throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!")},t.decodeCSV=function(t){for(var e=t.replace("\n","").trim().split(","),i=[],n=0;n>16},set:function(t){this._packedValue=4278255615&this._packedValue|t<<16},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"g",{get:function(){return this._packedValue>>8},set:function(t){this._packedValue=4294902015&this._packedValue|t<<8},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"r",{get:function(){return this._packedValue},set:function(t){this._packedValue=4294967040&this._packedValue|t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"a",{get:function(){return this._packedValue>>24},set:function(t){this._packedValue=16777215&this._packedValue|t<<24},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"packedValue",{get:function(){return this._packedValue},set:function(t){this._packedValue=t},enumerable:!0,configurable:!0}),e.prototype.equals=function(t){return this._packedValue==t._packedValue},e}();t.Color=e}(es||(es={})),function(t){var e=function(){function t(){this.loadedAssets=new Map}return t.prototype.loadRes=function(t,e){var i=this;return void 0===e&&(e=!0),new Promise(function(n,r){var o=i.loadedAssets.get(t);o?n(o):e?RES.getResAsync(t).then(function(e){i.loadedAssets.set(t,e),n(e)}).catch(function(e){console.error("资源加载错误:",t,e),r(e)}):RES.getResByUrl(t).then(function(e){i.loadedAssets.set(t,e),n(e)}).catch(function(e){console.error("资源加载错误:",t,e),r(e)})})},t.prototype.dispose=function(){this.loadedAssets.forEach(function(t){t.dispose()}),this.loadedAssets.clear()},t}();t.ContentManager=e}(es||(es={})),function(t){var e=function(){function t(){}return t.getColorMatrix=function(t){var e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];return e[0]=Math.floor(t/256/256)/255,e[6]=Math.floor(t/256%256)/255,e[12]=t%256/255,new egret.ColorMatrixFilter(e)},t}();t.DrawUtils=e}(es||(es={})),function(t){var e=function(){function e(){}return e.oppositeEdge=function(e){switch(e){case t.Edge.bottom:return t.Edge.top;case t.Edge.top:return t.Edge.bottom;case t.Edge.left:return t.Edge.right;case t.Edge.right:return t.Edge.left}},e.isHorizontal=function(e){return e==t.Edge.right||e==t.Edge.left},e.isVertical=function(e){return e==t.Edge.top||e==t.Edge.bottom},e}();t.EdgeExt=e}(es||(es={})),function(t){var e=function(){return function(t,e){this.func=t,this.context=e}}();t.FuncPack=e;var i=function(){function t(){this._messageTable=new Map}return t.prototype.addObserver=function(t,i,n){var r=this._messageTable.get(t);r||(r=[],this._messageTable.set(t,r)),-1!=r.findIndex(function(t){return t.func==i})&&console.warn("您试图添加相同的观察者两次"),r.push(new e(i,n))},t.prototype.removeObserver=function(t,e){var i=this._messageTable.get(t),n=i.findIndex(function(t){return t.func==e});-1!=n&&i.removeAt(n)},t.prototype.emit=function(t,e){var i=this._messageTable.get(t);if(i)for(var n=i.length-1;n>=0;n--)i[n].func.call(i[n].context,e)},t}();t.Emitter=i}(es||(es={})),function(t){!function(t){t[t.top=0]="top",t[t.bottom=1]="bottom",t[t.left=2]="left",t[t.right=3]="right"}(t.Edge||(t.Edge={}))}(es||(es={})),function(t){var e=function(){function t(){}return t.repeat=function(t,e){for(var i=[];e--;)i.push(t);return i},t}();t.Enumerable=e}(es||(es={})),function(t){var e=function(){function t(){}return Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),t.prototype.setEnabled=function(t){this._enabled!=t&&(this._enabled=t,this._enabled?this.onEnabled():this.onDisabled())},t.prototype.onEnabled=function(){},t.prototype.onDisabled=function(){},t.prototype.update=function(){},t}();t.GlobalManager=e}(es||(es={})),function(t){var e=function(){function e(){this.x=0,this.y=0,this.touchPoint=-1,this.touchDown=!1}return Object.defineProperty(e.prototype,"position",{get:function(){return new t.Vector2(this.x,this.y)},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this.x=0,this.y=0,this.touchDown=!1,this.touchPoint=-1},e}();t.TouchState=e;var i=function(){function i(){}return Object.defineProperty(i,"gameTouchs",{get:function(){return this._gameTouchs},enumerable:!0,configurable:!0}),Object.defineProperty(i,"resolutionScale",{get:function(){return this._resolutionScale},enumerable:!0,configurable:!0}),Object.defineProperty(i,"totalTouchCount",{get:function(){return this._totalTouchCount},enumerable:!0,configurable:!0}),Object.defineProperty(i,"touchPosition",{get:function(){return this._gameTouchs[0]?this._gameTouchs[0].position:t.Vector2.zero},enumerable:!0,configurable:!0}),Object.defineProperty(i,"maxSupportedTouch",{get:function(){return t.Core._instance.stage.maxTouches},set:function(e){t.Core._instance.stage.maxTouches=e,this.initTouchCache()},enumerable:!0,configurable:!0}),Object.defineProperty(i,"touchPositionDelta",{get:function(){var e=t.Vector2.subtract(this.touchPosition,this._previousTouchState.position);return e.length()>0&&this.setpreviousTouchState(this._gameTouchs[0]),e},enumerable:!0,configurable:!0}),i.initialize=function(){this._init||(this._init=!0,t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.touchBegin,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.touchMove,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_END,this.touchEnd,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_CANCEL,this.touchEnd,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_RELEASE_OUTSIDE,this.touchEnd,this),this.initTouchCache())},i.scaledPosition=function(e){var i=new t.Vector2(e.x-this._resolutionOffset.x,e.y-this._resolutionOffset.y);return t.Vector2.multiply(i,this.resolutionScale)},i.initTouchCache=function(){this._totalTouchCount=0,this._touchIndex=0,this._gameTouchs.length=0;for(var t=0;t0)for(var e=0;ethis._objectQueue.length;)this._objectQueue.shift()},t.clearCache=function(){this._objectQueue.length=0},t.obtain=function(){return this._objectQueue.length>0?this._objectQueue.shift():[]},t.free=function(t){this._objectQueue.unshift(t),t.length=0},t._objectQueue=[],t}();t.ListPool=e}(es||(es={}));var THREAD_ID=Math.floor(1e3*Math.random())+"-"+Date.now(),nextTick=function(t){setTimeout(t,0)},LockUtils=function(){function t(t){this._keyX="mutex_key_"+t+"_X",this._keyY="mutex_key_"+t+"_Y",this.setItem=egret.localStorage.setItem.bind(localStorage),this.getItem=egret.localStorage.getItem.bind(localStorage),this.removeItem=egret.localStorage.removeItem.bind(localStorage)}return t.prototype.lock=function(){var t=this;return new Promise(function(e,i){var n=function(){t.setItem(t._keyX,THREAD_ID),null===!t.getItem(t._keyY)&&nextTick(n),t.setItem(t._keyY,THREAD_ID),t.getItem(t._keyX)!==THREAD_ID?setTimeout(function(){t.getItem(t._keyY)===THREAD_ID?(e(),t.removeItem(t._keyY)):nextTick(n)},10):(e(),t.removeItem(t._keyY))};n()})},t}();!function(t){var e=function(){function t(t,e){this.first=t,this.second=e}return t.prototype.clear=function(){this.first=this.second=null},t.prototype.equals=function(t){return this.first==t.first&&this.second==t.second},t}();t.Pair=e}(es||(es={}));var RandomUtils=function(){function t(){}return t.randrange=function(t,e,i){if(void 0===i&&(i=1),0==i)throw new Error("step 不能为 0");var n=e-t;if(0==n)throw new Error("没有可用的范围("+t+","+e+")");n<0&&(n=t-e);var r=Math.floor((n+i-1)/i);return Math.floor(this.random()*r)*i+Math.min(t,e)},t.randint=function(t,e){return(t=Math.floor(t))>(e=Math.floor(e))?t++:e++,this.randrange(t,e)},t.randnum=function(t,e){return this.random()*(e-t)+t},t.shuffle=function(t){return t.sort(this._randomCompare),t},t.choice=function(t){if(!t.hasOwnProperty("length"))throw new Error("无法对此对象执行此操作");var e=Math.floor(this.random()*t.length);return t instanceof String?String(t).charAt(e):t[e]},t.sample=function(t,e){var i=t.length;if(e<=0||i=0;)s=Math.floor(this.random()*i);n.push(t[s]),r.push(s)}return n},t.random=function(){return Math.random()},t.boolean=function(t){return void 0===t&&(t=.5),this.random().5?1:-1},t}();!function(t){var e=function(){function e(){}return e.getSide=function(e,i){switch(i){case t.Edge.top:return e.top;case t.Edge.bottom:return e.bottom;case t.Edge.left:return e.left;case t.Edge.right:return e.right}},e.union=function(e,i){var n=new t.Rectangle(i.x,i.y,0,0),r=new t.Rectangle;return r.x=Math.min(e.x,n.x),r.y=Math.min(e.y,n.y),r.width=Math.max(e.right,n.right)-r.x,r.height=Math.max(e.bottom,r.bottom)-r.y,r},e.getHalfRect=function(e,i){switch(i){case t.Edge.top:return new t.Rectangle(e.x,e.y,e.width,e.height/2);case t.Edge.bottom:return new t.Rectangle(e.x,e.y+e.height/2,e.width,e.height/2);case t.Edge.left:return new t.Rectangle(e.x,e.y,e.width/2,e.height);case t.Edge.right:return new t.Rectangle(e.x+e.width/2,e.y,e.width/2,e.height)}},e.getRectEdgePortion=function(e,i,n){switch(void 0===n&&(n=1),i){case t.Edge.top:return new t.Rectangle(e.x,e.y,e.width,n);case t.Edge.bottom:return new t.Rectangle(e.x,e.y+e.height-n,e.width,n);case t.Edge.left:return new t.Rectangle(e.x,e.y,n,e.height);case t.Edge.right:return new t.Rectangle(e.x+e.width-n,e.y,n,e.height)}},e.expandSide=function(e,i,n){switch(n=Math.abs(n),i){case t.Edge.top:e.y-=n,e.height+=n;break;case t.Edge.bottom:e.height+=n;break;case t.Edge.left:e.x-=n,e.width+=n;break;case t.Edge.right:e.width+=n}},e.contract=function(t,e,i){t.x+=e,t.y+=i,t.width-=2*e,t.height-=2*i},e}();t.RectangleExt=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.update=function(t){this.remainder+=t;var e=Math.trunc(this.remainder);return this.remainder-=e,e},t.prototype.reset=function(){this.remainder=0},t}();t.SubpixelNumber=e}(es||(es={})),function(t){var e=function(){function e(){this.triangleIndices=[],this._triPrev=new Array(12),this._triNext=new Array(12)}return e.testPointTriangle=function(e,i,n,r){return!(t.Vector2Ext.cross(t.Vector2.subtract(e,i),t.Vector2.subtract(n,i))<0)&&(!(t.Vector2Ext.cross(t.Vector2.subtract(e,n),t.Vector2.subtract(r,n))<0)&&!(t.Vector2Ext.cross(t.Vector2.subtract(e,r),t.Vector2.subtract(i,r))<0))},e.prototype.triangulate=function(i,n){void 0===n&&(n=!0);var r=i.length;this.initialize(r);for(var o=0,s=0;r>3&&o<500;){o++;var a=!0,h=i[this._triPrev[s]],c=i[s],u=i[this._triNext[s]];if(t.Vector2Ext.isTriangleCCW(h,c,u)){var l=this._triNext[this._triNext[s]];do{if(e.testPointTriangle(i[l],h,c,u)){a=!1;break}l=this._triNext[l]}while(l!=this._triPrev[s])}else a=!1;a?(this.triangleIndices.push(this._triPrev[s]),this.triangleIndices.push(s),this.triangleIndices.push(this._triNext[s]),this._triNext[this._triPrev[s]]=this._triNext[s],this._triPrev[this._triNext[s]]=this._triPrev[s],r--,s=this._triPrev[s]):s=this._triNext[s]}this.triangleIndices.push(this._triPrev[s]),this.triangleIndices.push(s),this.triangleIndices.push(this._triNext[s]),n||this.triangleIndices.reverse()},e.prototype.initialize=function(t){this.triangleIndices.length=0,this._triNext.lengtht.MathHelper.Epsilon?e=t.Vector2.divide(e,new t.Vector2(i)):e.x=e.y=0,e},e.transformA=function(t,e,i,n,r,o){for(var s=0;sthis.safeArea.right&&(s.x=this.safeArea.right-s.width),s.topthis.safeArea.bottom&&(s.y=this.safeArea.bottom-s.height),s},i}();t.Layout=i,function(t){t[t.none=0]="none",t[t.left=1]="left",t[t.right=2]="right",t[t.horizontalCenter=4]="horizontalCenter",t[t.top=8]="top",t[t.bottom=16]="bottom",t[t.verticalCenter=32]="verticalCenter",t[t.topLeft=9]="topLeft",t[t.topRight=10]="topRight",t[t.topCenter=12]="topCenter",t[t.bottomLeft=17]="bottomLeft",t[t.bottomRight=18]="bottomRight",t[t.bottomCenter=20]="bottomCenter",t[t.centerLeft=33]="centerLeft",t[t.centerRight=34]="centerRight",t[t.center=36]="center"}(e=t.Alignment||(t.Alignment={}))}(es||(es={})),function(t){var e,i=function(){function t(t){void 0===t&&(t=n),this.getSystemTime=t,this._stopDuration=0,this._completeSlices=[]}return t.prototype.getState=function(){return void 0===this._startSystemTime?e.IDLE:void 0===this._stopSystemTime?e.RUNNING:e.STOPPED},t.prototype.isIdle=function(){return this.getState()===e.IDLE},t.prototype.isRunning=function(){return this.getState()===e.RUNNING},t.prototype.isStopped=function(){return this.getState()===e.STOPPED},t.prototype.slice=function(){return this.recordPendingSlice()},t.prototype.getCompletedSlices=function(){return Array.from(this._completeSlices)},t.prototype.getCompletedAndPendingSlices=function(){return this._completeSlices.concat([this.getPendingSlice()])},t.prototype.getPendingSlice=function(){return this.calculatePendingSlice()},t.prototype.getTime=function(){return this.caculateStopwatchTime()},t.prototype.reset=function(){this._startSystemTime=this._pendingSliceStartStopwatchTime=this._stopSystemTime=void 0,this._stopDuration=0,this._completeSlices=[]},t.prototype.start=function(t){if(void 0===t&&(t=!1),t&&this.reset(),void 0!==this._stopSystemTime){var e=(i=this.getSystemTime())-this._stopSystemTime;this._stopDuration+=e,this._stopSystemTime=void 0}else if(void 0===this._startSystemTime){var i=this.getSystemTime();this._startSystemTime=i,this._pendingSliceStartStopwatchTime=0}},t.prototype.stop=function(t){if(void 0===t&&(t=!1),void 0===this._startSystemTime)return 0;var e=this.getSystemTimeOfCurrentStopwatchTime();return t&&this.recordPendingSlice(this.caculateStopwatchTime(e)),this._stopSystemTime=e,this.getTime()},t.prototype.calculatePendingSlice=function(t){return void 0===this._pendingSliceStartStopwatchTime?Object.freeze({startTime:0,endTime:0,duration:0}):(void 0===t&&(t=this.getTime()),Object.freeze({startTime:this._pendingSliceStartStopwatchTime,endTime:t,duration:t-this._pendingSliceStartStopwatchTime}))},t.prototype.caculateStopwatchTime=function(t){return void 0===this._startSystemTime?0:(void 0===t&&(t=this.getSystemTimeOfCurrentStopwatchTime()),t-this._startSystemTime-this._stopDuration)},t.prototype.getSystemTimeOfCurrentStopwatchTime=function(){return void 0===this._stopSystemTime?this.getSystemTime():this._stopSystemTime},t.prototype.recordPendingSlice=function(t){if(void 0!==this._pendingSliceStartStopwatchTime){void 0===t&&(t=this.getTime());var e=this.calculatePendingSlice(t);return this._pendingSliceStartStopwatchTime=e.endTime,this._completeSlices.push(e),e}return this.calculatePendingSlice()},t}();t.Stopwatch=i,function(t){t.IDLE="IDLE",t.RUNNING="RUNNING",t.STOPPED="STOPPED"}(e||(e={})),t.setDefaultSystemTimeGetter=function(t){void 0===t&&(t=Date.now),n=t};var n=Date.now}(stopwatch||(stopwatch={})),function(t){var e=function(){function e(){this.showLog=!1,this._frameKey="frame",this._logKey="log",this.markers=[],this.stopwacth=new stopwatch.Stopwatch,this._markerNameToIdMap=new Map,this._logs=new Array(2);for(var e=0;e=e.logSnapDuration&&(l.logs[r].snapMin=l.logs[r].min,l.logs[r].snapMax=l.logs[r].max,l.logs[r].snapAvg=l.logs[r].avg,l.logs[r].samples=0)):(l.logs[r].min=c,l.logs[r].max=c,l.logs[r].avg=c,l.logs[r].initialized=!0)}s.markCount=o.nestCount,s.nestCount=o.nestCount}t.stopwacth.reset(),t.stopwacth.start()}})},e.prototype.beginMark=function(t,i,n){var r=this;void 0===n&&(n=0),new LockUtils(this._frameKey).lock().then(function(){if(n<0||n>=e.maxBars)throw new Error("barIndex argument out of range");var o=r._curLog.bars[n];if(o.markCount>=e.maxSamples)throw new Error("exceeded sample count. either set larger number to timeruler.maxsaple or lower sample count");if(o.nestCount>=e.maxNestCall)throw new Error("exceeded nest count. either set larger number to timeruler.maxnestcall or lower nest calls");var s=r._markerNameToIdMap.get(t);isNaN(s)&&(s=r.markers.length,r._markerNameToIdMap.set(t,s)),o.markerNests[o.nestCount++]=o.markCount,o.markers[o.markCount].markerId=s,o.markers[o.markCount].color=i,o.markers[o.markCount].beginTime=r.stopwacth.getTime(),o.markers[o.markCount].endTime=-1})},e.prototype.endMark=function(t,i){var n=this;void 0===i&&(i=0),new LockUtils(this._frameKey).lock().then(function(){if(i<0||i>=e.maxBars)throw new Error("barIndex argument out of range");var r=n._curLog.bars[i];if(r.nestCount<=0)throw new Error("call beginMark method before calling endMark method");var o=n._markerNameToIdMap.get(t);if(isNaN(o))throw new Error("Marker "+t+" is not registered. Make sure you specifed same name as you used for beginMark method");var s=r.markerNests[--r.nestCount];if(r.markers[s].markerId!=o)throw new Error("Incorrect call order of beginMark/endMark method. beginMark(A), beginMark(B), endMark(B), endMark(A) But you can't called it like beginMark(A), beginMark(B), endMark(A), endMark(B).");r.markers[s].endTime=n.stopwacth.getTime()})},e.prototype.getAverageTime=function(t,i){if(t<0||t>=e.maxBars)throw new Error("barIndex argument out of range");var n=0,r=this._markerNameToIdMap.get(i);return r&&(n=this.markers[r].logs[t].avg),n},e.prototype.resetLog=function(){var t=this;new LockUtils(this._logKey).lock().then(function(){var e=parseInt(egret.localStorage.getItem(t._logKey),10);e+=1,egret.localStorage.setItem(t._logKey,e.toString()),t.markers.forEach(function(t){for(var e=0;e0&&(n+=e.barHeight+2*e.barPadding,r=Math.max(r,t.markers[t.markCount-1].endTime))});var o=this.sampleFrames*(1/60*1e3);this._frameAdjust=r>o?Math.max(0,this._frameAdjust)+1:Math.min(0,this._frameAdjust)-1,Math.max(this._frameAdjust)>e.autoAdjustDelay&&(this.sampleFrames=Math.min(e.maxSampleFrames,this.sampleFrames),this.sampleFrames=Math.max(this.targetSampleFrames,r/(1/60*1e3)+1),this._frameAdjust=0);t.y,e.barHeight}},e.prototype.onGraphicsDeviceReset=function(){var i=new t.Layout;this._position=i.place(new t.Vector2(this.width,e.barHeight),0,.01,t.Alignment.bottomCenter).location},e.maxBars=8,e.maxSamples=256,e.maxNestCall=32,e.barHeight=8,e.maxSampleFrames=4,e.logSnapDuration=120,e.barPadding=2,e.autoAdjustDelay=30,e}();t.TimeRuler=e;var i=function(){return function(){this.bars=new Array(e.maxBars),this.bars.fill(new n,0,e.maxBars)}}();t.FrameLog=i;var n=function(){return function(){this.markers=new Array(e.maxSamples),this.markCount=0,this.markerNests=new Array(e.maxNestCall),this.nestCount=0,this.markers.fill(new r,0,e.maxSamples),this.markerNests.fill(0,0,e.maxNestCall)}}();t.MarkerCollection=n;var r=function(){return function(){this.markerId=0,this.beginTime=0,this.endTime=0,this.color=0}}();t.Marker=r;var o=function(){return function(t){this.logs=new Array(e.maxBars),this.name=t,this.logs.fill(new s,0,e.maxBars)}}();t.MarkerInfo=o;var s=function(){return function(){this.snapMin=0,this.snapMax=0,this.snapAvg=0,this.min=0,this.max=0,this.avg=0,this.samples=0,this.color=0,this.initialized=!1}}();t.MarkerLog=s}(es||(es={})),function(t){var e=egret.Bitmap,i=function(){function i(){this.itemsToRaster=[],this.useCache=!1,this.cacheName="",this._sprites=new Map,this.allow4096Textures=!1}return i.prototype.addTextureToPack=function(e,i){this.itemsToRaster.push(new t.TextureToPack(e,i))},i.prototype.process=function(t){return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.allow4096Textures=t,this.useCache?""==this.cacheName?(console.error("未指定缓存名称"),[2]):[4,RES.getResByUrl(this.cacheName)]:[3,2];case 1:return e.sent()?this.loadPack():this.createPack(),[3,3];case 2:this.createPack(),e.label=3;case 3:return[2]}})})},i.prototype.loadPack=function(){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,RES.getResByUrl(this.cacheName)];case 1:return t=e.sent(),this.onProcessCompleted&&this.onProcessCompleted(),[2,t]}})})},i.prototype.createPack=function(){for(var i=[],n=[],r=0,o=this.itemsToRaster;ra||i[c].height>a)throw new Error("一个纹理的大小比图集的大小大");h.push(new t.Rectangle(0,0,i[c].width,i[c].height))}for(;h.length>0;){var u=new egret.RenderTexture,l=new t.RectanglePacker(a,a,1);for(c=0;c0){for(var p=new t.IntegerRectangle,d=[],f=[],g=[],m=[],y=0;y0;)this.freeRectangle(this._insertedRectangles.pop());for(;this._freeAreas.length>0;)this.freeRectangle(this._freeAreas.pop());for(this._width=t,this._height=e,this._packedWidth=0,this._packedHeight=0,this._freeAreas.push(this.allocateRectangle(0,0,this._width,this._height));this._insertedRectangles.length>0;)this.freeSize(this._insertList.pop());this._padding=i},e.prototype.insertRectangle=function(t,e,i){var n=this.allocateSize(t,e,i);this._insertList.push(n)},e.prototype.packRectangles=function(t){for(void 0===t&&(t=!0),t&&this._insertList.sort(function(t,e){return t.width-e.width});this._insertList.length>0;){var e=this._insertList.pop(),i=e.width,n=e.height,r=this.getFreeAreaIndex(i,n);if(r>=0){var o=this._freeAreas[r],s=this.allocateRectangle(o.x,o.y,i,n);for(s.id=e.id,this.generateNewFreeAreas(s,this._freeAreas,this._newFreeAreas);this._newFreeAreas.length>0;)this._freeAreas.push(this._newFreeAreas.pop());this._insertedRectangles.push(s),s.right>this._packedWidth&&(this._packedWidth=s.right),s.bottom>this._packedHeight&&(this._packedHeight=s.bottom)}this.freeSize(e)}return this.rectangleCount},e.prototype.getRectangle=function(t,e){var i=this._insertedRectangles[t];return e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height,e},e.prototype.getRectangleId=function(t){return this._insertedRectangles[t].id},e.prototype.generateNewFreeAreas=function(t,e,i){var n=t.x,r=t.y,o=t.right+1+this._padding,s=t.bottom+1+this._padding,a=null;0==this._padding&&(a=t);for(var h=e.length-1;h>=0;h--){var c=e[h];if(!(n>=c.right||o<=c.x||r>=c.bottom||s<=c.y)){null==a&&(a=this.allocateRectangle(t.x,t.y,t.width+this._padding,t.height+this._padding)),this.generateDividedAreas(a,c,i);var u=e.pop();h=0;e--)for(var i=t[e],n=t.length-1;n>=0;n--)if(e!=n){var r=t[n];if(i.x>=r.x&&i.y>=r.y&&i.right<=r.right&&i.bottom<=r.bottom){this.freeRectangle(i);var o=t.pop();e0&&(i.push(this.allocateRectangle(t.right,e.y,r,e.height)),n++);var o=t.x-e.x;o>0&&(i.push(this.allocateRectangle(e.x,e.y,o,e.height)),n++);var s=e.bottom-t.bottom;s>0&&(i.push(this.allocateRectangle(e.x,t.bottom,e.width,s)),n++);var a=t.y-e.y;a>0&&(i.push(this.allocateRectangle(e.x,e.y,e.width,a)),n++),0==n&&(t.width=0;s--){var a=this._freeAreas[s];if(a.x0){var r=this._sortableSizeStack.pop();return r.width=e,r.height=i,r.id=n,r}return new t.SortableSize(e,i,n)},e.prototype.freeSize=function(t){this._sortableSizeStack.push(t)},e.prototype.allocateRectangle=function(e,i,n,r){if(this._rectangleStack.length>0){var o=this._rectangleStack.pop();return o.x=e,o.y=i,o.width=n,o.height=r,o.right=e+n,o.bottom=i+r,o}return new t.IntegerRectangle(e,i,n,r)},e.prototype.freeRectangle=function(t){this._rectangleStack.push(t)},e}();t.RectanglePacker=e}(es||(es={})),function(t){var e=function(){return function(t,e,i){this.width=t,this.height=e,this.id=i}}();t.SortableSize=e}(es||(es={})),function(t){var e=function(){return function(t){this.assets=t}}();t.TextureAssets=e;var i=function(){return function(){}}();t.TextureAsset=i}(es||(es={})),function(t){var e=function(){return function(t,e){this.texture=t,this.id=e}}();t.TextureToPack=e}(es||(es={})); \ No newline at end of file +window.es={},window.__extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var transform,__awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(r,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(s,a)}h((n=n.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]-1}(this,t)},Array.prototype.firstOrDefault=function(t){return function(t,e){var i=t.findIndex(e);return-1==i?null:t[i]}(this,t)},Array.prototype.find=function(t){return function(t,e){return t.firstOrDefault(e)}(this,t)},Array.prototype.where=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(i,n,r){return e.call(arguments[2],n,r,t)&&i.push(n),i},[]);for(var i=[],n=0,r=t.length;n=0&&t.splice(i,1)}while(i>=0)}(this,t)},Array.prototype.remove=function(t){return function(t,e){var i=t.findIndex(function(t){return t===e});return i>=0&&(t.splice(i,1),!0)}(this,t)},Array.prototype.removeAt=function(t){return function(t,e){t.splice(e,1)}(this,t)},Array.prototype.removeRange=function(t,e){return function(t,e,i){t.splice(e,i)}(this,t,e)},Array.prototype.select=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(i,n,r){return i.push(e.call(arguments[2],n,r,t)),i},[]);for(var i=[],n=0,r=t.length;no?1:-1}),t}(this,t,e)},Array.prototype.orderByDescending=function(t,e){return function(t,e,i){return t.sort(function(t,n){var r=e(t),o=e(n);return i?-i(r,o):r0;){if("break"===u())break}return s?this.recontructPath(a,n,r):null},e.recontructPath=function(t,e,i){var n=[],r=i;for(n.push(i);r!=e;)r=this.getKey(t,r),n.push(r);return n.reverse(),n},e.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},e.getKey=function(t,e){for(var i,n,r=t.keys(),o=t.values();i=r.next(),n=o.next(),!i.done;)if(JSON.stringify(i.value)==JSON.stringify(e))return n.value;return null},e}();t.AStarPathfinder=e;var i=function(t){function e(e){var i=t.call(this)||this;return i.data=e,i}return __extends(e,t),e}(t.PriorityQueueNode);t.AStarNode=i}(es||(es={})),function(t){var e=function(){function e(e,i){this.dirs=[new t.Vector2(1,0),new t.Vector2(0,-1),new t.Vector2(-1,0),new t.Vector2(0,1)],this.walls=[],this.weightedNodes=[],this.defaultWeight=1,this.weightedNodeWeight=5,this._neighbors=new Array(4),this._width=e,this._height=i}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x=this._nodes.length?(console.error("node.QueueIndex has been corrupted. Did you change it manually? Or add this node to another queue?"),!1):this._nodes[t.queueIndex]==t:(console.error("node cannot be null"),!1)},t.prototype.enqueue=function(t,e){t.priority=e,this._numNodes++,this._nodes[this._numNodes]=t,t.queueIndex=this._numNodes,t.insertionIndex=this._numNodesEverEnqueued++,this.cascadeUp(this._nodes[this._numNodes])},t.prototype.dequeue=function(){var t=this._nodes[1];return this.remove(t),t},t.prototype.remove=function(t){if(t.queueIndex==this._numNodes)return this._nodes[this._numNodes]=null,void this._numNodes--;var e=this._nodes[this._numNodes];this.swap(t,e),delete this._nodes[this._numNodes],this._numNodes--,this.onNodeUpdated(e)},t.prototype.isValidQueue=function(){for(var t=1;t0&&this.hasHigherPriority(t,i)?this.cascadeUp(t):this.cascadeDown(t)},t.prototype.cascadeDown=function(t){for(var e,i=t.queueIndex;;){e=t;var n=2*i;if(n>this._numNodes){t.queueIndex=i,this._nodes[i]=t;break}var r=this._nodes[n];this.hasHigherPriority(r,e)&&(e=r);var o=n+1;if(o<=this._numNodes){var s=this._nodes[o];this.hasHigherPriority(s,e)&&(e=s)}if(e==t){t.queueIndex=i,this._nodes[i]=t;break}this._nodes[i]=e;var a=e.queueIndex;e.queueIndex=i,i=a}},t.prototype.cascadeUp=function(t){for(var e=Math.floor(t.queueIndex/2);e>=1;){var i=this._nodes[e];if(this.hasHigherPriority(i,t))break;this.swap(t,i),e=Math.floor(t.queueIndex/2)}},t.prototype.swap=function(t,e){this._nodes[t.queueIndex]=e,this._nodes[e.queueIndex]=t;var i=t.queueIndex;t.queueIndex=e.queueIndex,e.queueIndex=i},t.prototype.hasHigherPriority=function(t,e){return t.priority0;){if("break"===h())break}return o?t.AStarPathfinder.recontructPath(a,i,n):null},e.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},e}();t.BreadthFirstPathfinder=e}(es||(es={})),function(t){var e=function(){function t(){this.edges=new Map}return t.prototype.addEdgesForNode=function(t,e){return this.edges.set(t,e),this},t.prototype.getNeighbors=function(t){return this.edges.get(t)},t}();t.UnweightedGraph=e}(es||(es={})),function(t){var e=function(){function e(t,e){this.x=0,this.y=0,this.x=t||0,this.y=null!=e?e:this.x}return Object.defineProperty(e,"zero",{get:function(){return e.zeroVector2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"one",{get:function(){return e.unitVector2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unitX",{get:function(){return e.unitXVector},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unitY",{get:function(){return e.unitYVector},enumerable:!0,configurable:!0}),e.add=function(t,i){var n=new e(0,0);return n.x=t.x+i.x,n.y=t.y+i.y,n},e.divide=function(t,i){var n=new e(0,0);return n.x=t.x/i.x,n.y=t.y/i.y,n},e.multiply=function(t,i){var n=new e(0,0);return n.x=t.x*i.x,n.y=t.y*i.y,n},e.subtract=function(t,i){var n=new e(0,0);return n.x=t.x-i.x,n.y=t.y-i.y,n},e.normalize=function(t){var e=1/Math.sqrt(t.x*t.x+t.y*t.y);return t.x*=e,t.y*=e,t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.distanceSquared=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},e.clamp=function(i,n,r){return new e(t.MathHelper.clamp(i.x,n.x,r.x),t.MathHelper.clamp(i.y,n.y,r.y))},e.lerp=function(i,n,r){return new e(t.MathHelper.lerp(i.x,n.x,r),t.MathHelper.lerp(i.y,n.y,r))},e.transform=function(t,i){return new e(t.x*i.m11+t.y*i.m21+i.m31,t.x*i.m12+t.y*i.m22+i.m32)},e.distance=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},e.angle=function(i,n){return i=e.normalize(i),n=e.normalize(n),Math.acos(t.MathHelper.clamp(e.dot(i,n),-1,1))*t.MathHelper.Rad2Deg},e.negate=function(t){var i=new e;return i.x=-t.x,i.y=-t.y,i},e.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},e.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},e.prototype.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},e.prototype.normalize=function(){var t=1/Math.sqrt(this.x*this.x+this.y*this.y);return this.x*=t,this.y*=t,this},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.prototype.round=function(){return new e(Math.round(this.x),Math.round(this.y))},e.prototype.equals=function(t){return t.x==this.x&&t.y==this.y},e.unitYVector=new e(0,1),e.unitXVector=new e(1,0),e.unitVector2=new e(1,1),e.zeroVector2=new e(0,0),e}();t.Vector2=e}(es||(es={})),function(t){var e=function(){function e(t,i,n){void 0===n&&(n=!1),this.walls=[],this._neighbors=new Array(4),this._width=t,this._hegiht=i,this._dirs=n?e.COMPASS_DIRS:e.CARDINAL_DIRS}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x0;){if("break"===u())break}return s?this.recontructPath(a,n,r):null},i.recontructPath=function(t,e,i){var n=[],r=i;for(n.push(i);r!=e;)r=this.getKey(t,r),n.push(r);return n.reverse(),n},i.hasKey=function(t,e){for(var i,n=t.keys();!(i=n.next()).done;)if(JSON.stringify(i.value)==JSON.stringify(e))return!0;return!1},i.getKey=function(t,e){for(var i,n,r=t.keys(),o=t.values();i=r.next(),n=o.next(),!i.done;)if(JSON.stringify(i.value)==JSON.stringify(e))return n.value;return null},i}();t.WeightedPathfinder=i}(es||(es={})),function(t){var e=function(){function e(){}return e.drawHollowRect=function(e,i,n){void 0===n&&(n=0),this._debugDrawItems.push(new t.DebugDrawItem(e,i,n))},e.render=function(){if(this._debugDrawItems.length>0){var e=new egret.Shape;t.Core.scene&&t.Core.scene.addChild(e);for(var i=this._debugDrawItems.length-1;i>=0;i--){this._debugDrawItems[i].draw(e)&&this._debugDrawItems.removeAt(i)}}},e._debugDrawItems=[],e}();t.Debug=e}(es||(es={})),function(t){var e=function(){function t(){}return t.verletParticle=14431326,t.verletConstraintEdge=4406838,t}();t.DebugDefaults=e}(es||(es={})),function(t){var e;!function(t){t[t.line=0]="line",t[t.hollowRectangle=1]="hollowRectangle",t[t.pixel=2]="pixel",t[t.text=3]="text"}(e=t.DebugDrawType||(t.DebugDrawType={}));var i=function(){function i(t,i,n){this.rectangle=t,this.color=i,this.duration=n,this.drawType=e.hollowRectangle}return i.prototype.draw=function(i){switch(this.drawType){case e.line:case e.hollowRectangle:case e.pixel:case e.text:}return this.duration-=t.Time.deltaTime,this.duration<0},i}();t.DebugDrawItem=i}(es||(es={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.updateInterval=1,e._enabled=!0,e._updateOrder=0,e}return __extends(e,t),Object.defineProperty(e.prototype,"transform",{get:function(){return this.entity.transform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this.entity?this.entity.enabled&&this._enabled:this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateOrder",{get:function(){return this._updateOrder},set:function(t){this.setUpdateOrder(t)},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){},e.prototype.onAddedToEntity=function(){},e.prototype.onRemovedFromEntity=function(){},e.prototype.onEntityTransformChanged=function(t){},e.prototype.debugRender=function(){},e.prototype.onEnabled=function(){},e.prototype.onDisabled=function(){},e.prototype.update=function(){},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled?this.onEnabled():this.onDisabled()),this},e.prototype.setUpdateOrder=function(t){return this._updateOrder!=t&&(this._updateOrder=t),this},e.prototype.clone=function(){var t=ObjectUtils.clone(this);return t.entity=null,t},e}(egret.HashObject);t.Component=e}(es||(es={})),function(t){var e=function(e){function i(){var n=e.call(this)||this;return n._globalManagers=[],i._instance=n,i.emitter=new t.Emitter,i.content=new t.ContentManager,n.addEventListener(egret.Event.ADDED_TO_STAGE,n.onAddToStage,n),n}return __extends(i,e),Object.defineProperty(i,"Instance",{get:function(){return this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(i,"scene",{get:function(){return this._instance?this._instance._scene:null},set:function(t){t?null==this._instance._scene?(this._instance._scene=t,this._instance.addChild(t),this._instance._scene.begin(),i.Instance.onSceneChanged()):this._instance._nextScene=t:console.error("场景不能为空")},enumerable:!0,configurable:!0}),i.startSceneTransition=function(t){if(!this._instance._sceneTransition)return this._instance._sceneTransition=t,t;console.warn("在前一个场景完成之前,不能开始一个新的场景转换。")},i.registerGlobalManager=function(t){this._instance._globalManagers.push(t),t.enabled=!0},i.unregisterGlobalManager=function(t){this._instance._globalManagers.remove(t),t.enabled=!1},i.getGlobalManager=function(t){for(var e=0;e=0;e--)this._globalManagers[e].enabled&&this._globalManagers[e].update();return this._sceneTransition&&(!this._sceneTransition||this._sceneTransition.loadsNewScene&&!this._sceneTransition.isNewSceneLoaded)||this._scene.update(),this._nextScene?(this._scene.parent&&this._scene.parent.removeChild(this._scene),this._scene.end(),this._scene=this._nextScene,this._nextScene=null,this.onSceneChanged(),this.addChild(this._scene),[4,this._scene.begin()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[4,this.draw()];case 3:return i.sent(),[2]}})})},i.prototype.onAddToStage=function(){i.graphicsDevice=new t.GraphicsDevice,this.addEventListener(egret.Event.RESIZE,this.onGraphicsDeviceReset,this),this.addEventListener(egret.StageOrientationEvent.ORIENTATION_CHANGE,this.onOrientationChanged,this),this.addEventListener(egret.Event.ENTER_FRAME,this.update,this),t.Input.initialize(),KeyboardUtils.init(),this.initialize()},i.debugRenderEndabled=!1,i}(egret.DisplayObjectContainer);t.Core=e}(es||(es={})),function(t){!function(t){t[t.GraphicsDeviceReset=0]="GraphicsDeviceReset",t[t.SceneChanged=1]="SceneChanged",t[t.OrientationChanged=2]="OrientationChanged"}(t.CoreEvents||(t.CoreEvents={}))}(es||(es={})),function(t){var e=function(){function e(i){this.updateInterval=1,this._tag=0,this._enabled=!0,this._updateOrder=0,this.components=new t.ComponentList(this),this.transform=new t.Transform(this),this.name=i,this.id=e._idGenerator++,this.componentBits=new t.BitSet}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this._isDestroyed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tag",{get:function(){return this._tag},set:function(t){this.setTag(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateOrder",{get:function(){return this._updateOrder},set:function(t){this.setUpdateOrder(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.transform.parent},set:function(t){this.transform.setParent(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childCount",{get:function(){return this.transform.childCount},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.setPosition(t.x,t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localPosition",{get:function(){return this.transform.localPosition},set:function(t){this.transform.setLocalPosition(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.setRotation(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationDegrees",{get:function(){return this.transform.rotationDegrees},set:function(t){this.transform.setRotationDegrees(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localRotation",{get:function(){return this.transform.localRotation},set:function(t){this.transform.setLocalRotation(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localRotationDegrees",{get:function(){return this.transform.localRotationDegrees},set:function(t){this.transform.setLocalRotationDegrees(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.setScale(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localScale",{get:function(){return this.transform.localScale},set:function(t){this.transform.setLocalScale(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"worldInverseTransform",{get:function(){return this.transform.worldInverseTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localToWorldTransform",{get:function(){return this.transform.localToWorldTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"worldToLocalTransform",{get:function(){return this.transform.worldToLocalTransform},enumerable:!0,configurable:!0}),e.prototype.onTransformChanged=function(t){this.components.onEntityTransformChanged(t)},e.prototype.setTag=function(t){return this._tag!=t&&(this.scene&&this.scene.entities.removeFromTagList(this),this._tag=t,this.scene&&this.scene.entities.addToTagList(this)),this},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled?this.components.onEntityEnabled():this.components.onEntityDisabled()),this},e.prototype.setUpdateOrder=function(t){if(this._updateOrder!=t)return this._updateOrder=t,this.scene&&(this.scene.entities.markEntityListUnsorted(),this.scene.entities.markTagUnsorted(this.tag)),this},e.prototype.destroy=function(){this._isDestroyed=!0,this.scene.entities.remove(this),this.transform.parent=null;for(var t=this.transform.childCount-1;t>=0;t--){this.transform.getChild(t).entity.destroy()}},e.prototype.detachFromScene=function(){this.scene.entities.remove(this),this.components.deregisterAllComponents();for(var t=0;t=0;t--)this._sceneComponents[t].enabled&&this._sceneComponents[t].update();this.entityProcessors&&this.entityProcessors.update(),this.entities.update(),this.entityProcessors&&this.entityProcessors.lateUpdate(),this.renderableComponents.updateList()},i.prototype.render=function(){if(0!=this._renderers.length)for(var t=0;te.x?-1:1,n=t.Vector2.normalize(t.Vector2.subtract(this.position,e));this.rotation=i*Math.acos(t.Vector2.dot(n,t.Vector2.unitY))},n.prototype.setLocalRotation=function(t){return this._localRotation=t,this._localDirty=this._positionDirty=this._localPositionDirty=this._localRotationDirty=this._localScaleDirty=!0,this.setDirty(e.rotationDirty),this},n.prototype.setLocalRotationDegrees=function(e){return this.setLocalRotation(t.MathHelper.toRadians(e))},n.prototype.setScale=function(e){return this._scale=e,this.parent?this.localScale=t.Vector2.divide(e,this.parent._scale):this.localScale=e,this},n.prototype.setLocalScale=function(t){return this._localScale=t,this._localDirty=this._positionDirty=this._localScaleDirty=!0,this.setDirty(e.scaleDirty),this},n.prototype.roundPosition=function(){this.position=this._position.round()},n.prototype.updateTransform=function(){this.hierarchyDirty!=e.clean&&(this.parent&&this.parent.updateTransform(),this._localDirty&&(this._localPositionDirty&&(this._translationMatrix=t.Matrix2D.create().translate(this._localPosition.x,this._localPosition.y),this._localPositionDirty=!1),this._localRotationDirty&&(this._rotationMatrix=t.Matrix2D.create().rotate(this._localRotation),this._localRotationDirty=!1),this._localScaleDirty&&(this._scaleMatrix=t.Matrix2D.create().scale(this._localScale.x,this._localScale.y),this._localScaleDirty=!1),this._localTransform=this._scaleMatrix.multiply(this._rotationMatrix),this._localTransform=this._localTransform.multiply(this._translationMatrix),this.parent||(this._worldTransform=this._localTransform,this._rotation=this._localRotation,this._scale=this._localScale,this._worldInverseDirty=!0),this._localDirty=!1),this.parent&&(this._worldTransform=this._localTransform.multiply(this.parent._worldTransform),this._rotation=this._localRotation+this.parent._rotation,this._scale=t.Vector2.multiply(this.parent._scale,this._localScale),this._worldInverseDirty=!0),this._worldToLocalDirty=!0,this._positionDirty=!0,this.hierarchyDirty=e.clean)},n.prototype.setDirty=function(e){if(0==(this.hierarchyDirty&e)){switch(this.hierarchyDirty|=e,e){case t.DirtyType.positionDirty:this.entity.onTransformChanged(transform.Component.position);break;case t.DirtyType.rotationDirty:this.entity.onTransformChanged(transform.Component.rotation);break;case t.DirtyType.scaleDirty:this.entity.onTransformChanged(transform.Component.scale)}this._children||(this._children=[]);for(var i=0;it&&(this._zoom=t),this._maximumZoom=t,this;console.error("maximumZoom must be greater than zero")},r.prototype.onEntityTransformChanged=function(t){this._areMatrixedDirty=!0},r.prototype.zoomIn=function(t){this.zoom+=t},r.prototype.zoomOut=function(t){this.zoom-=t},r.prototype.worldToScreenPoint=function(e){return this.updateMatrixes(),e=t.Vector2.transform(e,this._transformMatrix)},r.prototype.screenToWorldPoint=function(e){return this.updateMatrixes(),e=t.Vector2.transform(e,this._inverseTransformMatrix)},r.prototype.mouseToWorldPoint=function(){return this.screenToWorldPoint(t.Input.touchPosition)},r.prototype.onAddedToEntity=function(){this.follow(this._targetEntity,this._cameraStyle)},r.prototype.update=function(){var e=t.Vector2.multiply(new t.Vector2(this.bounds.width,this.bounds.height),new t.Vector2(.5));this._worldSpaceDeadZone.x=this.position.x-e.x*t.Core.scene.scaleX+this.deadzone.x+this.focusOffset.x,this._worldSpaceDeadZone.y=this.position.y-e.y*t.Core.scene.scaleY+this.deadzone.y+this.focusOffset.y,this._worldSpaceDeadZone.width=this.deadzone.width,this._worldSpaceDeadZone.height=this.deadzone.height,this._targetEntity&&this.updateFollow(),this.position=t.Vector2.lerp(this.position,t.Vector2.add(this.position,this._desiredPositionDelta),this.followLerp),this.entity.transform.roundPosition(),this.mapLockEnabled&&(this.position=this.clampToMapSize(this.position),this.entity.transform.roundPosition())},r.prototype.clampToMapSize=function(e){var i=t.Vector2.multiply(new t.Vector2(this.bounds.width,this.bounds.height),new t.Vector2(.5)).add(new t.Vector2(this.mapSize.x,this.mapSize.y)),n=new t.Vector2(this.mapSize.width-i.x,this.mapSize.height-i.y);return t.Vector2.clamp(e,i,n)},r.prototype.updateFollow=function(){if(this._desiredPositionDelta.x=this._desiredPositionDelta.y=0,this._cameraStyle==e.lockOn){var i=this._targetEntity.transform.position.x,n=this._targetEntity.transform.position.y;this._worldSpaceDeadZone.x>i?this._desiredPositionDelta.x=i-this._worldSpaceDeadZone.x:this._worldSpaceDeadZone.xn&&(this._desiredPositionDelta.y=n-this._worldSpaceDeadZone.y)}else{if(!this._targetCollider&&(this._targetCollider=this._targetEntity.getComponent(t.Collider),!this._targetCollider))return;var r=this._targetEntity.getComponent(t.Collider).bounds;this._worldSpaceDeadZone.containsRect(r)||(this._worldSpaceDeadZone.left>r.left?this._desiredPositionDelta.x=r.left-this._worldSpaceDeadZone.left:this._worldSpaceDeadZone.rightr.top&&(this._desiredPositionDelta.y=r.top-this._worldSpaceDeadZone.top))}},r.prototype.follow=function(i,n){switch(void 0===n&&(n=e.cameraWindow),this._targetEntity=i,this._cameraStyle=n,this._cameraStyle){case e.cameraWindow:var r=this.bounds.width/6,o=this.bounds.height/3;this.deadzone=new t.Rectangle((this.bounds.width-r)/2,(this.bounds.height-o)/2,r,o);break;case e.lockOn:this.deadzone=new t.Rectangle(this.bounds.width/2,this.bounds.height/2,10,10)}},r.prototype.setCenteredDeadzone=function(e,i){this.deadzone=new t.Rectangle((this.bounds.width-e)/2,(this.bounds.height-i)/2,e,i)},r.prototype.updateMatrixes=function(){var e;this._areMatrixedDirty&&(this._transformMatrix=t.Matrix2D.create().translate(-this.entity.transform.position.x,-this.entity.transform.position.y),1!=this._zoom&&(e=t.Matrix2D.create().scale(this._zoom,this._zoom),this._transformMatrix=this._transformMatrix.multiply(e)),0!=this.entity.transform.rotation&&(e=t.Matrix2D.create().rotate(this.entity.transform.rotation),this._transformMatrix=this._transformMatrix.multiply(e)),e=t.Matrix2D.create().translate(this._origin.x,this._origin.y),this._transformMatrix=this._transformMatrix.multiply(e),this._inverseTransformMatrix=this._transformMatrix.invert(),this._areBoundsDirty=!0,this._areMatrixedDirty=!1)},r}(t.Component);t.Camera=n}(es||(es={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._shakeDirection=t.Vector2.zero,i._shakeOffset=t.Vector2.zero,i._shakeIntensity=0,i._shakeDegredation=.95,i}return __extends(i,e),i.prototype.shake=function(e,i,n){void 0===e&&(e=15),void 0===i&&(i=.9),void 0===n&&(n=t.Vector2.zero),this.enabled=!0,this._shakeIntensity=1)&&(i=.95),this._shakeDegredation=i)},i.prototype.update=function(){Math.abs(this._shakeIntensity)>0&&(this._shakeOffset=this._shakeDirection,0!=this._shakeOffset.x||0!=this._shakeOffset.y?this._shakeOffset.normalize():(this._shakeOffset.x=this._shakeOffset.x+Math.random()-.5,this._shakeOffset.y=this._shakeOffset.y+Math.random()-.5),this._shakeOffset.multiply(new t.Vector2(this._shakeIntensity)),this._shakeIntensity*=-this._shakeDegredation,Math.abs(this._shakeIntensity)<=.01&&(this._shakeIntensity=0,this.enabled=!1)),this.entity.scene.camera.position.add(this._shakeOffset)},i}(t.Component);t.CameraShake=e}(es||(es={})),function(t){var e=function(){function t(t){this._type=t,this._cache=[]}return t.prototype.obtain=function(){try{return this._cache.length>0?this._cache.shift():new this._type}catch(t){throw new Error(this._type+t)}},t.prototype.free=function(t){t.reset(),this._cache.push(t)},t}();t.ComponentPool=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.compare=function(t,e){return t.updateOrder-e.updateOrder},t}();t.IUpdatableComparer=e}(es||(es={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(t.Component);t.PooledComponent=e}(es||(es={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.displayObject=new egret.DisplayObject,i.color=0,i._areBoundsDirty=!0,i._localOffset=t.Vector2.zero,i._renderLayer=0,i._bounds=new t.Rectangle,i}return __extends(i,e),Object.defineProperty(i.prototype,"width",{get:function(){return this.bounds.width},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.bounds.height},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"localOffset",{get:function(){return this._localOffset},set:function(t){this.setLocalOffset(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"renderLayer",{get:function(){return this._renderLayer},set:function(t){this.setRenderLayer(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bounds",{get:function(){return this._areBoundsDirty&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,t.Vector2.zero,this.entity.transform.scale,this.entity.transform.rotation,this.width,this.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!=t&&(this._isVisible=t,this._isVisible?this.onBecameVisible():this.onBecameInvisible())},enumerable:!0,configurable:!0}),i.prototype.onEntityTransformChanged=function(t){this._areBoundsDirty=!0},i.prototype.isVisibleFromCamera=function(t){return!!t&&(this.isVisible=t.bounds.intersects(this.displayObject.getBounds().union(this.bounds)),this.isVisible)},i.prototype.setRenderLayer=function(t){if(t!=this._renderLayer){var e=this._renderLayer;this._renderLayer=t,this.entity&&this.entity.scene&&this.entity.scene.renderableComponents.updateRenderableRenderLayer(this,e,this._renderLayer)}return this},i.prototype.setColor=function(t){return this.color=t,this},i.prototype.setLocalOffset=function(t){return this._localOffset!=t&&(this._localOffset=t),this},i.prototype.sync=function(e){var i=new t.Vector2(this.entity.position.x+this.localOffset.x-e.position.x+e.origin.x,this.entity.position.y+this.localOffset.y-e.position.y+e.origin.y);this.displayObject.x!=i.x&&(this.displayObject.x=i.x),this.displayObject.y!=i.y&&(this.displayObject.y=i.y),this.displayObject.scaleX!=this.entity.scale.x&&(this.displayObject.scaleX=this.entity.scale.x),this.displayObject.scaleY!=this.entity.scale.y&&(this.displayObject.scaleY=this.entity.scale.y),this.displayObject.rotation!=this.entity.rotation&&(this.displayObject.rotation=this.entity.rotation)},i.prototype.toString=function(){return"[RenderableComponent] renderLayer: "+this.renderLayer},i.prototype.onBecameVisible=function(){this.displayObject.visible=this.isVisible},i.prototype.onBecameInvisible=function(){this.displayObject.visible=this.isVisible},i}(t.Component);t.RenderableComponent=e}(es||(es={})),function(t){var e=function(){function e(){this.updateOrder=0,this._enabled=!0}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),e.prototype.onEnabled=function(){},e.prototype.onDisabled=function(){},e.prototype.onRemovedFromScene=function(){},e.prototype.update=function(){},e.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled),this},e.prototype.setUpdateOrder=function(e){return this.updateOrder!=e&&(this.updateOrder=e,t.Core.scene._sceneComponents.sort(this.compareTo)),this},e.prototype.compareTo=function(t){return this.updateOrder-t.updateOrder},e}();t.SceneComponent=e}(es||(es={})),function(t){var e=egret.Bitmap,i=function(i){function n(e){void 0===e&&(e=null);var n=i.call(this)||this;return e instanceof t.Sprite?n.setSprite(e):e instanceof egret.Texture&&n.setSprite(new t.Sprite(e)),n}return __extends(n,i),Object.defineProperty(n.prototype,"bounds",{get:function(){return this._areBoundsDirty&&this._sprite&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,this._origin,this.entity.transform.scale,this.entity.transform.rotation,this._sprite.sourceRect.width,this._sprite.sourceRect.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"originNormalized",{get:function(){return new t.Vector2(this._origin.x/this.width*this.entity.transform.scale.x,this._origin.y/this.height*this.entity.transform.scale.y)},set:function(e){this.setOrigin(new t.Vector2(e.x*this.width/this.entity.transform.scale.x,e.y*this.height/this.entity.transform.scale.y))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"origin",{get:function(){return this._origin},set:function(t){this.setOrigin(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sprite",{get:function(){return this._sprite},set:function(t){this.setSprite(t)},enumerable:!0,configurable:!0}),n.prototype.setSprite=function(t){return this._sprite=t,this._sprite&&(this._origin=this._sprite.origin,this.displayObject.anchorOffsetX=this._origin.x,this.displayObject.anchorOffsetY=this._origin.y),this.displayObject=new e(t.texture2D),this},n.prototype.setOrigin=function(t){return this._origin!=t&&(this._origin=t,this.displayObject.anchorOffsetX=this._origin.x,this.displayObject.anchorOffsetY=this._origin.y,this._areBoundsDirty=!0),this},n.prototype.setOriginNormalized=function(e){return this.setOrigin(new t.Vector2(e.x*this.width/this.entity.transform.scale.x,e.y*this.height/this.entity.transform.scale.y)),this},n.prototype.render=function(e){this.sync(e);var i=new t.Vector2(this.entity.position.x+this.localOffset.x-e.position.x+e.origin.x,this.entity.position.y+this.localOffset.y-e.position.y+e.origin.y);this.displayObject.x!=i.x&&(this.displayObject.x=i.x),this.displayObject.y!=i.y&&(this.displayObject.y=i.y)},n}(t.RenderableComponent);t.SpriteRenderer=i}(es||(es={})),function(t){var e=egret.Bitmap,i=egret.RenderTexture,n=function(n){function r(e){var i=n.call(this,e)||this;return i._textureScale=t.Vector2.one,i._inverseTexScale=t.Vector2.one,i._gapX=0,i._gapY=0,i._sourceRect=e.sourceRect,i.displayObject.$fillMode=egret.BitmapFillMode.REPEAT,i}return __extends(r,n),Object.defineProperty(r.prototype,"bounds",{get:function(){return this._areBoundsDirty&&this._sprite&&(this._bounds.calculateBounds(this.entity.transform.position,this._localOffset,this._origin,this.entity.transform.scale,this.entity.transform.rotation,this.width,this.height),this._areBoundsDirty=!1),this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollX",{get:function(){return this._sourceRect.x},set:function(t){this._sourceRect.x=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scrollY",{get:function(){return this._sourceRect.y},set:function(t){this._sourceRect.y=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"textureScale",{get:function(){return this._textureScale},set:function(e){this._textureScale=e,this._inverseTexScale=new t.Vector2(1/this._textureScale.x,1/this._textureScale.y),this._sourceRect.width=this._sprite.sourceRect.width*this._inverseTexScale.x,this._sourceRect.height=this._sprite.sourceRect.height*this._inverseTexScale.y},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this._sourceRect.width},set:function(t){this._areBoundsDirty=!0,this._sourceRect.width=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this._sourceRect.height},set:function(t){this._areBoundsDirty=!0,this._sourceRect.height=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"gapXY",{get:function(){return new t.Vector2(this._gapX,this._gapY)},set:function(t){this._gapX=t.x,this._gapY=t.y;var n=new i,r=this.sprite.sourceRect;r.x=0,r.y=0,r.width+=this._gapX,r.height+=this._gapY,n.drawToTexture(this.displayObject,r),this.displayObject?this.displayObject.texture=n:this.displayObject=new e(n)},enumerable:!0,configurable:!0}),r.prototype.setGapXY=function(t){return this.gapXY=t,this},r.prototype.render=function(t){n.prototype.render.call(this,t);var e=this.displayObject;e.width=this.width,e.height=this.height,e.scrollRect=this._sourceRect},r}(t.SpriteRenderer);t.TiledSpriteRenderer=n}(es||(es={})),function(t){var e=function(e){function i(t){var i=e.call(this,t)||this;return i.scrollSpeedX=15,i.scroolSpeedY=0,i._scrollX=0,i._scrollY=0,i._scrollWidth=0,i._scrollHeight=0,i._scrollWidth=i.width,i._scrollHeight=i.height,i}return __extends(i,e),Object.defineProperty(i.prototype,"textureScale",{get:function(){return this._textureScale},set:function(e){this._textureScale=e,this._inverseTexScale=new t.Vector2(1/this._textureScale.x,1/this._textureScale.y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollWidth",{get:function(){return this._scrollWidth},set:function(t){this._scrollWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollHeight",{get:function(){return this._scrollHeight},set:function(t){this._scrollHeight=t},enumerable:!0,configurable:!0}),i.prototype.update=function(){this.sprite&&(this._scrollX+=this.scrollSpeedX*t.Time.deltaTime,this._scrollY+=this.scroolSpeedY*t.Time.deltaTime,this._sourceRect.x=this._scrollX,this._sourceRect.y=this._scrollY,this._sourceRect.width=this._scrollWidth+Math.abs(this._scrollX),this._sourceRect.height=this._scrollHeight+Math.abs(this._scrollY))},i}(t.TiledSpriteRenderer);t.ScrollingSpriteRenderer=e}(es||(es={})),function(t){var e=egret.SpriteSheet,i=function(){function i(e,i,n){void 0===i&&(i=new t.Rectangle(0,0,e.textureWidth,e.textureHeight)),void 0===n&&(n=i.getHalfSize()),this.uvs=new t.Rectangle,this.texture2D=e,this.sourceRect=i,this.center=new t.Vector2(.5*i.width,.5*i.height),this.origin=n;var r=1/e.textureWidth,o=1/e.textureHeight;this.uvs.x=i.x*r,this.uvs.y=i.y*o,this.uvs.width=i.width*r,this.uvs.height=i.height*o}return i.spritesFromAtlas=function(t,n,r,o,s){void 0===o&&(o=0),void 0===s&&(s=Number.MAX_VALUE);for(var a=[],h=t.textureWidth/n,c=t.textureHeight/r,u=0,l=new e(t),p=0;po||this._loopMode==e.pingPongOnce&&s>2*o)return this.animationState=i.completed,this._elapsedTime=0,this.currentFrame=0,void(this.displayObject.texture=n.sprites[this.currentFrame].texture2D);var a=Math.floor(s/r),h=n.sprites.length;if(h>2&&(this._loopMode==e.pingPong||this._loopMode==e.pingPongOnce)){var c=h-1;this.currentFrame=c-Math.abs(c-a%(2*c))}else this.currentFrame=a%h;this.displayObject.texture=n.sprites[this.currentFrame].texture2D}},r.prototype.addAnimation=function(t,e){return!this.sprite&&e.sprites.length>0&&this.setSprite(e.sprites[0]),this._animations[t]=e,this},r.prototype.play=function(t,n){void 0===n&&(n=null),this.currentAnimation=this._animations[t],this.currentAnimationName=t,this.currentFrame=0,this.animationState=i.running,this.displayObject.texture=this.currentAnimation.sprites[0].texture2D,this._elapsedTime=0,this._loopMode=n||e.loop},r.prototype.isAnimationActive=function(t){return this.currentAnimation&&this.currentAnimationName==t},r.prototype.pause=function(){this.animationState=i.paused},r.prototype.unPause=function(){this.animationState=i.running},r.prototype.stop=function(){this.currentAnimation=null,this.currentAnimationName=null,this.currentFrame=0,this.animationState=i.none},r}(t.SpriteRenderer);t.SpriteAnimator=n}(es||(es={})),function(t){var e=function(){function t(){}return Object.defineProperty(t.prototype,"hasCollision",{get:function(){return this.below||this.right||this.left||this.above},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.becameGroundedThisFrame=this.isGroundedOnOnewayPlatform=this.right=this.left=this.above=this.below=!1,this.slopAngle=0},t.prototype.toString=function(){return"[CollisionState] r: "+this.right+", l: "+this.left+", a: "+this.above+", b: "+this.below+", angle: "+this.slopAngle+", wasGroundedLastFrame: "+this.wasGroundedLastFrame+", becameGroundedThisFrame: "+this.becameGroundedThisFrame},t}();t.CollisionState=e;var i=function(e){function i(){var t=e.call(this)||this;return t.colliderHorizontalInset=2,t.colliderVerticalInset=6,t}return __extends(i,e),i.prototype.testCollisions=function(e,i,n){this._boxColliderBounds=i,n.wasGroundedLastFrame=n.below,n.reset();var r=e.x;e.y;if(0!=r){var o=r>0?t.Edge.right:t.Edge.left,s=this.collisionRectForSide(o,r);this.testMapCollision(s,o,n,0)?(e.x=0-t.RectangleExt.getSide(i,o),n.left=o==t.Edge.left,n.right=o==t.Edge.right,n._movementRemainderX.reset()):(n.left=!1,n.right=!1)}},i.prototype.testMapCollision=function(e,i,n,r){var o=t.EdgeExt.oppositeEdge(i);t.EdgeExt.isVertical(o)?e.center.x:e.center.y,t.RectangleExt.getSide(e,i),t.EdgeExt.isVertical(o)},i.prototype.collisionRectForSide=function(e,i){var n;return n=t.EdgeExt.isHorizontal(e)?t.RectangleExt.getRectEdgePortion(this._boxColliderBounds,e):t.RectangleExt.getHalfRect(this._boxColliderBounds,e),t.EdgeExt.isVertical(e)?t.RectangleExt.contract(n,this.colliderHorizontalInset,0):t.RectangleExt.contract(n,0,this.colliderVerticalInset),t.RectangleExt.expandSide(n,e,i),n},i}(t.Component);t.TiledMapMover=i}(es||(es={})),function(t){var e=function(e){function i(t,i,n){void 0===i&&(i=null),void 0===n&&(n=!0);var r=e.call(this)||this;return r.physicsLayer=1,r.toContainer=!1,r.tiledMap=t,r._shouldCreateColliders=n,r.displayObject=new egret.DisplayObjectContainer,i&&(r.collisionLayer=t.tileLayers[i]),r}return __extends(i,e),Object.defineProperty(i.prototype,"width",{get:function(){return this.tiledMap.width*this.tiledMap.tileWidth},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.tiledMap.height*this.tiledMap.tileHeight},enumerable:!0,configurable:!0}),i.prototype.setLayerToRender=function(t){this.layerIndicesToRender=[],this.layerIndicesToRender[0]=this.getLayerIndex(t)},i.prototype.setLayersToRender=function(){for(var t=[],e=0;e>6;0!=(e&t.LONG_MASK)&&i++,this._bits=new Array(i)}return t.prototype.and=function(t){for(var e,i=Math.min(this._bits.length,t._bits.length),n=0;n=0;)this._bits[e]&=~t._bits[e]},t.prototype.cardinality=function(){for(var t=0,e=this._bits.length-1;e>=0;e--){var i=this._bits[e];if(0!=i)if(-1!=i){var n=((i=((i=(i>>1&0x5555555555555400)+(0x5555555555555400&i))>>2&0x3333333333333400)+(0x3333333333333400&i))>>32)+i;t+=((n=((n=(n>>4&252645135)+(252645135&n))>>8&16711935)+(16711935&n))>>16&65535)+(65535&n)}else t+=64}return t},t.prototype.clear=function(t){if(null!=t){var e=t>>6;this.ensure(e),this._bits[e]&=~(1<>6;return!(e>=this._bits.length)&&0!=(this._bits[e]&1<=0;)if(0!=(this._bits[e]&t._bits[e]))return!0;return!1},t.prototype.isEmpty=function(){for(var t=this._bits.length-1;t>=0;t--)if(this._bits[t])return!1;return!0},t.prototype.nextSetBit=function(t){for(var e=t>>6,i=1<>6;this.ensure(i),this._bits[i]|=1<=this._bits.length){var e=new Number[t+1];e=this._bits.copyWithin(0,0,this._bits.length),this._bits=e}},t.LONG_MASK=63,t}();t.BitSet=e}(es||(es={})),function(t){var e=function(){function e(t){this._components=[],this._componentsToAdd=[],this._componentsToRemove=[],this._tempBufferList=[],this._entity=t}return Object.defineProperty(e.prototype,"count",{get:function(){return this._components.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._components},enumerable:!0,configurable:!0}),e.prototype.markEntityListUnsorted=function(){this._isComponentListUnsorted=!0},e.prototype.add=function(t){this._componentsToAdd.push(t)},e.prototype.remove=function(t){this._componentsToRemove.contains(t)&&console.warn("You are trying to remove a Component ("+t+") that you already removed"),this._componentsToAdd.contains(t)?this._componentsToAdd.remove(t):this._componentsToRemove.push(t)},e.prototype.removeAllComponents=function(){for(var t=0;t0){for(var i=0;i0){i=0;for(var n=this._componentsToAdd.length;i0){var e=this._entitiesToRemove;this._entitiesToRemove=this._tempEntityList,this._tempEntityList=e,this._tempEntityList.forEach(function(e){t.removeFromTagList(e),t._entities.remove(e),e.onRemovedFromScene(),e.scene=null,t.scene.entityProcessors.onEntityRemoved(e)}),this._tempEntityList.length=0}if(this._entitiesToAdded.length>0){e=this._entitiesToAdded;this._entitiesToAdded=this._tempEntityList,this._tempEntityList=e,this._tempEntityList.forEach(function(e){t._entities.contains(e)||(t._entities.push(e),e.scene=t.scene,t.addToTagList(e),t.scene.entityProcessors.onEntityAdded(e))}),this._tempEntityList.forEach(function(t){return t.onAddedToScene()}),this._tempEntityList.length=0,this._isEntityListUnsorted=!0}this._isEntityListUnsorted&&(this._entities.sort(),this._isEntityListUnsorted=!1),this._unsortedTags.length>0&&(this._unsortedTags.forEach(function(e){t._entityDict.get(e).sort()}),this._unsortedTags.length=0)},e.prototype.findEntity=function(t){for(var e=0;e=0;e=this.allSet.nextSetBit(e+1))if(!t.componentBits.get(e))return!1;return!(!this.exclusionSet.isEmpty()&&this.exclusionSet.intersects(t.componentBits))&&!(!this.oneSet.isEmpty()&&!this.oneSet.intersects(t.componentBits))},e.prototype.all=function(){for(var e=this,i=[],n=0;n0){for(var t=0,i=this._unsortedRenderLayers.length;t=e)return t;var n=!1;"-"==t.substr(0,1)&&(n=!0,t=t.substr(1));for(var r=e-i,o=0;o1?this.reverse(t.substring(1))+t.substring(0,1):t},t.cutOff=function(t,e,i,n){void 0===n&&(n=!0),e=Math.floor(e),i=Math.floor(i);var r=t.length;e>r&&(e=r);var o,s=e,a=e+i;return n?o=t.substring(0,s)+t.substr(a,r):(a=(s=r-1-e-i)+i,o=t.substring(0,s+1)+t.substr(a+1,r)),o},t.strReplace=function(t,e){for(var i=0,n=e.length;i",">",'"',""","'","'","®","®","©","©","™","™"],t}();!function(t){var e=function(){function e(){}return e.convertImageToCanvas=function(e,i){this.sharedCanvas||(this.sharedCanvas=egret.sys.createCanvas(),this.sharedContext=this.sharedCanvas.getContext("2d"));var n=e.$getTextureWidth(),r=e.$getTextureHeight();i||((i=egret.$TempRectangle).x=0,i.y=0,i.width=n,i.height=r),i.x=Math.min(i.x,n-1),i.y=Math.min(i.y,r-1),i.width=Math.min(i.width,n-i.x),i.height=Math.min(i.height,r-i.y);var o=Math.floor(i.width),s=Math.floor(i.height),a=this.sharedCanvas;if(a.style.width=o+"px",a.style.height=s+"px",this.sharedCanvas.width=o,this.sharedCanvas.height=s,"webgl"==egret.Capabilities.renderMode){var h=void 0;e.$renderBuffer?h=e:(egret.sys.systemRenderer.renderClear&&egret.sys.systemRenderer.renderClear(),(h=new egret.RenderTexture).drawToTexture(new egret.Bitmap(e)));for(var c=h.$renderBuffer.getPixels(i.x,i.y,o,s),u=0,l=0,p=0;p=0?"png":"jpg"});return wx.getFileSystemManager().saveFile({tempFilePath:o,filePath:wx.env.USER_DATA_PATH+"/"+i,success:function(t){}}),o},e.getPixel32=function(t,e,i){return egret.$warn(1041,"getPixel32","getPixels"),t.getPixels(e,i)},e.getPixels=function(t,e,i,n,r){if(void 0===n&&(n=1),void 0===r&&(r=1),"webgl"==egret.Capabilities.renderMode){var o=void 0;return t.$renderBuffer?o=t:(o=new egret.RenderTexture).drawToTexture(new egret.Bitmap(t)),o.$renderBuffer.getPixels(e,i,n,r)}try{this.convertImageToCanvas(t);return this.sharedContext.getImageData(e,i,n,r).data}catch(t){egret.$error(1039)}},e}();t.TextureUtils=e}(es||(es={})),function(t){var e=function(){function t(){}return t.update=function(t){var e=(t-this._lastTime)/1e3;this.deltaTime=e*this.timeScale,this.unscaledDeltaTime=e,this._timeSinceSceneLoad+=e,this.frameCount++,this._lastTime=t},t.sceneChanged=function(){this._timeSinceSceneLoad=0},t.checkEvery=function(t){return this._timeSinceSceneLoad/t>(this._timeSinceSceneLoad-this.deltaTime)/t},t.deltaTime=0,t.timeScale=1,t.frameCount=0,t._lastTime=0,t}();t.Time=e}(es||(es={}));var TimeUtils=function(){function t(){}return t.monthId=function(t){void 0===t&&(t=null);var e=(t=t||new Date).getFullYear(),i=t.getMonth()+1;return parseInt(e+(i<10?"0":"")+i)},t.dateId=function(t){void 0===t&&(t=null);var e=(t=t||new Date).getMonth()+1,i=e<10?"0":"",n=t.getDate(),r=n<10?"0":"";return parseInt(t.getFullYear()+i+e+r+n)},t.weekId=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!0),t=t||new Date;var i=new Date;i.setTime(t.getTime()),i.setDate(1),i.setMonth(0);var n=i.getFullYear(),r=i.getDay();0==r&&(r=7);var o=!1;r<=4?(o=r>1,i.setDate(i.getDate()-(r-1))):i.setDate(i.getDate()+7-r+1);var s=this.diffDay(t,i,!1);if(s<0)return i.setDate(1),i.setMonth(0),i.setDate(i.getDate()-1),this.weekId(i,!1);var a=s/7,h=Math.floor(a)+1;if(53==h){i.setTime(t.getTime()),i.setDate(i.getDate()-1);var c=i.getDay();if(0==c&&(c=7),e&&(!o||c<4))return i.setFullYear(i.getFullYear()+1),i.setDate(1),i.setMonth(0),this.weekId(i,!1)}return parseInt(n+"00"+(h>9?"":"0")+h)},t.diffDay=function(t,e,i){void 0===i&&(i=!1);var n=(t.getTime()-e.getTime())/864e5;return i?Math.ceil(n):Math.floor(n)},t.getFirstDayOfWeek=function(t){var e=(t=t||new Date).getDay()||7;return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1-e,0,0,0,0)},t.getFirstOfDay=function(t){return(t=t||new Date).setHours(0,0,0,0),t},t.getNextFirstOfDay=function(t){return new Date(this.getFirstOfDay(t).getTime()+864e5)},t.formatDate=function(t){var e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();return e+"-"+i+"-"+(n=n<10?"0"+n:n)},t.formatDateTime=function(t){var e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();n=n<10?"0"+n:n;var r=t.getHours(),o=t.getMinutes();o=o<10?"0"+o:o;var s=t.getSeconds();return e+"-"+i+"-"+n+" "+r+":"+o+":"+(s=s<10?"0"+s:s)},t.parseDate=function(t){var e=Date.parse(t);return isNaN(e)?new Date:new Date(Date.parse(t.replace(/-/g,"/")))},t.secondToTime=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=":"),void 0===i&&(i=!0);var n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=Math.floor(t%3600%60),s=n.toString(),a=r.toString(),h=o.toString();return n<10&&(s="0"+s),r<10&&(a="0"+a),o<10&&(h="0"+h),i?s+e+a+e+h:a+e+h},t.timeToMillisecond=function(t,e){void 0===e&&(e=":");for(var i=t.split(e),n=0,r=i.length,o=0;o-1?this.os="iOS":n.indexOf("android")>-1&&(this.os="Android");var r=i.language;r=r.indexOf("zh")>-1?"zh-CN":"en-US",this.language=r}},e}(egret.Capabilities);t.GraphicsCapabilities=e}(es||(es={})),function(t){var e=function(){function e(){this.setup(),this.graphicsCapabilities=new t.GraphicsCapabilities,this.graphicsCapabilities.initialize(this)}return Object.defineProperty(e.prototype,"viewport",{get:function(){return this._viewport},enumerable:!0,configurable:!0}),e.prototype.setup=function(){this._viewport=new t.Viewport(0,0,t.Core._instance.stage.stageWidth,t.Core._instance.stage.stageHeight)},e}();t.GraphicsDevice=e}(es||(es={})),function(t){var e=function(){function e(t,e,i,n){this._x=t,this._y=e,this._width=i,this._height=n,this._minDepth=0,this._maxDepth=1}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatio",{get:function(){return 0!=this._height&&0!=this._width?this._width/this._height:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){return new t.Rectangle(this._x,this._y,this._width,this._height)},set:function(t){this._x=t.x,this._y=t.y,this._width=t.width,this._height=t.height},enumerable:!0,configurable:!0}),e}();t.Viewport=e}(es||(es={})),function(t){var e=function(e){function i(){return e.call(this,t.PostProcessor.default_vert,i.blur_frag,{screenWidth:t.Core.graphicsDevice.viewport.width,screenHeight:t.Core.graphicsDevice.viewport.height})||this}return __extends(i,e),i.blur_frag="precision mediump float;\nuniform sampler2D uSampler;\nuniform float screenWidth;\nuniform float screenHeight;\nfloat normpdf(in float x, in float sigma)\n{\nreturn 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;\n}\nvoid main()\n{\nvec3 c = texture2D(uSampler, gl_FragCoord.xy / vec2(screenWidth, screenHeight).xy).rgb;\nconst int mSize = 11;\nconst int kSize = (mSize - 1)/2;\nfloat kernel[mSize];\nvec3 final_colour = vec3(0.0);\nfloat sigma = 7.0;\nfloat z = 0.0;\nfor (int j = 0; j <= kSize; ++j)\n{\nkernel[kSize+j] = kernel[kSize-j] = normpdf(float(j),sigma);\n}\nfor (int j = 0; j < mSize; ++j)\n{\nz += kernel[j];\n}\nfor (int i = -kSize; i <= kSize; ++i)\n{\nfor (int j = -kSize; j <= kSize; ++j)\n{\nfinal_colour += kernel[kSize+j]*kernel[kSize+i]*texture2D(uSampler, (gl_FragCoord.xy+vec2(float(i),float(j))) / vec2(screenWidth, screenHeight).xy).rgb;\n}\n}\ngl_FragColor = vec4(final_colour/(z*z), 1.0);\n}",i}(egret.CustomFilter);t.GaussianBlurEffect=e}(es||(es={})),function(t){var e=function(t){function e(){return t.call(this,e.vertSrc,e.fragmentSrc)||this}return __extends(e,t),e.vertSrc="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\n gl_Position = vec4( (aVertexPosition / projectionVector) + center , 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e.fragmentSrc="precision lowp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n#define SAMPLE_COUNT 15\nuniform vec2 _sampleOffsets[SAMPLE_COUNT];\nuniform float _sampleWeights[SAMPLE_COUNT];\nvoid main(void) {\nvec4 c = vec4(0, 0, 0, 0);\nfor( int i = 0; i < SAMPLE_COUNT; i++ )\n c += texture2D( uSampler, vTextureCoord + _sampleOffsets[i] ) * _sampleWeights[i];\ngl_FragColor = c;\n}",e}(egret.CustomFilter);t.PolygonLightEffect=e}(es||(es={})),function(t){var e=function(){function e(t){void 0===t&&(t=null),this.enabled=!0,this.effect=t}return e.prototype.onAddedToScene=function(e){this.scene=e,this.shape=new egret.Shape,this.shape.graphics.beginFill(16777215,1),this.shape.graphics.drawRect(0,0,t.Core.graphicsDevice.viewport.width,t.Core.graphicsDevice.viewport.height),this.shape.graphics.endFill(),e.addChild(this.shape)},e.prototype.process=function(){this.drawFullscreenQuad()},e.prototype.onSceneBackBufferSizeChanged=function(t,e){},e.prototype.unload=function(){this.effect&&(this.effect=null),this.scene.removeChild(this.shape),this.scene=null},e.prototype.drawFullscreenQuad=function(){this.scene.filters=[this.effect]},e.default_vert="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aColor;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\ngl_Position = vec4( (aVertexPosition / projectionVector) + center , 0.0, 1.0);\nvTextureCoord = aTextureCoord;\nvColor = vec4(aColor.x, aColor.x, aColor.x, aColor.x);\n}",e}();t.PostProcessor=e}(es||(es={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return __extends(i,e),i.prototype.onAddedToScene=function(i){e.prototype.onAddedToScene.call(this,i),this.effect=new t.GaussianBlurEffect},i}(t.PostProcessor);t.GaussianBlurPostProcessor=e}(es||(es={})),function(t){var e=function(){function t(t,e){void 0===e&&(e=null),this.renderOrder=0,this.shouldDebugRender=!0,this.camera=e,this.renderOrder=t}return Object.defineProperty(t.prototype,"wantsToRenderToSceneRenderTarget",{get:function(){return!!this.renderTexture},enumerable:!0,configurable:!0}),t.prototype.onAddedToScene=function(t){},t.prototype.unload=function(){},t.prototype.onSceneBackBufferSizeChanged=function(t,e){},t.prototype.compareTo=function(t){return this.renderOrder-t.renderOrder},t.prototype.beginRender=function(t){},t.prototype.renderAfterStateCheck=function(t,e){t.render(e)},t.prototype.debugRender=function(t,e){for(var i=0;ii?i:t},e.pointOnCirlce=function(i,n,r){var o=e.toRadians(r);return new t.Vector2(Math.cos(o)*o+i.x,Math.sin(o)*o+i.y)},e.isEven=function(t){return t%2==0},e.clamp01=function(t){return t<0?0:t>1?1:t},e.angleBetweenVectors=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},e.incrementWithWrap=function(t,e){return++t==e?0:t},e.approach=function(t,e,i){return tn&&(n=s.x),s.yr&&(r=s.y)}return this.fromMinMax(e,i,n,r)},i.prototype.intersects=function(t){return t.leftthis.x+this.width)return e}else{var n=1/t.direction.x,r=(this.x-t.start.x)*n,o=(this.x+this.width-t.start.x)*n;if(r>o){var s=r;r=o,o=s}if((e=Math.max(r,e))>(i=Math.min(o,i)))return e}if(Math.abs(t.direction.y)<1e-6){if(t.start.ythis.y+this.height)return e}else{var a=1/t.direction.y,h=(this.y-t.start.y)*a,c=(this.y+this.height-t.start.y)*a;if(h>c){var u=h;h=c,c=u}if((e=Math.max(h,e))>(i=Math.max(c,i)))return e}return e},i.prototype.containsRect=function(t){return this.x<=t.x&&t.x1)return!1;var u=(h.x*o.y-h.y*o.x)/a;return!(u<0||u>1)},i.lineToLineIntersection=function(e,i,n,r){var o=new t.Vector2(0,0),s=t.Vector2.subtract(i,e),a=t.Vector2.subtract(r,n),h=s.x*a.y-s.y*a.x;if(0==h)return o;var c=t.Vector2.subtract(n,e),u=(c.x*a.y-c.y*a.x)/h;if(u<0||u>1)return o;var l=(c.x*s.y-c.y*s.x)/h;return l<0||l>1?o:o=t.Vector2.add(e,new t.Vector2(u*s.x,u*s.y))},i.closestPointOnLine=function(e,i,n){var r=t.Vector2.subtract(i,e),o=t.Vector2.subtract(n,e),s=t.Vector2.dot(o,r)/t.Vector2.dot(r,r);return s=t.MathHelper.clamp(s,0,1),t.Vector2.add(e,new t.Vector2(r.x*s,r.y*s))},i.isCircleToCircle=function(e,i,n,r){return t.Vector2.distanceSquared(e,n)<(i+r)*(i+r)},i.isCircleToLine=function(e,i,n,r){return t.Vector2.distanceSquared(e,this.closestPointOnLine(n,r,e))=t&&r.y>=e&&r.x=t+n&&(s|=e.right),o.y=i+r&&(s|=e.bottom),s},i}();t.Collisions=i}(es||(es={})),function(t){var e=function(){function e(e,i,n,r,o){this.fraction=0,this.distance=0,this.point=t.Vector2.zero,this.normal=t.Vector2.zero,this.collider=e,this.fraction=i,this.distance=n,this.point=r,this.centroid=t.Vector2.zero}return e.prototype.setValues=function(t,e,i,n){this.collider=t,this.fraction=e,this.distance=i,this.point=n},e.prototype.setValuesNonCollider=function(t,e,i,n){this.fraction=t,this.distance=e,this.point=i,this.normal=n},e.prototype.reset=function(){this.collider=null,this.fraction=this.distance=0},e.prototype.toString=function(){return"[RaycastHit] fraction: "+this.fraction+", distance: "+this.distance+", normal: "+this.normal+", centroid: "+this.centroid+", point: "+this.point},e}();t.RaycastHit=e}(es||(es={})),function(t){var e=function(){function e(){}return e.reset=function(){this._spatialHash=new t.SpatialHash(this.spatialHashCellSize)},e.clear=function(){this._spatialHash.clear()},e.overlapCircleAll=function(t,e,i,n){if(void 0===n&&(n=-1),0!=i.length)return this._spatialHash.overlapCircle(t,e,i,n);console.error("An empty results array was passed in. No results will ever be returned.")},e.boxcastBroadphase=function(t,e){return void 0===e&&(e=this.allLayers),this._spatialHash.aabbBroadphase(t,null,e)},e.boxcastBroadphaseExcludingSelf=function(t,e,i){return void 0===i&&(i=this.allLayers),this._spatialHash.aabbBroadphase(e,t,i)},e.addCollider=function(t){e._spatialHash.register(t)},e.removeCollider=function(t){e._spatialHash.remove(t)},e.updateCollider=function(t){this._spatialHash.remove(t),this._spatialHash.register(t)},e.linecast=function(t,i,n){return void 0===n&&(n=e.allLayers),this._hitArray[0].reset(),this.linecastAll(t,i,this._hitArray,n),this._hitArray[0]},e.linecastAll=function(t,i,n,r){return void 0===r&&(r=e.allLayers),0==n.length?(console.warn("传入了一个空的hits数组。没有点击会被返回"),0):this._spatialHash.linecast(t,i,n,r)},e.debugDraw=function(t){this._spatialHash.debugDraw(t,2)},e.spatialHashCellSize=100,e.allLayers=-1,e.raycastsHitTriggers=!1,e.raycastsStartInColliders=!1,e._hitArray=[new t.RaycastHit],e}();t.Physics=e}(es||(es={})),function(t){var e=function(){return function(e,i){this.start=e,this.end=i,this.direction=t.Vector2.subtract(this.end,this.start)}}();t.Ray2D=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.clone=function(){return ObjectUtils.clone(this)},t}();t.Shape=e}(es||(es={})),function(t){var e=function(e){function i(t,i){var n=e.call(this)||this;return n._areEdgeNormalsDirty=!0,n.isUnrotated=!0,n.setPoints(t),n.isBox=i,n}return __extends(i,e),Object.defineProperty(i.prototype,"edgeNormals",{get:function(){return this._areEdgeNormalsDirty&&this.buildEdgeNormals(),this._edgeNormals},enumerable:!0,configurable:!0}),i.prototype.setPoints=function(t){this.points=t,this.recalculateCenterAndEdgeNormals(),this._originalPoints=[];for(var e=0;e=this.points.length?this.points[0]:this.points[n+1];var o=t.Vector2Ext.perpendicular(r,e);o=t.Vector2.normalize(o),this._edgeNormals[n]=o}},i.buildSymmetricalPolygon=function(e,i){for(var n=new Array(e),r=0;rr&&(r=s,n=o)}return e[n]},i.getClosestPointOnPolygonToPoint=function(e,i,n,r){n=Number.MAX_VALUE,r=new t.Vector2(0,0);for(var o,s=new t.Vector2(0,0),a=0;ae.y!=this.points[r].y>e.y&&e.x<(this.points[r].x-this.points[n].x)*(e.y-this.points[n].y)/(this.points[r].y-this.points[n].y)+this.points[n].x&&(i=!i);return i},i.prototype.pointCollidesWithShape=function(e,i){return t.ShapeCollisions.pointToPoly(e,this,i)},i}(t.Shape);t.Polygon=e}(es||(es={})),function(t){var e=function(e){function i(t,n){var r=e.call(this,i.buildBox(t,n),!0)||this;return r.width=t,r.height=n,r}return __extends(i,e),i.buildBox=function(e,i){var n=e/2,r=i/2,o=new Array(4);return o[0]=new t.Vector2(-n,-r),o[1]=new t.Vector2(n,-r),o[2]=new t.Vector2(n,r),o[3]=new t.Vector2(-n,r),o},i.prototype.updateBox=function(e,i){this.width=e,this.height=i;var n=e/2,r=i/2;this.points[0]=new t.Vector2(-n,-r),this.points[1]=new t.Vector2(n,-r),this.points[2]=new t.Vector2(n,r),this.points[3]=new t.Vector2(-n,r);for(var o=0;o1)return s;var a,h=t.Vector2.add(o.start,t.Vector2.add(o.direction,new t.Vector2(s))),c=0;h.xi.bounds.right&&(c|=1),h.yi.bounds.bottom&&(c|=2);var u=a+c;return 3==u&&console.log("m == 3. corner "+t.Time.frameCount),s},e}();t.RealtimeCollisions=e}(es||(es={})),function(t){var e=function(){function e(){}return e.polygonToPolygon=function(e,i,n){for(var r,o=!0,s=e.edgeNormals,a=i.edgeNormals,h=Number.POSITIVE_INFINITY,c=new t.Vector2,u=t.Vector2.subtract(e.position,i.position),l=0;l0&&(o=!1),!o)return!1;(m=Math.abs(m))r&&(r=o);return{min:n,max:r}},e.circleToPolygon=function(e,i,n){var r,o=t.Vector2.subtract(e.position,i.position),s=t.Polygon.getClosestPointOnPolygonToPoint(i.points,o,0,n.normal),a=i.containsPoint(e.position);if(0>e.radius*e.radius&&!a)return!1;a?r=t.Vector2.multiply(n.normal,new t.Vector2(Math.sqrt(0)-e.radius)):r=t.Vector2.multiply(n.normal,new t.Vector2(e.radius));return n.minimumTranslationVector=r,n.point=t.Vector2.add(s,i.position),!0},e.circleToBox=function(e,i,n){var r=i.bounds.getClosestPointOnRectangleBorderToPoint(e.position,n.normal);if(i.containsPoint(e.position)){n.point=r;var o=t.Vector2.add(r,t.Vector2.multiply(n.normal,new t.Vector2(e.radius)));return n.minimumTranslationVector=t.Vector2.subtract(e.position,o),!0}var s=t.Vector2.distanceSquared(r,e.position);if(0==s)n.minimumTranslationVector=t.Vector2.multiply(n.normal,new t.Vector2(e.radius));else if(s<=e.radius*e.radius){n.normal=t.Vector2.subtract(e.position,r);var a=n.normal.length()-e.radius;return n.point=r,n.normal=t.Vector2Ext.normalize(n.normal),n.minimumTranslationVector=t.Vector2.multiply(new t.Vector2(a),n.normal),!0}return!1},e.pointToCircle=function(e,i,n){var r=t.Vector2.distanceSquared(e,i.position),o=1+i.radius;if(r1)return!1;var l=(c.x*s.y-c.y*s.x)/h;return!(l<0||l>1)&&(o=o.add(e).add(t.Vector2.multiply(new t.Vector2(u),s)),!0)},e.lineToCircle=function(e,i,n,r){var o=t.Vector2.distance(e,i),s=t.Vector2.divide(t.Vector2.subtract(i,e),new t.Vector2(o)),a=t.Vector2.subtract(e,n.position),h=t.Vector2.dot(a,s),c=t.Vector2.dot(a,a)-n.radius*n.radius;if(c>0&&h>0)return!1;var u=h*h-c;return!(u<0)&&(r.fraction=-h-Math.sqrt(u),r.fraction<0&&(r.fraction=0),r.point=t.Vector2.add(e,t.Vector2.multiply(new t.Vector2(r.fraction),s)),r.distance=t.Vector2.distance(e,r.point),r.normal=t.Vector2.normalize(t.Vector2.subtract(r.point,n.position)),r.fraction=r.distance/o,!0)},e.boxToBoxCast=function(e,i,n,r){var o=this.minkowskiDifference(e,i);if(o.contains(0,0)){var s=o.getClosestPointOnBoundsToOrigin();return!s.equals(t.Vector2.zero)&&(r.normal=new t.Vector2(-s.x),r.normal=r.normal.normalize(),r.distance=0,r.fraction=0,!0)}var a=new t.Ray2D(t.Vector2.zero,new t.Vector2(-n.x)),h=o.rayIntersects(a);return h<=1&&(r.fraction=h,r.distance=n.length()*h,r.normal=new t.Vector2(-n.x),r.normal=r.normal.normalize(),r.centroid=t.Vector2.add(e.bounds.center,t.Vector2.multiply(n,new t.Vector2(h))),!0)},e}();t.ShapeCollisions=e}(es||(es={})),function(t){var e=function(){function e(e){void 0===e&&(e=100),this.gridBounds=new t.Rectangle,this._overlapTestCircle=new t.Circle(0),this._cellDict=new i,this._tempHashSet=[],this._cellSize=e,this._inverseCellSize=1/this._cellSize,this._raycastParser=new n}return e.prototype.register=function(e){var i=e.bounds;e.registeredPhysicsBounds=i;var n=this.cellCoords(i.x,i.y),r=this.cellCoords(i.right,i.bottom);this.gridBounds.contains(n.x,n.y)||(this.gridBounds=t.RectangleExt.union(this.gridBounds,n)),this.gridBounds.contains(r.x,r.y)||(this.gridBounds=t.RectangleExt.union(this.gridBounds,r));for(var o=n.x;o<=r.x;o++)for(var s=n.y;s<=r.y;s++){var a=this.cellAtPosition(o,s,!0);a.firstOrDefault(function(t){return t.hashCode==e.hashCode})||a.push(e)}},e.prototype.remove=function(t){for(var e=t.registeredPhysicsBounds,i=this.cellCoords(e.x,e.y),n=this.cellCoords(e.right,e.bottom),r=i.x;r<=n.x;r++)for(var o=i.y;o<=n.y;o++){var s=this.cellAtPosition(r,o);s?s.remove(t):console.log("从不存在碰撞器的单元格中移除碰撞器: ["+t+"]")}},e.prototype.removeWithBruteForce=function(t){this._cellDict.remove(t)},e.prototype.clear=function(){this._cellDict.clear()},e.prototype.debugDraw=function(t,e){void 0===e&&(e=1);for(var i=this.gridBounds.x;i<=this.gridBounds.right;i++)for(var n=this.gridBounds.y;n<=this.gridBounds.bottom;n++){var r=this.cellAtPosition(i,n);r&&r.length>0&&this.debugDrawCellDetails(i,n,r.length,t,e)}},e.prototype.aabbBroadphase=function(e,i,n){this._tempHashSet.length=0;for(var r=this.cellCoords(e.x,e.y),o=this.cellCoords(e.right,e.bottom),s=r.x;s<=o.x;s++)for(var a=r.y;a<=o.y;a++){var h=this.cellAtPosition(s,a);if(h)for(var c=function(r){var o=h[r];if(o==i||!t.Flags.isFlagSet(n,o.physicsLayer))return"continue";e.intersects(o.bounds)&&(u._tempHashSet.firstOrDefault(function(t){return t.hashCode==o.hashCode})||u._tempHashSet.push(o))},u=this,l=0;l=0&&(e.push(this.findBoundsRect(i,o,r,t)),i=-1)}i>=0&&(e.push(this.findBoundsRect(i,this.map.width,r,t)),i=-1)}return e},e.prototype.findBoundsRect=function(e,i,n,r){for(var o=-1,s=n+1;sthis.tileHeight||this.maxTileWidth>this.tileWidth},enumerable:!0,configurable:!0}),i.prototype.getTilesetForTileGid=function(t){if(0==t)return null;for(var e=this.tilesets.length-1;e>=0;e--)if(this.tilesets[e].firstGid<=t)return this.tilesets[e];console.error("tile gid"+t+"未在任何tileset中找到")},i.prototype.worldToTilePositionX=function(e,i){void 0===i&&(i=!0);var n=Math.floor(e/this.tileWidth);return i?t.MathHelper.clamp(n,0,this.width-1):n},i.prototype.worldToTilePositionY=function(e,i){void 0===i&&(i=!0);var n=Math.floor(e/this.tileHeight);return i?t.MathHelper.clamp(n,0,this.height-1):n},i.prototype.getLayer=function(t){return this.layers[t]},i.prototype.update=function(){this.tilesets.forEach(function(t){t.update()})},i.prototype.dispose=function(t){void 0===t&&(t=!0),this._isDisposed||(t&&(this.tilesets.forEach(function(t){t.image&&t.image.dispose()}),this.imageLayers.forEach(function(t){t.image&&t.image.dispose()})),this._isDisposed=!0)},i}(t.TmxDocument);t.TmxMap=e,function(t){t[t.unknown=0]="unknown",t[t.orthogonal=1]="orthogonal",t[t.isometric=2]="isometric",t[t.staggered=3]="staggered",t[t.hexagonal=4]="hexagonal"}(t.OrientationType||(t.OrientationType={})),function(t){t[t.x=0]="x",t[t.y=1]="y"}(t.StaggerAxisType||(t.StaggerAxisType={})),function(t){t[t.odd=0]="odd",t[t.even=1]="even"}(t.StaggerIndexType||(t.StaggerIndexType={})),function(t){t[t.rightDown=0]="rightDown",t[t.rightUp=1]="rightUp",t[t.leftDown=2]="leftDown",t[t.leftUp=3]="leftUp"}(t.RenderOrderType||(t.RenderOrderType={}))}(es||(es={})),function(t){var e=function(){return function(){}}();t.TmxObjectGroup=e;var i=function(){return function(){this.shape=new egret.Shape,this.textField=new egret.TextField}}();t.TmxObject=i;var n=function(){return function(){}}();t.TmxText=n;var r=function(){return function(){}}();t.TmxAlignment=r,function(t){t[t.basic=0]="basic",t[t.point=1]="point",t[t.tile=2]="tile",t[t.ellipse=3]="ellipse",t[t.polygon=4]="polygon",t[t.polyline=5]="polyline",t[t.text=6]="text"}(t.TmxObjectType||(t.TmxObjectType={})),function(t){t[t.unkownOrder=-1]="unkownOrder",t[t.TopDown=0]="TopDown",t[t.IndexOrder=1]="IndexOrder"}(t.DrawOrderType||(t.DrawOrderType={})),function(t){t[t.left=0]="left",t[t.center=1]="center",t[t.right=2]="right",t[t.justify=3]="justify"}(t.TmxHorizontalAlignment||(t.TmxHorizontalAlignment={})),function(t){t[t.top=0]="top",t[t.center=1]="center",t[t.bottom=2]="bottom"}(t.TmxVerticalAlignment||(t.TmxVerticalAlignment={}))}(es||(es={})),function(t){var e=function(){function e(){}return e.loadTmxMap=function(t,e){var i=RES.getRes(e);return this.loadTmxMapData(t,i)},e.loadTmxMapData=function(e,i){return __awaiter(this,void 0,void 0,function(){var n,r,o,s;return __generator(this,function(a){switch(a.label){case 0:e.version=i.version,e.tiledVersion=i.tiledversion,e.width=i.width,e.height=i.height,e.tileWidth=i.tilewidth,e.tileHeight=i.tileheight,e.hexSideLength=i.hexsidelength,e.orientation=this.parseOrientationType(i.orientation),e.staggerAxis=this.parseStaggerAxisType(i.staggeraxis),e.staggerIndex=this.parseStaggerIndexType(i.staggerindex),e.renderOrder=this.parseRenderOrderType(i.renderorder),e.nextObjectID=i.nextobjectid,e.backgroundColor=t.TmxUtils.color16ToUnit(i.color),e.properties=this.parsePropertyDict(i.properties),e.maxTileWidth=e.tileWidth,e.maxTileHeight=e.tileHeight,e.tilesets=[],n=0,r=i.tilesets,a.label=1;case 1:return nt.map.maxTileWidth&&(t.map.maxTileWidth=e.image.width),e.image.height>t.map.maxTileHeight&&(t.map.maxTileHeight=e.image.height))}),t.tileRegions.forEach(function(e){var i=e.width,n=e.height;i>t.map.maxTileWidth&&(t.map.maxTileWidth=i),i>t.map.maxTileHeight&&(t.map.maxTileHeight=n)})},e.parseOrientationType=function(e){return"unknown"==e?t.OrientationType.unknown:"orthogonal"==e?t.OrientationType.orthogonal:"isometric"==e?t.OrientationType.isometric:"staggered"==e?t.OrientationType.staggered:"hexagonal"==e?t.OrientationType.hexagonal:t.OrientationType.unknown},e.parseStaggerAxisType=function(e){return"y"==e?t.StaggerAxisType.y:t.StaggerAxisType.x},e.parseStaggerIndexType=function(e){return"even"==e?t.StaggerIndexType.even:t.StaggerIndexType.odd},e.parseRenderOrderType=function(e){return"right-up"==e?t.RenderOrderType.rightUp:"left-down"==e?t.RenderOrderType.leftDown:"left-up"==e?t.RenderOrderType.leftUp:t.RenderOrderType.rightDown},e.parsePropertyDict=function(e){if(!e)return null;for(var i=new Map,n=0,r=e;n=e.columns));y+=e.tileWidth+e.spacing);else e.tiles.forEach(function(i,n){e.tileRegions.set(n,new t.Rectangle(0,0,i.image.width,i.image.height))});return[2,e]}})})},e.loadTmxTilesetTile=function(e,i,n,r,o){return __awaiter(this,void 0,void 0,function(){var s,a,h,c,u,l,p,d,f,g,m,y,_;return __generator(this,function(v){switch(v.label){case 0:if(e.tileset=i,e.id=n.id,s=n.terrain)for(e.terrainEdges=new Array(4),a=0,h=0,c=s;h0){a.shape.x=h.x,a.shape.y=h.y,i.addChild(a.shape),a.shape.graphics.clear(),a.shape.graphics.lineStyle(1,10526884);for(l=0;l0&&(u=l.currentAnimationFrameGid);var p=i.tileset.tileRegions.get(u),d=Math.floor(i.x)*s,f=Math.floor(i.y)*a;i.horizontalFlip&&i.verticalFlip?(d+=a+(p.height*o.y-a),f-=p.width*o.x-s):i.horizontalFlip?d+=s+(p.height*o.y-a):i.verticalFlip?f+=s-p.width*o.x:f+=a-p.height*o.y;var g=new t.Vector2(d,f).add(r);if(i.tileset.image){if(n){var m=i.tileset.image.bitmap.getTexture(""+u);m||(m=i.tileset.image.bitmap.createTexture(""+u,p.x,p.y,p.width,p.height)),i.tileset.image.texture=new e(m),n.addChild(i.tileset.image.texture),i.tileset.image.texture.x!=g.x&&(i.tileset.image.texture.x=g.x),i.tileset.image.texture.y!=g.y&&(i.tileset.image.texture.y=g.y),i.verticalFlip&&i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=-1):i.verticalFlip?(i.tileset.image.texture.scaleX=o.x,i.tileset.image.texture.scaleY=-1):i.horizontalFlip?(i.tileset.image.texture.scaleX=-1,i.tileset.image.texture.scaleY=o.y):(i.tileset.image.texture.scaleX=o.x,i.tileset.image.texture.scaleY=o.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 l.image.texture&&(l.image.bitmap.getTexture(u.toString())||(l.image.texture=new e(l.image.bitmap.createTexture(u.toString(),p.x,p.y,p.width,p.height)),n.addChild(l.image.texture)),l.image.texture.x=g.x,l.image.texture.y=g.y,l.image.texture.scaleX=o.x,l.image.texture.scaleY=o.y,l.image.texture.rotation=0,l.image.texture.anchorOffsetX=0,l.image.texture.anchorOffsetY=0,l.image.texture.filters=[h])},i}();t.TiledRendering=i}(es||(es={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e.prototype.update=function(){this.tiles.forEach(function(t){t.updateAnimatedTiles()})},e}(t.TmxDocument);t.TmxTileset=e;var i=function(){return function(){}}();t.TmxTileOffset=i;var n=function(){return function(){}}();t.TmxTerrain=n}(es||(es={})),function(t){var e=function(){function e(){}return Object.defineProperty(e.prototype,"currentAnimationFrameGid",{get:function(){return this.animationFrames[this._animationCurrentFrame].gid+this.tileset.firstGid},enumerable:!0,configurable:!0}),e.prototype.processProperties=function(){var t;(t=this.properties.get("engine.isDestructable"))&&(this.isDestructable=Boolean(t)),(t=this.properties.get("engine:isSlope"))&&(this.isSlope=Boolean(t)),(t=this.properties.get("engine:isOneWayPlatform"))&&(this.isOneWayPlatform=Boolean(t)),(t=this.properties.get("engine:slopeTopLeft"))&&(this.slopeTopLeft=Number(t)),(t=this.properties.get("engine:slopeTopRight"))&&(this.slopeTopRight=Number(t))},e.prototype.updateAnimatedTiles=function(){0!=this.animationFrames.length&&(this._animationElapsedTime+=t.Time.deltaTime,this._animationElapsedTime>this.animationFrames[this._animationCurrentFrame].duration&&(this._animationCurrentFrame=t.MathHelper.incrementWithWrap(this._animationCurrentFrame,this.animationFrames.length),this._animationElapsedTime=0))},e}();t.TmxTilesetTile=e;var i=function(){return function(){}}();t.TmxAnimationFrame=i}(es||(es={})),function(t){var e=function(){function e(){}return e.decode=function(e,i,n){switch(n=n||"none",i=i||"none"){case"base64":var r=t.Base64Utils.decodeBase64AsArray(e,4);return"none"===n?r:t.Base64Utils.decompress(e,r,n);case"csv":return t.Base64Utils.decodeCSV(e);case"none":for(var o=[],s=0;si;n--)if(t[n]0&&t[r-1]>n;r--)t[r]=t[r-1];t[r]=n}},t.binarySearch=function(t,e){for(var i=0,n=t.length,r=i+n>>1;i=t[r]&&(i=r+1),r=i+n>>1;return t[i]==e?i:-1},t.findElementIndex=function(t,e){for(var i=t.length,n=0;nt[e]&&(e=n);return e},t.getMinElementIndex=function(t){for(var e=0,i=t.length,n=1;n=0;--r)i.unshift(e[r]);return i},t.getDifferAry=function(t,e){t=this.getUniqueAry(t),e=this.getUniqueAry(e);for(var i=t.concat(e),n={},r=[],o=i.length,s=0;s=0;e-=1)t.splice(e,1)},t.cloneList=function(t){return t?t.slice(0,t.length):null},t.equals=function(t,e){if(t==e)return!0;var i=t.length;if(i!=e.length)return!1;for(;i--;)if(t[i]!=e[i])return!1;return!0},t.insert=function(t,e,i){if(!t)return null;var n=t.length;if(e>n&&(e=n),e<0&&(e=0),e==n)t.push(i);else if(0==e)t.unshift(i);else{for(var r=n-1;r>=e;r-=1)t[r+1]=t[r];t[e]=i}return i},t}();!function(t){var e=function(){function t(){}return Object.defineProperty(t,"nativeBase64",{get:function(){return"function"==typeof window.atob},enumerable:!0,configurable:!0}),t.decode=function(t){if(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),this.nativeBase64)return window.atob(t);for(var e,i,n,r,o,s,a=[],h=0;h>4,i=(15&r)<<4|(o=this._keyStr.indexOf(t.charAt(h++)))>>2,n=(3&o)<<6|(s=this._keyStr.indexOf(t.charAt(h++))),a.push(String.fromCharCode(e)),64!==o&&a.push(String.fromCharCode(i)),64!==s&&a.push(String.fromCharCode(n));return a=a.join("")},t.encode=function(t){if(t=t.replace(/\r\n/g,"\n"),!this.nativeBase64){for(var e,i,n,r,o,s,a,h=[],c=0;c>2,o=(3&e)<<4|(i=t.charCodeAt(c++))>>4,s=(15&i)<<2|(n=t.charCodeAt(c++))>>6,a=63&n,isNaN(i)?s=a=64:isNaN(n)&&(a=64),h.push(this._keyStr.charAt(r)),h.push(this._keyStr.charAt(o)),h.push(this._keyStr.charAt(s)),h.push(this._keyStr.charAt(a));return h=h.join("")}window.btoa(t)},t.decodeBase64AsArray=function(e,i){i=i||1;var n,r,o,s=t.decode(e),a=new Uint32Array(s.length/i);for(n=0,o=s.length/i;n=0;--r)a[n]+=s.charCodeAt(n*i+r)<<(r<<3);return a},t.decompress=function(t,e,i){throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!")},t.decodeCSV=function(t){for(var e=t.replace("\n","").trim().split(","),i=[],n=0;n>16},set:function(t){this._packedValue=4278255615&this._packedValue|t<<16},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"g",{get:function(){return this._packedValue>>8},set:function(t){this._packedValue=4294902015&this._packedValue|t<<8},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"r",{get:function(){return this._packedValue},set:function(t){this._packedValue=4294967040&this._packedValue|t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"a",{get:function(){return this._packedValue>>24},set:function(t){this._packedValue=16777215&this._packedValue|t<<24},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"packedValue",{get:function(){return this._packedValue},set:function(t){this._packedValue=t},enumerable:!0,configurable:!0}),e.prototype.equals=function(t){return this._packedValue==t._packedValue},e}();t.Color=e}(es||(es={})),function(t){var e=function(){function t(){this.loadedAssets=new Map}return t.prototype.loadRes=function(t,e){var i=this;return void 0===e&&(e=!0),new Promise(function(n,r){var o=i.loadedAssets.get(t);o?n(o):e?RES.getResAsync(t).then(function(e){i.loadedAssets.set(t,e),n(e)}).catch(function(e){console.error("资源加载错误:",t,e),r(e)}):RES.getResByUrl(t).then(function(e){i.loadedAssets.set(t,e),n(e)}).catch(function(e){console.error("资源加载错误:",t,e),r(e)})})},t.prototype.dispose=function(){this.loadedAssets.forEach(function(t){var e=t;RES.destroyRes(e)&&e.dispose()}),this.loadedAssets.clear()},t}();t.ContentManager=e}(es||(es={})),function(t){var e=function(){function t(){}return t.getColorMatrix=function(t){var e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];return e[0]=Math.floor(t/256/256)/255,e[6]=Math.floor(t/256%256)/255,e[12]=t%256/255,new egret.ColorMatrixFilter(e)},t}();t.DrawUtils=e}(es||(es={})),function(t){var e=function(){function e(){}return e.oppositeEdge=function(e){switch(e){case t.Edge.bottom:return t.Edge.top;case t.Edge.top:return t.Edge.bottom;case t.Edge.left:return t.Edge.right;case t.Edge.right:return t.Edge.left}},e.isHorizontal=function(e){return e==t.Edge.right||e==t.Edge.left},e.isVertical=function(e){return e==t.Edge.top||e==t.Edge.bottom},e}();t.EdgeExt=e}(es||(es={})),function(t){var e=function(){return function(t,e){this.func=t,this.context=e}}();t.FuncPack=e;var i=function(){function t(){this._messageTable=new Map}return t.prototype.addObserver=function(t,i,n){var r=this._messageTable.get(t);r||(r=[],this._messageTable.set(t,r)),-1!=r.findIndex(function(t){return t.func==i})&&console.warn("您试图添加相同的观察者两次"),r.push(new e(i,n))},t.prototype.removeObserver=function(t,e){var i=this._messageTable.get(t),n=i.findIndex(function(t){return t.func==e});-1!=n&&i.removeAt(n)},t.prototype.emit=function(t,e){var i=this._messageTable.get(t);if(i)for(var n=i.length-1;n>=0;n--)i[n].func.call(i[n].context,e)},t}();t.Emitter=i}(es||(es={})),function(t){!function(t){t[t.top=0]="top",t[t.bottom=1]="bottom",t[t.left=2]="left",t[t.right=3]="right"}(t.Edge||(t.Edge={}))}(es||(es={})),function(t){var e=function(){function t(){}return t.repeat=function(t,e){for(var i=[];e--;)i.push(t);return i},t}();t.Enumerable=e}(es||(es={})),function(t){var e=function(){function t(){}return Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),t.prototype.setEnabled=function(t){this._enabled!=t&&(this._enabled=t,this._enabled?this.onEnabled():this.onDisabled())},t.prototype.onEnabled=function(){},t.prototype.onDisabled=function(){},t.prototype.update=function(){},t}();t.GlobalManager=e}(es||(es={})),function(t){var e=function(){function e(){this.x=0,this.y=0,this.touchPoint=-1,this.touchDown=!1}return Object.defineProperty(e.prototype,"position",{get:function(){return new t.Vector2(this.x,this.y)},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this.x=0,this.y=0,this.touchDown=!1,this.touchPoint=-1},e}();t.TouchState=e;var i=function(){function i(){}return Object.defineProperty(i,"gameTouchs",{get:function(){return this._gameTouchs},enumerable:!0,configurable:!0}),Object.defineProperty(i,"resolutionScale",{get:function(){return this._resolutionScale},enumerable:!0,configurable:!0}),Object.defineProperty(i,"totalTouchCount",{get:function(){return this._totalTouchCount},enumerable:!0,configurable:!0}),Object.defineProperty(i,"touchPosition",{get:function(){return this._gameTouchs[0]?this._gameTouchs[0].position:t.Vector2.zero},enumerable:!0,configurable:!0}),Object.defineProperty(i,"maxSupportedTouch",{get:function(){return t.Core._instance.stage.maxTouches},set:function(e){t.Core._instance.stage.maxTouches=e,this.initTouchCache()},enumerable:!0,configurable:!0}),Object.defineProperty(i,"touchPositionDelta",{get:function(){var e=t.Vector2.subtract(this.touchPosition,this._previousTouchState.position);return e.length()>0&&this.setpreviousTouchState(this._gameTouchs[0]),e},enumerable:!0,configurable:!0}),i.initialize=function(){this._init||(this._init=!0,t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.touchBegin,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.touchMove,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_END,this.touchEnd,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_CANCEL,this.touchEnd,this),t.Core._instance.stage.addEventListener(egret.TouchEvent.TOUCH_RELEASE_OUTSIDE,this.touchEnd,this),this.initTouchCache())},i.scaledPosition=function(e){var i=new t.Vector2(e.x-this._resolutionOffset.x,e.y-this._resolutionOffset.y);return t.Vector2.multiply(i,this.resolutionScale)},i.initTouchCache=function(){this._totalTouchCount=0,this._touchIndex=0,this._gameTouchs.length=0;for(var t=0;t0)for(var e=0;ethis._objectQueue.length;)this._objectQueue.shift()},t.clearCache=function(){this._objectQueue.length=0},t.obtain=function(){return this._objectQueue.length>0?this._objectQueue.shift():[]},t.free=function(t){this._objectQueue.unshift(t),t.length=0},t._objectQueue=[],t}();t.ListPool=e}(es||(es={}));var THREAD_ID=Math.floor(1e3*Math.random())+"-"+Date.now(),nextTick=function(t){setTimeout(t,0)},LockUtils=function(){function t(t){this._keyX="mutex_key_"+t+"_X",this._keyY="mutex_key_"+t+"_Y",this.setItem=egret.localStorage.setItem.bind(localStorage),this.getItem=egret.localStorage.getItem.bind(localStorage),this.removeItem=egret.localStorage.removeItem.bind(localStorage)}return t.prototype.lock=function(){var t=this;return new Promise(function(e,i){var n=function(){t.setItem(t._keyX,THREAD_ID),null===!t.getItem(t._keyY)&&nextTick(n),t.setItem(t._keyY,THREAD_ID),t.getItem(t._keyX)!==THREAD_ID?setTimeout(function(){t.getItem(t._keyY)===THREAD_ID?(e(),t.removeItem(t._keyY)):nextTick(n)},10):(e(),t.removeItem(t._keyY))};n()})},t}();!function(t){var e=function(){function t(t,e){this.first=t,this.second=e}return t.prototype.clear=function(){this.first=this.second=null},t.prototype.equals=function(t){return this.first==t.first&&this.second==t.second},t}();t.Pair=e}(es||(es={}));var RandomUtils=function(){function t(){}return t.randrange=function(t,e,i){if(void 0===i&&(i=1),0==i)throw new Error("step 不能为 0");var n=e-t;if(0==n)throw new Error("没有可用的范围("+t+","+e+")");n<0&&(n=t-e);var r=Math.floor((n+i-1)/i);return Math.floor(this.random()*r)*i+Math.min(t,e)},t.randint=function(t,e){return(t=Math.floor(t))>(e=Math.floor(e))?t++:e++,this.randrange(t,e)},t.randnum=function(t,e){return this.random()*(e-t)+t},t.shuffle=function(t){return t.sort(this._randomCompare),t},t.choice=function(t){if(!t.hasOwnProperty("length"))throw new Error("无法对此对象执行此操作");var e=Math.floor(this.random()*t.length);return t instanceof String?String(t).charAt(e):t[e]},t.sample=function(t,e){var i=t.length;if(e<=0||i=0;)s=Math.floor(this.random()*i);n.push(t[s]),r.push(s)}return n},t.random=function(){return Math.random()},t.boolean=function(t){return void 0===t&&(t=.5),this.random().5?1:-1},t}();!function(t){var e=function(){function e(){}return e.getSide=function(e,i){switch(i){case t.Edge.top:return e.top;case t.Edge.bottom:return e.bottom;case t.Edge.left:return e.left;case t.Edge.right:return e.right}},e.union=function(e,i){var n=new t.Rectangle(i.x,i.y,0,0),r=new t.Rectangle;return r.x=Math.min(e.x,n.x),r.y=Math.min(e.y,n.y),r.width=Math.max(e.right,n.right)-r.x,r.height=Math.max(e.bottom,r.bottom)-r.y,r},e.getHalfRect=function(e,i){switch(i){case t.Edge.top:return new t.Rectangle(e.x,e.y,e.width,e.height/2);case t.Edge.bottom:return new t.Rectangle(e.x,e.y+e.height/2,e.width,e.height/2);case t.Edge.left:return new t.Rectangle(e.x,e.y,e.width/2,e.height);case t.Edge.right:return new t.Rectangle(e.x+e.width/2,e.y,e.width/2,e.height)}},e.getRectEdgePortion=function(e,i,n){switch(void 0===n&&(n=1),i){case t.Edge.top:return new t.Rectangle(e.x,e.y,e.width,n);case t.Edge.bottom:return new t.Rectangle(e.x,e.y+e.height-n,e.width,n);case t.Edge.left:return new t.Rectangle(e.x,e.y,n,e.height);case t.Edge.right:return new t.Rectangle(e.x+e.width-n,e.y,n,e.height)}},e.expandSide=function(e,i,n){switch(n=Math.abs(n),i){case t.Edge.top:e.y-=n,e.height+=n;break;case t.Edge.bottom:e.height+=n;break;case t.Edge.left:e.x-=n,e.width+=n;break;case t.Edge.right:e.width+=n}},e.contract=function(t,e,i){t.x+=e,t.y+=i,t.width-=2*e,t.height-=2*i},e}();t.RectangleExt=e}(es||(es={})),function(t){var e=function(){function t(){}return t.prototype.update=function(t){this.remainder+=t;var e=Math.trunc(this.remainder);return this.remainder-=e,e},t.prototype.reset=function(){this.remainder=0},t}();t.SubpixelNumber=e}(es||(es={})),function(t){var e=function(){function e(){this.triangleIndices=[],this._triPrev=new Array(12),this._triNext=new Array(12)}return e.testPointTriangle=function(e,i,n,r){return!(t.Vector2Ext.cross(t.Vector2.subtract(e,i),t.Vector2.subtract(n,i))<0)&&(!(t.Vector2Ext.cross(t.Vector2.subtract(e,n),t.Vector2.subtract(r,n))<0)&&!(t.Vector2Ext.cross(t.Vector2.subtract(e,r),t.Vector2.subtract(i,r))<0))},e.prototype.triangulate=function(i,n){void 0===n&&(n=!0);var r=i.length;this.initialize(r);for(var o=0,s=0;r>3&&o<500;){o++;var a=!0,h=i[this._triPrev[s]],c=i[s],u=i[this._triNext[s]];if(t.Vector2Ext.isTriangleCCW(h,c,u)){var l=this._triNext[this._triNext[s]];do{if(e.testPointTriangle(i[l],h,c,u)){a=!1;break}l=this._triNext[l]}while(l!=this._triPrev[s])}else a=!1;a?(this.triangleIndices.push(this._triPrev[s]),this.triangleIndices.push(s),this.triangleIndices.push(this._triNext[s]),this._triNext[this._triPrev[s]]=this._triNext[s],this._triPrev[this._triNext[s]]=this._triPrev[s],r--,s=this._triPrev[s]):s=this._triNext[s]}this.triangleIndices.push(this._triPrev[s]),this.triangleIndices.push(s),this.triangleIndices.push(this._triNext[s]),n||this.triangleIndices.reverse()},e.prototype.initialize=function(t){this.triangleIndices.length=0,this._triNext.lengtht.MathHelper.Epsilon?e=t.Vector2.divide(e,new t.Vector2(i)):e.x=e.y=0,e},e.transformA=function(t,e,i,n,r,o){for(var s=0;sthis.safeArea.right&&(s.x=this.safeArea.right-s.width),s.topthis.safeArea.bottom&&(s.y=this.safeArea.bottom-s.height),s},i}();t.Layout=i,function(t){t[t.none=0]="none",t[t.left=1]="left",t[t.right=2]="right",t[t.horizontalCenter=4]="horizontalCenter",t[t.top=8]="top",t[t.bottom=16]="bottom",t[t.verticalCenter=32]="verticalCenter",t[t.topLeft=9]="topLeft",t[t.topRight=10]="topRight",t[t.topCenter=12]="topCenter",t[t.bottomLeft=17]="bottomLeft",t[t.bottomRight=18]="bottomRight",t[t.bottomCenter=20]="bottomCenter",t[t.centerLeft=33]="centerLeft",t[t.centerRight=34]="centerRight",t[t.center=36]="center"}(e=t.Alignment||(t.Alignment={}))}(es||(es={})),function(t){var e,i=function(){function t(t){void 0===t&&(t=n),this.getSystemTime=t,this._stopDuration=0,this._completeSlices=[]}return t.prototype.getState=function(){return void 0===this._startSystemTime?e.IDLE:void 0===this._stopSystemTime?e.RUNNING:e.STOPPED},t.prototype.isIdle=function(){return this.getState()===e.IDLE},t.prototype.isRunning=function(){return this.getState()===e.RUNNING},t.prototype.isStopped=function(){return this.getState()===e.STOPPED},t.prototype.slice=function(){return this.recordPendingSlice()},t.prototype.getCompletedSlices=function(){return Array.from(this._completeSlices)},t.prototype.getCompletedAndPendingSlices=function(){return this._completeSlices.concat([this.getPendingSlice()])},t.prototype.getPendingSlice=function(){return this.calculatePendingSlice()},t.prototype.getTime=function(){return this.caculateStopwatchTime()},t.prototype.reset=function(){this._startSystemTime=this._pendingSliceStartStopwatchTime=this._stopSystemTime=void 0,this._stopDuration=0,this._completeSlices=[]},t.prototype.start=function(t){if(void 0===t&&(t=!1),t&&this.reset(),void 0!==this._stopSystemTime){var e=(i=this.getSystemTime())-this._stopSystemTime;this._stopDuration+=e,this._stopSystemTime=void 0}else if(void 0===this._startSystemTime){var i=this.getSystemTime();this._startSystemTime=i,this._pendingSliceStartStopwatchTime=0}},t.prototype.stop=function(t){if(void 0===t&&(t=!1),void 0===this._startSystemTime)return 0;var e=this.getSystemTimeOfCurrentStopwatchTime();return t&&this.recordPendingSlice(this.caculateStopwatchTime(e)),this._stopSystemTime=e,this.getTime()},t.prototype.calculatePendingSlice=function(t){return void 0===this._pendingSliceStartStopwatchTime?Object.freeze({startTime:0,endTime:0,duration:0}):(void 0===t&&(t=this.getTime()),Object.freeze({startTime:this._pendingSliceStartStopwatchTime,endTime:t,duration:t-this._pendingSliceStartStopwatchTime}))},t.prototype.caculateStopwatchTime=function(t){return void 0===this._startSystemTime?0:(void 0===t&&(t=this.getSystemTimeOfCurrentStopwatchTime()),t-this._startSystemTime-this._stopDuration)},t.prototype.getSystemTimeOfCurrentStopwatchTime=function(){return void 0===this._stopSystemTime?this.getSystemTime():this._stopSystemTime},t.prototype.recordPendingSlice=function(t){if(void 0!==this._pendingSliceStartStopwatchTime){void 0===t&&(t=this.getTime());var e=this.calculatePendingSlice(t);return this._pendingSliceStartStopwatchTime=e.endTime,this._completeSlices.push(e),e}return this.calculatePendingSlice()},t}();t.Stopwatch=i,function(t){t.IDLE="IDLE",t.RUNNING="RUNNING",t.STOPPED="STOPPED"}(e||(e={})),t.setDefaultSystemTimeGetter=function(t){void 0===t&&(t=Date.now),n=t};var n=Date.now}(stopwatch||(stopwatch={})),function(t){var e=function(){function e(){this.showLog=!1,this._frameKey="frame",this._logKey="log",this.markers=[],this.stopwacth=new stopwatch.Stopwatch,this._markerNameToIdMap=new Map,this._logs=new Array(2);for(var e=0;e=e.logSnapDuration&&(l.logs[r].snapMin=l.logs[r].min,l.logs[r].snapMax=l.logs[r].max,l.logs[r].snapAvg=l.logs[r].avg,l.logs[r].samples=0)):(l.logs[r].min=c,l.logs[r].max=c,l.logs[r].avg=c,l.logs[r].initialized=!0)}s.markCount=o.nestCount,s.nestCount=o.nestCount}t.stopwacth.reset(),t.stopwacth.start()}})},e.prototype.beginMark=function(t,i,n){var r=this;void 0===n&&(n=0),new LockUtils(this._frameKey).lock().then(function(){if(n<0||n>=e.maxBars)throw new Error("barIndex argument out of range");var o=r._curLog.bars[n];if(o.markCount>=e.maxSamples)throw new Error("exceeded sample count. either set larger number to timeruler.maxsaple or lower sample count");if(o.nestCount>=e.maxNestCall)throw new Error("exceeded nest count. either set larger number to timeruler.maxnestcall or lower nest calls");var s=r._markerNameToIdMap.get(t);isNaN(s)&&(s=r.markers.length,r._markerNameToIdMap.set(t,s)),o.markerNests[o.nestCount++]=o.markCount,o.markers[o.markCount].markerId=s,o.markers[o.markCount].color=i,o.markers[o.markCount].beginTime=r.stopwacth.getTime(),o.markers[o.markCount].endTime=-1})},e.prototype.endMark=function(t,i){var n=this;void 0===i&&(i=0),new LockUtils(this._frameKey).lock().then(function(){if(i<0||i>=e.maxBars)throw new Error("barIndex argument out of range");var r=n._curLog.bars[i];if(r.nestCount<=0)throw new Error("call beginMark method before calling endMark method");var o=n._markerNameToIdMap.get(t);if(isNaN(o))throw new Error("Marker "+t+" is not registered. Make sure you specifed same name as you used for beginMark method");var s=r.markerNests[--r.nestCount];if(r.markers[s].markerId!=o)throw new Error("Incorrect call order of beginMark/endMark method. beginMark(A), beginMark(B), endMark(B), endMark(A) But you can't called it like beginMark(A), beginMark(B), endMark(A), endMark(B).");r.markers[s].endTime=n.stopwacth.getTime()})},e.prototype.getAverageTime=function(t,i){if(t<0||t>=e.maxBars)throw new Error("barIndex argument out of range");var n=0,r=this._markerNameToIdMap.get(i);return r&&(n=this.markers[r].logs[t].avg),n},e.prototype.resetLog=function(){var t=this;new LockUtils(this._logKey).lock().then(function(){var e=parseInt(egret.localStorage.getItem(t._logKey),10);e+=1,egret.localStorage.setItem(t._logKey,e.toString()),t.markers.forEach(function(t){for(var e=0;e0&&(n+=e.barHeight+2*e.barPadding,r=Math.max(r,t.markers[t.markCount-1].endTime))});var o=this.sampleFrames*(1/60*1e3);this._frameAdjust=r>o?Math.max(0,this._frameAdjust)+1:Math.min(0,this._frameAdjust)-1,Math.max(this._frameAdjust)>e.autoAdjustDelay&&(this.sampleFrames=Math.min(e.maxSampleFrames,this.sampleFrames),this.sampleFrames=Math.max(this.targetSampleFrames,r/(1/60*1e3)+1),this._frameAdjust=0);t.y,e.barHeight}},e.prototype.onGraphicsDeviceReset=function(){var i=new t.Layout;this._position=i.place(new t.Vector2(this.width,e.barHeight),0,.01,t.Alignment.bottomCenter).location},e.maxBars=8,e.maxSamples=256,e.maxNestCall=32,e.barHeight=8,e.maxSampleFrames=4,e.logSnapDuration=120,e.barPadding=2,e.autoAdjustDelay=30,e}();t.TimeRuler=e;var i=function(){return function(){this.bars=new Array(e.maxBars),this.bars.fill(new n,0,e.maxBars)}}();t.FrameLog=i;var n=function(){return function(){this.markers=new Array(e.maxSamples),this.markCount=0,this.markerNests=new Array(e.maxNestCall),this.nestCount=0,this.markers.fill(new r,0,e.maxSamples),this.markerNests.fill(0,0,e.maxNestCall)}}();t.MarkerCollection=n;var r=function(){return function(){this.markerId=0,this.beginTime=0,this.endTime=0,this.color=0}}();t.Marker=r;var o=function(){return function(t){this.logs=new Array(e.maxBars),this.name=t,this.logs.fill(new s,0,e.maxBars)}}();t.MarkerInfo=o;var s=function(){return function(){this.snapMin=0,this.snapMax=0,this.snapAvg=0,this.min=0,this.max=0,this.avg=0,this.samples=0,this.color=0,this.initialized=!1}}();t.MarkerLog=s}(es||(es={})),function(t){var e=egret.Bitmap,i=function(){function i(){this.itemsToRaster=[],this.useCache=!1,this.cacheName="",this._sprites=new Map,this.allow4096Textures=!1}return i.prototype.addTextureToPack=function(e,i){this.itemsToRaster.push(new t.TextureToPack(e,i))},i.prototype.process=function(t){return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.allow4096Textures=t,this.useCache?""==this.cacheName?(console.error("未指定缓存名称"),[2]):[4,RES.getResByUrl(this.cacheName)]:[3,2];case 1:return e.sent()?this.loadPack():this.createPack(),[3,3];case 2:this.createPack(),e.label=3;case 3:return[2]}})})},i.prototype.loadPack=function(){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,RES.getResByUrl(this.cacheName)];case 1:return t=e.sent(),this.onProcessCompleted&&this.onProcessCompleted(),[2,t]}})})},i.prototype.createPack=function(){for(var i=[],n=[],r=0,o=this.itemsToRaster;ra||i[c].height>a)throw new Error("一个纹理的大小比图集的大小大");h.push(new t.Rectangle(0,0,i[c].width,i[c].height))}for(;h.length>0;){var u=new egret.RenderTexture,l=new t.RectanglePacker(a,a,1);for(c=0;c0){for(var p=new t.IntegerRectangle,d=[],f=[],g=[],m=[],y=0;y0;)this.freeRectangle(this._insertedRectangles.pop());for(;this._freeAreas.length>0;)this.freeRectangle(this._freeAreas.pop());for(this._width=t,this._height=e,this._packedWidth=0,this._packedHeight=0,this._freeAreas.push(this.allocateRectangle(0,0,this._width,this._height));this._insertedRectangles.length>0;)this.freeSize(this._insertList.pop());this._padding=i},e.prototype.insertRectangle=function(t,e,i){var n=this.allocateSize(t,e,i);this._insertList.push(n)},e.prototype.packRectangles=function(t){for(void 0===t&&(t=!0),t&&this._insertList.sort(function(t,e){return t.width-e.width});this._insertList.length>0;){var e=this._insertList.pop(),i=e.width,n=e.height,r=this.getFreeAreaIndex(i,n);if(r>=0){var o=this._freeAreas[r],s=this.allocateRectangle(o.x,o.y,i,n);for(s.id=e.id,this.generateNewFreeAreas(s,this._freeAreas,this._newFreeAreas);this._newFreeAreas.length>0;)this._freeAreas.push(this._newFreeAreas.pop());this._insertedRectangles.push(s),s.right>this._packedWidth&&(this._packedWidth=s.right),s.bottom>this._packedHeight&&(this._packedHeight=s.bottom)}this.freeSize(e)}return this.rectangleCount},e.prototype.getRectangle=function(t,e){var i=this._insertedRectangles[t];return e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height,e},e.prototype.getRectangleId=function(t){return this._insertedRectangles[t].id},e.prototype.generateNewFreeAreas=function(t,e,i){var n=t.x,r=t.y,o=t.right+1+this._padding,s=t.bottom+1+this._padding,a=null;0==this._padding&&(a=t);for(var h=e.length-1;h>=0;h--){var c=e[h];if(!(n>=c.right||o<=c.x||r>=c.bottom||s<=c.y)){null==a&&(a=this.allocateRectangle(t.x,t.y,t.width+this._padding,t.height+this._padding)),this.generateDividedAreas(a,c,i);var u=e.pop();h=0;e--)for(var i=t[e],n=t.length-1;n>=0;n--)if(e!=n){var r=t[n];if(i.x>=r.x&&i.y>=r.y&&i.right<=r.right&&i.bottom<=r.bottom){this.freeRectangle(i);var o=t.pop();e0&&(i.push(this.allocateRectangle(t.right,e.y,r,e.height)),n++);var o=t.x-e.x;o>0&&(i.push(this.allocateRectangle(e.x,e.y,o,e.height)),n++);var s=e.bottom-t.bottom;s>0&&(i.push(this.allocateRectangle(e.x,t.bottom,e.width,s)),n++);var a=t.y-e.y;a>0&&(i.push(this.allocateRectangle(e.x,e.y,e.width,a)),n++),0==n&&(t.width=0;s--){var a=this._freeAreas[s];if(a.x0){var r=this._sortableSizeStack.pop();return r.width=e,r.height=i,r.id=n,r}return new t.SortableSize(e,i,n)},e.prototype.freeSize=function(t){this._sortableSizeStack.push(t)},e.prototype.allocateRectangle=function(e,i,n,r){if(this._rectangleStack.length>0){var o=this._rectangleStack.pop();return o.x=e,o.y=i,o.width=n,o.height=r,o.right=e+n,o.bottom=i+r,o}return new t.IntegerRectangle(e,i,n,r)},e.prototype.freeRectangle=function(t){this._rectangleStack.push(t)},e}();t.RectanglePacker=e}(es||(es={})),function(t){var e=function(){return function(t,e,i){this.width=t,this.height=e,this.id=i}}();t.SortableSize=e}(es||(es={})),function(t){var e=function(){return function(t){this.assets=t}}();t.TextureAssets=e;var i=function(){return function(){}}();t.TextureAsset=i}(es||(es={})),function(t){var e=function(){return function(t,e){this.texture=t,this.id=e}}();t.TextureToPack=e}(es||(es={})); \ No newline at end of file diff --git a/source/src/ECS/Components/Sprite.ts b/source/src/ECS/Components/Sprite.ts index 19c54fb4..25528239 100644 --- a/source/src/ECS/Components/Sprite.ts +++ b/source/src/ECS/Components/Sprite.ts @@ -1,4 +1,8 @@ module es { + import RenderTexture = egret.RenderTexture; + import Bitmap = egret.Bitmap; + import SpriteSheet = egret.SpriteSheet; + export class Sprite { public texture2D: egret.Texture; public readonly sourceRect: Rectangle; @@ -22,5 +26,37 @@ module es { this.uvs.width = sourceRect.width * inverseTexW; this.uvs.height = sourceRect.height * inverseTexH; } + + /** + * 提供一个精灵的列/行等间隔的图集的精灵列表 + * @param texture + * @param cellWidth + * @param cellHeight + * @param cellOffset 处理时要包含的第一个单元格。基于0的索引 + * @param maxCellsToInclude 包含的最大单元 + */ + public static spritesFromAtlas(texture: egret.Texture, cellWidth: number, cellHeight: number, + cellOffset: number = 0, maxCellsToInclude: number = Number.MAX_VALUE){ + let sprites: Sprite[] = []; + let cols = texture.textureWidth / cellWidth; + let rows = texture.textureHeight / cellHeight; + let i = 0; + let spriteSheet = new SpriteSheet(texture); + + for (let y = 0; y < rows; y ++){ + for (let x = 0; x < cols; x ++) { + if (i++ < cellOffset) continue; + + let texture = spriteSheet.getTexture(`${y}_${x}`); + if (!texture) + texture = spriteSheet.createTexture(`${y}_${x}`, x * cellWidth, y * cellHeight, cellWidth, cellHeight); + sprites.push(new Sprite(texture)); + + if (sprites.length == maxCellsToInclude) return sprites; + } + } + + return sprites; + } } } diff --git a/source/src/ECS/Components/SpriteAnimator.ts b/source/src/ECS/Components/SpriteAnimator.ts index 6d649bf6..5964a06b 100644 --- a/source/src/ECS/Components/SpriteAnimator.ts +++ b/source/src/ECS/Components/SpriteAnimator.ts @@ -82,7 +82,7 @@ module es { this.animationState = State.completed; this._elapsedTime = 0; this.currentFrame = 0; - this.sprite = animation.sprites[this.currentFrame]; + (this.displayObject as egret.Bitmap).texture = animation.sprites[this.currentFrame].texture2D; return; } @@ -97,7 +97,7 @@ module es { this.currentFrame = i % n; } - this.sprite = animation.sprites[this.currentFrame]; + (this.displayObject as egret.Bitmap).texture = animation.sprites[this.currentFrame].texture2D; } /** @@ -123,8 +123,7 @@ module es { this.currentAnimationName = name; this.currentFrame = 0; this.animationState = State.running; - - this.sprite = this.currentAnimation.sprites[0]; + (this.displayObject as egret.Bitmap).texture = this.currentAnimation.sprites[0].texture2D; this._elapsedTime = 0; this._loopMode = loopMode ? loopMode : LoopMode.loop; } diff --git a/source/src/ECS/Core.ts b/source/src/ECS/Core.ts index 3736f653..0725aad3 100644 --- a/source/src/ECS/Core.ts +++ b/source/src/ECS/Core.ts @@ -203,7 +203,7 @@ module es { } if (this._nextScene) { - this.removeChild(this._scene); + if (this._scene.parent) this._scene.parent.removeChild(this._scene); this._scene.end(); this._scene = this._nextScene; diff --git a/source/src/ECS/Utils/ComponentList.ts b/source/src/ECS/Utils/ComponentList.ts index 9e4806dc..7eae0f41 100644 --- a/source/src/ECS/Utils/ComponentList.ts +++ b/source/src/ECS/Utils/ComponentList.ts @@ -157,7 +157,8 @@ module es { public handleRemove(component: Component) { // 处理渲染层列表 if (component instanceof RenderableComponent) { - this._entity.scene.removeChild(component.displayObject); + if (component.displayObject.parent) + component.displayObject.parent.removeChild(component.displayObject); this._entity.scene.renderableComponents.remove(component); } diff --git a/source/src/ECS/Utils/RenderableComponentList.ts b/source/src/ECS/Utils/RenderableComponentList.ts index 47753d42..fff7be26 100644 --- a/source/src/ECS/Utils/RenderableComponentList.ts +++ b/source/src/ECS/Utils/RenderableComponentList.ts @@ -109,7 +109,7 @@ module es { let component = this._components[i] as RenderableComponent; let egretDisplayObject = scene.$children.find(a => {return a.hashCode == component.displayObject.hashCode}); let displayIndex = scene.getChildIndex(egretDisplayObject); - if (displayIndex != i) scene.swapChildrenAt(displayIndex, i); + if (displayIndex != -1 && displayIndex != i) scene.swapChildrenAt(displayIndex, i); } } } diff --git a/source/src/Math/SubpixelFloat.ts b/source/src/Math/SubpixelFloat.ts new file mode 100644 index 00000000..fe675739 --- /dev/null +++ b/source/src/Math/SubpixelFloat.ts @@ -0,0 +1,32 @@ +module es { + /** + * 它存储值,直到累计的总数大于1。一旦超过1,该值将在调用update时添加到amount中 + * 一般用法如下: + * + * let deltaMove = this.velocity * es.Time.deltaTime; + * deltaMove.x = this._x.update(deltaMove.x); + * deltaMove.y = this._y.update(deltaMove.y); + */ + export class SubpixelFloat { + public remainder: number = 0; + + /** + * 以amount递增余数,将值截断,存储新的余数并将amount设置为当前值 + * @param amount + */ + public update(amount: number){ + this.remainder += amount; + let motion = Math.trunc(this.remainder); + this.remainder -= motion; + amount = motion; + return amount; + } + + /** + * 将余数重置为0 + */ + public reset(){ + this.remainder = 0; + } + } +} \ No newline at end of file diff --git a/source/src/Math/SubpixelVector2.ts b/source/src/Math/SubpixelVector2.ts new file mode 100644 index 00000000..f38b6838 --- /dev/null +++ b/source/src/Math/SubpixelVector2.ts @@ -0,0 +1,23 @@ +module es { + export class SubpixelVector2 { + public _x: SubpixelFloat = new SubpixelFloat(); + public _y: SubpixelFloat = new SubpixelFloat(); + + /** + * 以数量递增s/y余数,将值截断为整数,存储新的余数并将amount设置为当前值 + * @param amount + */ + public update(amount: Vector2) { + amount.x = this._x.update(amount.x); + amount.y = this._y.update(amount.y); + } + + /** + * 将余数重置为0 + */ + public reset(){ + this._x.reset(); + this._y.reset(); + } + } +} \ No newline at end of file diff --git a/source/src/Utils/ContentManager.ts b/source/src/Utils/ContentManager.ts index 4d80348e..aeb5de02 100644 --- a/source/src/Utils/ContentManager.ts +++ b/source/src/Utils/ContentManager.ts @@ -34,7 +34,8 @@ module es { public dispose() { this.loadedAssets.forEach(value => { let assetsToRemove = value; - assetsToRemove.dispose(); + if (RES.destroyRes(assetsToRemove)) + assetsToRemove.dispose(); }); this.loadedAssets.clear();