phaser3-rex-plugins
Version:
1 lines • 61.4 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexperspectiveimageplugin=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,y(n.key),n);}}function n(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e);}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function a(t,e){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},a(t,e)}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return !1}}();return function(){var i,n=s(t);if(e){var r=s(this).constructor;i=Reflect.construct(n,arguments,r);}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)}(this,i)}}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=u(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?t:i):r.value}},c.apply(this,arguments)}function l(t,e,i,n){return l="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var r,s=u(t,e);if(s){if((r=Object.getOwnPropertyDescriptor(s,e)).set)return r.set.call(n,i),!0;if(!r.writable)return !1}if(r=Object.getOwnPropertyDescriptor(n,e)){if(!r.writable)return !1;r.value=i,Object.defineProperty(n,e,r);}else !function(t,e,i){(e=y(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i;}(n,e,i);return !0},l(t,e,i,n)}function f(t,e,i,n,r){if(!l(t,e,i,n||t)&&r)throw new TypeError("failed to set property");return i}function d(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return v(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return v(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function y(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(t,"string");return "symbol"==typeof e?e:String(e)}var p=function(t){r(s,t);var i=h(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"tint",get:function(){return 0===this.vertices.length?16777215:this.vertices[0].color}},{key:"setInteractive",value:function(){var t=function(t,e,i){for(var n=this.faces,r=0;r<n.length;r++){if(n[r].contains(e,i))return !0}return !1}.bind(this);return this.scene.sys.input.enable(this,t),this}},{key:"forceUpdate",value:function(){return this.dirtyCache[10]=1,this}}]),s}(Phaser.GameObjects.Mesh),g=Phaser.Math.Vector3,m=Phaser.Math.Matrix4,k=new g,b=new g,P=new m,C=Phaser.Utils.Objects.IsPlainObject,x=Phaser.Utils.Objects.GetValue,w=Phaser.Geom.Mesh.GenerateGridVerts,R=Phaser.Math.RadToDeg,S=Phaser.Math.DegToRad,O=1+1/Math.sin(S(45)),A=function(t){r(a,t);var i=h(a);function a(t,n,r,s,o,h){var u;e(this,a),C(n)&&(n=x(h=n,"x",0),r=x(h,"y",0),s=x(h,"key",null),o=x(h,"frame",null)),(u=i.call(this,t,n,r,s,o)).type="rexPerspectiveImage",u.setSizeToFrame(),u.resetPerspective(),u.panZ(O),u.hideCCW=x(h,"hideCCW",!0);var c=x(h,"gridWidth",0),l=x(h,"gridHeight",c);return u.resetVerts(c,l),u.prevFrame=u.frame,u}return n(a,[{key:"preUpdate",value:function(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),c(s(a.prototype),"preUpdate",this).call(this,t,e);}},{key:"originX",get:function(){return .5}},{key:"originY",get:function(){return .5}},{key:"resetPerspective",value:function(){return this.setPerspective(this.width,this.height,45),this}},{key:"resetVerts",value:function(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,n=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(n/8,32):this.gridHeight,w({mesh:this,width:i/this.height,height:n/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(n/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}},{key:"syncSize",value:function(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}},{key:"rotationX",get:function(){return this.modelRotation.x},set:function(t){this.modelRotation.x=t;}},{key:"angleX",get:function(){return R(this.rotationX)},set:function(t){this.rotationX=S(t);}},{key:"rotationY",get:function(){return this.modelRotation.y},set:function(t){this.modelRotation.y=t;}},{key:"angleY",get:function(){return R(this.rotationY)},set:function(t){this.rotationY=S(t);}},{key:"rotationZ",get:function(){return this.modelRotation.z},set:function(t){this.modelRotation.z=t;}},{key:"angleZ",get:function(){return R(this.rotationZ)},set:function(t){this.rotationZ=S(t);}},{key:"transformVerts",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=n,this.transformInfo.rotateY=r,this.transformInfo.rotateZ=s,function(t,e,i,n,r,s,a){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),k.set(e,i,n),b.set(r,s,a),P.fromRotationXYTranslation(b,k,!0);for(var o=0,h=t.vertices.length;o<h;o++)t.vertices[o].transformMat4(P);}(this,t,e,i,n,r,s),this}}]),a}(p);function T(t,e,i,n,r){var s=new A(this.scene,t,e,i,n,r);return this.scene.add.existing(s),s}var j=Phaser.Utils.Objects.GetAdvancedValue,F=Phaser.GameObjects.BuildGameObject;function E(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=j(t,"key",null),n=j(t,"frame",null),r=new A(this.scene,0,0,i,n,t);return F(this.scene,r,t),r}var L,D=Phaser.Textures.DynamicTexture,_=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Y=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},M=Phaser.Geom.Rectangle,G=Phaser.Math.Vector2,X=Phaser.Math.RotateAround,I=function(t,e){if(void 0===e?e=new M:!0===e&&(void 0===V&&(V=new M),e=V),t.getBounds)return t.getBounds(e);var i,n,r,s,a,o,h,u;if(t.parentContainer){var c=t.parentContainer.getBoundsTransformMatrix();B(t,e),c.transformPoint(e.x,e.y,e),i=e.x,n=e.y,U(t,e),c.transformPoint(e.x,e.y,e),r=e.x,s=e.y,N(t,e),c.transformPoint(e.x,e.y,e),a=e.x,o=e.y,W(t,e),c.transformPoint(e.x,e.y,e),h=e.x,u=e.y;}else B(t,e),i=e.x,n=e.y,U(t,e),r=e.x,s=e.y,N(t,e),a=e.x,o=e.y,W(t,e),h=e.x,u=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(n,s,o,u),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(n,s,o,u)-e.y,e},V=void 0,B=function(t,e,i){return void 0===e?e=new G:!0===e&&(void 0===Z&&(Z=new G),e=Z),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-_(t)*t.originX,e.y=t.y-Y(t)*t.originY,z(t,e,i))},U=function(t,e,i){return void 0===e?e=new G:!0===e&&(void 0===Z&&(Z=new G),e=Z),t.getTopRight?t.getTopRight(e):(e.x=t.x-_(t)*t.originX+_(t),e.y=t.y-Y(t)*t.originY,z(t,e,i))},N=function(t,e,i){return void 0===e?e=new G:!0===e&&(void 0===Z&&(Z=new G),e=Z),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-_(t)*t.originX,e.y=t.y-Y(t)*t.originY+Y(t),z(t,e,i))},W=function(t,e,i){return void 0===e?e=new G:!0===e&&(void 0===Z&&(Z=new G),e=Z),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-_(t)*t.originX+_(t),e.y=t.y-Y(t)*t.originY+Y(t),z(t,e,i))},Z=void 0,z=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&X(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e},H=Phaser.Geom.Rectangle,J=Phaser.Geom.Rectangle.Union,$=function(e,i){var n=Array.isArray(e);if(void 0===i?i=n?[]:{}:function(e){if("object"!==t(e)||null===e)return e;if(Array.isArray(e))e.length=0;else for(var i in e)delete e[i];}(i),n){i.length=e.length;for(var r=0,s=e.length;r<s;r++)i[r]=e[r];}else for(var a in e)i[a]=e[a];return i},q=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);var n=t[0];return (i=n.displayList?n.displayList:n.parentContainer?n.parentContainer.list:n.scene.sys.displayList).depthSort&&(i.depthSort(),i=i.list),e?t.sort((function(t,e){return i.indexOf(e)-i.indexOf(t)})):t.sort((function(t,e){return i.indexOf(t)-i.indexOf(e)})),t},K=Phaser.GameObjects.GameObject,Q=Phaser.Utils.Objects.GetValue,tt=Phaser.Textures.DynamicTexture,et=Phaser.Utils.String.UUID,it=function(t){if(t){var e,i,n=t.gameObjects,r=t.renderTexture,s=Q(t,"x",void 0),a=Q(t,"y",void 0),o=Q(t,"width",void 0),h=Q(t,"height",void 0),u=Q(t,"originX",0),c=Q(t,"originY",0),l=Q(t,"padding",0);if(void 0===o||void 0===h||void 0===s||void 0===a){var f=function(t,e){var i;void 0===e?e=new H:!0===e&&(void 0===L&&(L=new H),e=L),e.setTo(0,0,0,0);for(var n=!0,r=0,s=t.length;r<s;r++)if((i=t[r]).getBounds){var a=I(i,!0);n?(e.setTo(a.x,a.y,a.width,a.height),n=!1):J(a,e,e);}return e}(n,!0);void 0!==s&&void 0!==a?(o=2*Math.max(s-f.left,f.right-s),h=2*Math.max(a-f.top,f.bottom-a),u=.5,c=.5):(s=f.x,a=f.y,o=f.width,h=f.height,u=0,c=0),e=f.x,i=f.y;}else e=s+(0-u)*o,i=a+(0-c)*h;e-=l,i-=l,o+=2*l,h+=2*l;var d=n[0].scene;v&&!r&&(r=new tt(d.sys.textures,et(),o,h)),r||(r=d.add.renderTexture(0,0,o,h)),r.setPosition&&r.setPosition(s,a),r.width===o&&r.height===h||r.setSize(o,h),r.setOrigin&&r.setOrigin(u,c),r.camera.setScroll(e,i),n=q($(n)),r.draw(n);var v=t.saveTexture;if(v)if(r instanceof K)r.saveTexture(v);else {var y=r,p=y.manager;p.exists(y.key)?p.renameTexture(y.key,key):(y.key=key,p.list[key]=y,p.emit("addtexture",key,y),p.emit("addtexture-".concat(key),y));}return r}},nt=Phaser.Utils.Objects.IsPlainObject,rt=Phaser.Utils.Objects.GetValue,st=function(t){r(a,t);var i=h(a);function a(t,n,r,s,o,h){var u;e(this,a),nt(n)&&(n=rt(h=n,"x",0),r=rt(h,"y",0),s=rt(h,"width",32),o=rt(h,"height",32));var c=function(t,e,i){return void 0===e&&(e=2),void 0===i&&(i=2),new D(t.sys.textures,null,e,i)}(t,s,o);return (u=i.call(this,t,n,r,c,null,h)).type="rexPerspectiveRenderTexture",u.rt=u.texture,u}return n(a,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(a.prototype),"destroy",this).call(this,t),this.rt.destroy(),this.rt=null);}},{key:"snapshot",value:function(t,e){return void 0===e&&(e={}),e.gameObjects=t,e.renderTexture=this.rt,it(e),this.width===this.frame.realWidth&&this.height===this.frame.realHeight||this.syncSize(),this}}]),a}(A);function at(t,e,i,n,r){var s=new st(this.scene,t,e,i,n,r);return this.scene.add.existing(s),s}var ot=Phaser.Utils.Objects.GetAdvancedValue,ht=Phaser.GameObjects.BuildGameObject;function ut(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=ot(t,"x",0),n=ot(t,"y",0),r=ot(t,"width",32),s=ot(t,"height",32),a=new st(this.scene,i,n,r,s,t);return ht(this.scene,a,t),a}var ct=Phaser.Animations.AnimationState,lt=Phaser.Utils.Objects.IsPlainObject,ft=Phaser.Utils.Objects.GetValue,dt=function(t){r(a,t);var i=h(a);function a(t,n,r,s,h,u){var c;return e(this,a),lt(n)&&(n=ft(u=n,"x",0),r=ft(u,"y",0),s=ft(u,"key",null),h=ft(u,"frame",null)),(c=i.call(this,t,n,r,s,h,u)).type="rexPerspectiveSprite",c.anims=new ct(o(c)),c}return n(a,[{key:"preDestroy",value:function(){c(s(a.prototype),"preDestroy",this).call(this),this.anims.destroy(),this.anims=void 0;}},{key:"preUpdate",value:function(t,e){this.anims.update(t,e),c(s(a.prototype),"preUpdate",this).call(this,t,e);}},{key:"play",value:function(t,e,i){return this.anims.play(t,e,i)}},{key:"playReverse",value:function(t,e){return this.anims.playReverse(t,e)}},{key:"playAfterDelay",value:function(t,e){return this.anims.playAfterDelay(t,e)}},{key:"playAfterRepeat",value:function(t,e){return this.anims.playAfterRepeat(t,e)}},{key:"chain",value:function(t){return this.anims.chain(t)}},{key:"stop",value:function(){return this.anims.stop()}},{key:"stopAfterDelay",value:function(t){return this.anims.stopAfterDelay(t)}},{key:"stopAfterRepeat",value:function(t){return this.anims.stopAfterRepeat(t)}},{key:"stopOnFrame",value:function(t){return this.anims.stopOnFrame(t)}}]),a}(A);function vt(t,e,i,n,r){var s=new dt(this.scene,t,e,i,n,r);return this.scene.add.existing(s),s}var yt=Phaser.Utils.Objects.GetAdvancedValue,pt=Phaser.GameObjects.BuildGameObject;function gt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=yt(t,"key",null),n=yt(t,"frame",null),r=new dt(this.scene,0,0,i,n,t);return pt(this.scene,r,t),r}var mt,kt=!1;kt||(void 0===mt&&(mt=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<mt&&console.error("Minimum supported version : 3.".concat(mt)),kt=!0);var bt=Phaser.GameObjects.Zone,Pt=Phaser.Utils.Array.Add,Ct=Phaser.Utils.Array.Remove,xt=function(t){r(a,t);var i=h(a);function a(t,n,r,s,o){var h;return e(this,a),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===o&&(o=1),(h=i.call(this,t,n,r,s,o)).children=[],h}return n(a,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(a.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return Pt(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return Ct(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i<n;i++)(e=this.children[i]).off("destroy",this.onChildDestroy,this),t&&e.destroy();return this.children.length=0,this}}]),a}(bt),wt=Phaser.GameObjects.Components;Phaser.Class.mixin(xt,[wt.Alpha,wt.Flip]);var Rt=function t(e,i){var n;if(void 0===i)e.hasOwnProperty("rexContainer")&&(n=e.rexContainer.parent);else for(n=t(e);n&&n.name!==i;)n=t(n);return n},St=Phaser.Math.DegToRad,Ot=Phaser.Math.RadToDeg,At=function(t){if(!t.hasOwnProperty("rexContainer")){var e={parent:null,self:null,layer:null,x:0,y:0,syncPosition:!0,rotation:0,syncRotation:!0,scaleX:0,scaleY:0,syncScale:!0,alpha:0,syncAlpha:!0,visible:!0,active:!0};Object.defineProperty(e,"angle",{get:function(){return Ot(this.rotation)},set:function(t){this.rotation=St(t);}}),Object.defineProperty(e,"displayWidth",{get:function(){return t.width*this.scaleX},set:function(e){this.scaleX=e/t.width;}}),Object.defineProperty(e,"displayHeight",{get:function(){return t.height*this.scaleY},set:function(e){this.scaleY=e/t.height;}}),t.rexContainer=e;}return t.rexContainer},Tt={setParent:function(t,e){void 0===e&&(e=this);var i=At(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Rt(t,e)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=Rt(t);e;)t=e,e=Rt(e);return t}(t)}},jt=Phaser.Utils.Objects.GetValue,Ft=xt.prototype.add,Et=function(t,e){this.setParent(t);var i=At(t);return Dt(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),Ft.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},Lt=function(t,e){this.setParent(t);var i=At(t);return Dt(i,e),i.x=t.x,i.y=t.y,i.rotation=t.rotation,i.scaleX=t.scaleX,i.scaleY=t.scaleY,i.alpha=t.alpha,i.visible=t.visible,i.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),Ft.call(this,t),this.addToRenderLayer(t),this},Dt=function(t,e){void 0===e&&(e=!0),"boolean"==typeof e?(t.syncPosition=e,t.syncRotation=e,t.syncScale=e,t.syncAlpha=e,t.syncScrollFactor=e):(t.syncPosition=jt(e,"syncPosition",!0),t.syncRotation=jt(e,"syncRotation",!0),t.syncScale=jt(e,"syncScale",!0),t.syncAlpha=jt(e,"syncAlpha",!0),t.syncScrollFactor=jt(e,"syncScrollFactor",!0));},_t={add:function(t){return Array.isArray(t)?this.addMultiple(t):Et.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):Et.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)Et.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):Lt.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):Lt.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)Lt.call(this,t[e]);return this}},Yt=xt.prototype.remove,Mt=xt.prototype.clear,Gt={remove:function(t,e){return Rt(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),Yt.call(this,t,e)),this},unpin:function(t,e){return Rt(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),Yt.call(this,t,e)),this},clear:function(t){for(var e=this.children,i=0,n=e.length;i<n;i++){var r=e[i];this.setParent(r,null),t||this.removeFromRenderLayer(r);}return Mt.call(this,t),this}},Xt={getLocalState:function(t){return At(t)},resetChildState:function(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState:function(t){for(var e=0,i=t.length;e<i;e++)this.resetChildState(t[e]);return this},syncProperties:function(){return this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask(),this}},It=Phaser.Math.RotateAround,Vt={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,It(t,0,0,-this.rotation),t.x/=this.scaleX,t.y/=this.scaleY,t},localToWorld:function(t){return t.x*=this.scaleX,t.y*=this.scaleY,It(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},Bt=function(t,e){return t===e?1:t/e},Ut={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=At(t),i=e.parent;return e.syncPosition&&(t.x=e.x,t.y=e.y,i.localToWorld(t)),e.syncRotation&&(t.rotation=e.rotation+i.rotation),e.syncScale&&(t.scaleX=e.scaleX*i.scaleX,t.scaleY=e.scaleY*i.scaleY),t.isRexContainerLite&&(t.syncChildrenEnable=!0,t.syncPosition()),this},syncPosition:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildPosition,this),this},resetChildPositionState:function(t){var e=At(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=Bt(t.scaleX,i.scaleX),e.scaleY=Bt(t.scaleY,i.scaleY),e.rotation=t.rotation-i.rotation,this},setChildPosition:function(t,e,i){return t.x=e,t.y=i,this.resetChildPositionState(t),this},setChildLocalPosition:function(t,e,i){var n=At(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=At(this).parent;return t&&t.resetChildPositionState(this),this}},Nt=Phaser.Math.DegToRad,Wt={updateChildRotation:function(t){var e=At(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState:function(t){var e=At(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation:function(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle:function(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation:function(t,e){return At(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return At(t).rotation=Nt(e),this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=At(this).parent;return t&&t.resetChildRotationState(this),this}},Zt={updateChildScale:function(t){var e=At(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState:function(t){var e=At(t),i=e.parent;return e.scaleX=Bt(t.scaleX,i.scaleX),e.scaleY=Bt(t.scaleY,i.scaleY),this},setChildScale:function(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale:function(t,e,i){void 0===i&&(i=e);var n=At(t);return n.scaleX=e,n.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize:function(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState:function(){var t=At(this).parent;return t&&t.resetChildScaleState(this),this}},zt={updateChildVisible:function(t){var e=At(t),i=e.parent,n=!e.hasOwnProperty("maskVisible")||e.maskVisible;return t.visible=i.visible&&e.visible&&n,this},syncVisible:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState:function(t){var e=At(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible:function(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible:function(t,e){return void 0===e&&(e=!0),At(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),At(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=At(this).parent;return t&&t.resetChildVisibleState(this),this}},Ht={updateChildAlpha:function(t){var e=At(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){var e=At(t),i=e.parent;return e.alpha=Bt(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return At(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=At(this).parent;return t&&t.resetChildAlphaState(this),this}},Jt={updateChildActive:function(t){var e=At(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState:function(t){return At(t).active=t.active,this},setChildActive:function(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive:function(t,e){return void 0===e&&(e=!0),At(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=At(this).parent;return t&&t.resetChildActiveState(this),this}},$t={updateChildScrollFactor:function(t){var e=At(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},qt={updateChildMask:function(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask:function(t){return this.mask=t,this},clearMask:function(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t);})),t&&this.mask&&this.mask.destroy(),this}},Kt={setDepth:function(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),n=0,r=i.length;n<r;n++)i[n].depth=t;return this},swapDepth:function(t){var e=this.depth,i=t.depth;return this.setDepth(i),t.setDepth(e),this},incDepth:function(t){if(this.depth+=t,this.children)for(var e=this.getAllChildren(),i=0,n=e.length;i<n;i++)e[i].depth+=t;return this},bringToTop:function(){var t=this.displayList,e=this.getAllChildren([this]);q(e,!1);for(var i=0,n=e.length;i<n;i++){var r=e[i];t.exists(r)&&t.bringToTop(r);}return this},moveDepthBelow:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);q(i,!1);for(var n=0,r=i.length;n<r;n++){var s=i[n];if(e.exists(s)){e.moveBelow(t,s);break}}return this},moveDepthAbove:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);q(i,!0);for(var n=0,r=i.length;n<r;n++){var s=i[n];if(e.exists(s)){e.moveAbove(t,s);break}}return this},bringChildToTop:function(t){var e=this.getAllChildren([this]);q(e,!0);var i=e[0];return i===t||i.displayList!==t.displayList||i.displayList.moveAbove(t,i),this},sendChildToBack:function(t){var e=this.getAllChildren([this]);q(e,!1);var i=e[0];return i===t||i.displayList!==t.displayList||i.displayList.moveBelow(t,i),this}},Qt=function t(e,i){if(!i(e)&&e.isRexContainerLite)for(var n=e.children,r=0,s=n.length;r<s;r++)t(n[r],i);},te=function(t,e){for(var i=[t];i.length>0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,d(n.children));}},ee=Phaser.Utils.Array,ie={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e<i;e++)t.push(this.children[e]);else t=this.children;return t},getAllChildren:function(t){void 0===t&&(t=[]);var e=this;return te(e,(function(i){i!==e&&t.push(i);})),t},getAllVisibleChildren:function(t){void 0===t&&(t=[]);var e=this;return te(e,(function(i){if(i!==e)return !i.visible||void t.push(i)})),t},bfs:function(t,e){return void 0===e&&(e=this),te(e,t),this},dfs:function(t,e){return void 0===e&&(e=this),Qt(e,t),this},contains:function(t){var e=Rt(t);return !!e&&(e===this||this.contains(e))},getByName:function(t,e){if(e){for(var i,n,r=[this];r.length;)for(var s=0,a=(i=r.shift()).children.length;s<a;s++){if((n=i.children[s]).name===t)return n;n.isRexContainerLite&&r.push(n);}return null}return ee.GetFirst(this.children,"name",t)},getRandom:function(t,e){return ee.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return ee.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return ee.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return ee.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return ee.Swap(this.children,t,e),this},setAll:function(t,e,i,n){return ee.SetAll(this.children,t,e,i,n),this}},ne=function(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];r.hasOwnProperty("rexContainer")&&e.push(r.rexContainer);}return e},re=function(t,e,i){if(i.parent){var n=i.parent,r=i.self;switch(e){case"x":case"y":n.updateChildPosition(r);break;case"angle":case"rotation":n.updateChildRotation(r);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":n.updateChildScale(r);break;case"alpha":n.updateChildAlpha(r);break;default:n.updateChildPosition(r),n.updateChildRotation(r),n.updateChildScale(r),n.updateChildAlpha(r);}}else t.remove();},se={tweenChild:function(t){var e=t.targets;Array.isArray(e)||(e=[e]);var i=this.scene||function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e].scene;if(n)return n}return null}(e);if(i){t.targets=ne(e);var n=i.tweens.add(t);return n.on("update",re),n}},tweenSelf:function(t){return t.targets=[this],this.tweenChild(t)},createTweenChildConfig:function(t){var e=t.targets;e&&(Array.isArray(e)||(e=[e]),t.targets=ne(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),re(t,void 0,e);},t},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},ae=Phaser.GameObjects.Container,oe=Phaser.GameObjects.Layer,he=function(t){return t instanceof oe},ue=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return !!t.displayList||!!t.parentContainer}))},ce=function(t){var e=ue(this);return q(e),t.add(e),this},le=function(t,e,i){var n=ue(this);return q(n,e),t.remove(n),i&&n.forEach((function(t){t.addToDisplayList();})),this},fe={addToContainer:function(t){return t instanceof ae?(this._setParentContainerFlag=!0,ce.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer:function(t){return he(t)?(ce.call(this,t),this):this},removeFromContainer:function(){return this.parentContainer?(this._setParentContainerFlag=!0,le.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer:function(t){return void 0===t&&(t=!0),he(this.displayList)?(le.call(this,this.displayList,!1,t),this):this},getParentContainer:function(){if(this.parentContainer)return this.parentContainer;for(var t=this.getParent();t;){var e=t.parentContainer;if(e)return e;t=t.getParent();}return null},addToParentContainer:function(t){if(!t.displayList)return this;var e=this.getParentContainer();return e?(t.isRexContainerLite?t.addToContainer(e):e.add(t),this):this}},de={hasLayer:function(){return !!this.privateRenderLayer},enableLayer:function(){if(this.hasLayer())return this;var t=this.scene.add.layer();return this.moveDepthBelow(t),this.addToLayer(t),this.privateRenderLayer=t,this},getLayer:function(){return this.hasLayer()||this.enableLayer(),this.privateRenderLayer},getRenderLayer:function(){if(this.hasLayer())return this.privateRenderLayer;for(var t=this.getParent();t;){var e=t.privateRenderLayer;if(e)return e;t=t.getParent();}return null},addToRenderLayer:function(t){if(!t.displayList)return this;var e=this.getRenderLayer();return e?(t.isRexContainerLite?t.addToLayer(e):e.add(t),At(t).layer=e,this):this},removeFromRenderLayer:function(t){var e=At(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},ve={snapshot:function(t){var e=this.scaleX,i=this.scaleY,n=1===e&&1===i;n||this.setScale(1),void 0===t&&(t={}),t.gameObjects=this.getAllVisibleChildren(),t.x=this.x,t.y=this.y,t.originX=this.originX,t.originY=this.originY;var r=it(t),s=!!r.scene;return n||(this.setScale(e,i),s&&r.setScale(e,i)),s?r:this}},ye=Phaser.Utils.Objects.GetValue,pe=function(t,e,i,n,r,s,a){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===n&&(n=1),void 0===r&&(r=null),void 0===s&&(s=1),void 0===a&&(a=0);var o=B(t,ge[0]);o.x-=a,o.y-=a;var h=U(t,ge[1]);h.x+=a,h.y-=a;var u=W(t,ge[2]);u.x+=a,u.y+=a;var c=N(t,ge[3]);c.x-=a,c.y+=a,null!==r&&e.fillStyle(r,s).fillPoints(ge,!0,!0),null!==i&&e.lineStyle(n,i).strokePoints(ge,!0,!0);}},ge=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],me=Phaser.Utils.Objects.GetValue,ke=Phaser.Math.RotateAround,be={changeOrigin:function(t,e){this.syncChildrenEnable=!1,function(t,e,i){void 0===i&&(i=e);var n={x:(e-t.originX)*t.displayWidth,y:(i-t.originY)*t.displayHeight};ke(n,0,0,t.rotation),t.originX=e,t.originY=i,t.x=t.x+n.x,t.y=t.y+n.y;}(this,t,e),this.syncChildrenEnable=!0;for(var i=this.getAllChildren(),n=0,r=i.length;n<r;n++)this.resetChildPositionState(i[n]);return this},drawBounds:function(t,e){var i=me(e,"drawContainer",!0),n=me(e,"children");return void 0===n&&(n=this.getAllVisibleChildren([this])),i||(n=n.filter((function(t){return !t.isRexContainerLite}))),function(t,e,i){var n,r,s,a,o;if("number"==typeof i?n=i:(n=ye(i,"color"),r=ye(i,"lineWidth"),s=ye(i,"fillColor"),a=ye(i,"fillAlpha",1),o=ye(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h<u;h++)pe(t[h],e,n,r,s,a,o);else pe(t,e,n,r,s,a,o);}(n,t,e),this}};Object.assign(be,Tt,_t,Gt,Xt,Vt,Ut,Wt,Zt,zt,Ht,Jt,$t,qt,Kt,ie,se,fe,de,ve);var Pe=function(t){r(a,t);var i=h(a);function a(t,n,r,s,o,h){var u;return e(this,a),Array.isArray(s)&&(h=s,s=void 0,o=void 0),(u=i.call(this,t,n,r,s,o)).type="rexContainerLite",u.isRexContainerLite=!0,u.syncChildrenEnable=!0,u._active=!0,u._mask=null,u._scrollFactorX=1,u._scrollFactorY=1,u.privateRenderLayer=void 0,h&&u.add(h),u}return n(a,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,c(s(a.prototype),"destroy",this).call(this,t),this.privateRenderLayer&&(this.privateRenderLayer.list.length=0,this.privateRenderLayer.destroy()));}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"x",get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.syncPosition());}},{key:"y",get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.syncPosition());}},{key:"rotation",get:function(){return c(s(a.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(f(s(a.prototype),"rotation",t,this,!0),this.syncPosition());}},{key:"scaleX",get:function(){return c(s(a.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(f(s(a.prototype),"scaleX",t,this,!0),this.syncPosition());}},{key:"scaleY",get:function(){return c(s(a.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(f(s(a.prototype),"scaleY",t,this,!0),this.syncPosition());}},{key:"scale",get:function(){return c(s(a.prototype),"scale",this)},set:function(t){this.scale!==t&&(f(s(a.prototype),"scale",t,this,!0),this.syncPosition());}},{key:"visible",get:function(){return c(s(a.prototype),"visible",this)},set:function(t){c(s(a.prototype),"visible",this)!==t&&(f(s(a.prototype),"visible",t,this,!0),this.syncVisible());}},{key:"alpha",get:function(){return c(s(a.prototype),"alpha",this)},set:function(t){c(s(a.prototype),"alpha",this)!==t&&(f(s(a.prototype),"alpha",t,this,!0),this.syncAlpha());}},{key:"active",get:function(){return this._active},set:function(t){this._active!==t&&(this._active=t,this.syncActive());}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.syncMask());}},{key:"scrollFactorX",get:function(){return this._scrollFactorX},set:function(t){this._scrollFactorX!==t&&(this._scrollFactorX=t,this.syncScrollFactor());}},{key:"scrollFactorY",get:function(){return this._scrollFactorY},set:function(t){this._scrollFactorY!==t&&(this._scrollFactorY=t,this.syncScrollFactor());}},{key:"list",get:function(){return this.children}},{key:"parentContainer",get:function(){return this._parentContainer},set:function(t){this._parentContainer||t?this.setParentContainerFlag?this._parentContainer=t:this._parentContainer&&!t?(this.removeFromContainer(),this._parentContainer=t):t?(this._parentContainer=t,this.addToContainer(t)):this._parentContainer=t:this._parentContainer=t;}},{key:"setParentContainerFlag",get:function(){if(this._setParentContainerFlag)return !0;var t=Rt(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return Rt(t)}}]),a}(xt);Object.assign(Pe.prototype,be);var Ce=function(t,e,i,n){if(Array.isArray(t))for(var r=0,s=t.length;r<s;r++){var a=t[r];if((!n||a)&&(i?e.call(i,a,r,t):e(a,r,t)))return}else {for(var o in t){a=t[o];if((!n||a)&&(i?e.call(i,a,o,t):e(a,o,t)))return}}},xe=Phaser.Math.RadToDeg,we=Phaser.Math.DegToRad,Re=function(t){r(s,t);var i=h(s);function s(t,n,r,a,h,u){var c;return e(this,s),(c=i.call(this,t,n,r,a,h)).faces=u,Ce(u,(function(t){t.setPosition(n,r),this.add(t);}),o(c),!0),c}return n(s,[{key:"rotationX",get:function(){return 0},set:function(t){}},{key:"angleX",get:function(){return xe(this.rotationX)},set:function(t){this.rotationX=we(t);}},{key:"rotateX",get:function(){return xe(this.rotationX)},set:function(t){this.rotationX=we(t);}},{key:"rotationY",get:function(){return 0},set:function(t){}},{key:"angleY",get:function(){return xe(this.rotationY)},set:function(t){this.rotationY=we(t);}},{key:"rotateY",get:function(){return xe(this.rotationY)},set:function(t){this.rotationY=we(t);}},{key:"rotationZ",get:function(){return 0},set:function(t){}},{key:"angleZ",get:function(){return xe(this.rotationZ)},set:function(t){this.rotationZ=we(t);}},{key:"rotateZ",get:function(){return xe(this.rotationZ)},set:function(t){this.rotationZ=we(t);}},{key:"setDebug",value:function(t,e){return Ce(this.faces,(function(i){i.setDebug(t,e);}),null,!0),this}},{key:"panX",value:function(t){return Ce(this.faces,(function(e){e.panX(t);}),null,!0),this}},{key:"panY",value:function(t){return Ce(this.faces,(function(e){e.panY(t);}),null,!0),this}},{key:"panZ",value:function(t){return Ce(this.faces,(function(e){e.panZ(t);}),null,!0),this}},{key:"transformVerts",value:function(t,e,i,n,r,s){return Ce(this.faces,(function(a){a.transformVerts(t,e,i,n,r,s);}),null,!0),this}},{key:"forEachFace",value:function(t,e,i){return Ce(this.faces,t,e,i),this}}]),s}(Pe),Se=Phaser.Utils.Objects.IsPlainObject,Oe={key:"__WHITE"},Ae={image:A,rendertexture:st},Te=function(t,e){var i;return void 0===e&&(e=Oe),Se(e)?(e.hasOwnProperty("type")||(e.hasOwnProperty("key")?e.type="image":e.hasOwnProperty("width")&&(e.type="rendertexture")),i=new Ae[e.type](t,e),t.add.existing(i)):i=e,i},je=function(t,e,i){var n;if(void 0===i){var r;n=[];for(var s=0,a=e.length;s<a;s++)o=(r=e[s])?Te(t,r):null,n.push(o);}else {var o,h;n={};for(s=0,a=i.length;s<a;s++)h=i[s],o=e.hasOwnProperty(h)?Te(t,e[h]):null,n[h]=o;}return n},Fe=(0, Phaser.Math.DegToRad)(180),Ee={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},Le=Phaser.Scene,De=function(t){return t instanceof Le},_e=Phaser.Game,Ye=function(t){return t instanceof _e},Me=Phaser.Utils.Objects.GetValue,Ge=function(){function i(t,n){e(this,i),this.setParent(t),this.isShutdown=!1,this.setEventEmitter(Me(n,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this));}return n(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0);}},{key:"destroy",value:function(t){this.shutdown(t);}},{key:"onEnvDestroy",value:function(){this.destroy(!0);}},{key:"onParentDestroy",value:function(t,e){this.destroy(e);}},{key:"setParent",value:function(e){var i;return this.parent=e,this.scene=null==(i=e)||"object"!==t(i)?null:De(i)?i:i.scene&&De(i.scene)?i.scene:i.parent&&i.parent.scene&&De(i.parent.scene)?i.parent.scene:null,this.game=function(e){return null==e||"object"!==t(e)?null:Ye(e)?e:Ye(e.game)?e.game:De(e)?e.sys.game:De(e.scene)?e.scene.sys.game:void 0}(e),this}}]),i}();Object.assign(Ge.prototype,Ee);var Xe=Phaser.Utils.Objects.GetValue,Ie=function(t){r(a,t);var i=h(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,n))._isRunning=!1,r.isPaused=!1,r.tickingState=!1,r.setTickingMode(Xe(n,"tickingMode",1)),r}return n(a,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking();}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),c(s(a.prototype),"shutdown",this).call(this,t));}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=Ve[t]),this.tickingMode=t;}},{key:"startTicking",value:function(){this.tickingState=!0;}},{key:"stopTicking",value:function(){this.tickingState=!1;}},{key:"isRunning",get:function(){return this._isRunning},set:function(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()));}},{key:"start",value:function(){return this.isPaused=!1,this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}},{key:"resume",value:function(){return this.isPaused&&(this.isRunning=!0),this}},{key:"stop",value:function(){return this.isPaused=!1,this.isRunning=!1,this}},{key:"complete",value:function(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this);}}]),a}(Ge),Ve={no:0,lazy:1,always:2},Be=Phaser.Utils.Objects.GetValue,Ue=function(t){r(a,t);var i=h(a);function a(t,n){var r;e(this,a);var s=(r=i.call(this,t,n)).scene?"update":"step";return r.tickEventName=Be(n,"tickEventName",s),r.isSceneTicker=!Ne(r.tickEventName),r}return n(a,[{key:"startTicking",value:function(){c(s(a.prototype),"startTicking",this).call(this),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this);}},{key:"stopTicking",value:function(){c(s(a.prototype),"stopTicking",this).call(this),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this);}}]),a}(Ie),Ne=function(t){return "step"===t||"poststep"===t},We=Phaser.Utils.Objects.GetValue,Ze=Phaser.Math.Clamp,ze=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.state=We(t,"state",He),this.timeScale=We(t,"timeScale",1),this.delay=We(t,"delay",0),this.repeat=We(t,"repeat",0),this.repeatCounter=We(t,"repeatCounter",0),this.repeatDelay=We(t,"repeatDelay",0),this.duration=We(t,"duration",0),this.nowTime=We(t,"nowTime",0),this.justRestart=We(t,"justRestart",!1);}},{key:"toJSON",value:function(){return {state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}},{key:"destroy",value:function(){}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setDelay",value:function(t){return void 0===t&&(t=0),this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatInfinity",value:function(){return this.repeat=-1,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"start",value:function(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?$e:Je,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=He,this}},{key:"update",value:function(t,e){this.state!==He&&this.state!==Ke&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration,this.repeatDelay>0&&(this.nowTime-=this.repeatDelay,this.state=qe)):(this.nowTime=this.duration,this.state=Ke):this.nowTime>=0&&(this.state=$e));}},{key:"t",get:function(){var t;switch(this.state){case He:case Je:case qe:t=0;break;case $e:t=this.nowTime/this.duration;break;case Ke:t=1;}return Ze(t,0,1)},set:function(t){(t=Ze(t,-1,1))<0?(this.state=Je,this.nowTime=-this.delay*t):(this.state=$e,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===He}},{key:"isDelay",get:function(){return this.state===Je}},{key:"isCountDown",get:function(){return this.state===$e}},{key:"isRunning",get:function(){return this.state===Je||this.state===$e}},{key:"isDone",get:function(){return this.state===Ke}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),He=0,Je=1,$e=2,qe=3,Ke=-1,Qe=function(t){r(a,t);var i=h(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,n)).timer=new ze,r}return n(a,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(a.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(a.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(a.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(a.prototype),"complete",this).call(this),this}}]),a}(Ue),ti=Phaser.Utils.Objects.GetValue,ei=Phaser.Utils.Objects.GetAdvancedValue,ii=Phaser.Tweens.Builders.GetEaseFunction,ni=function(t){r(a,t);var i=h(a);function a(){return e(this,a),i.apply(this,arguments)}return n(a,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(ti(t,"timer")),this.setEnable(ti(t,"enable",!0)),this.setTarget(ti(t,"target",this.parent)),this.setDelay(ei(t,"delay",0)),this.setDuration(ei(t,"duration",1e3)),this.setEase(ti(t,"ease","Linear")),this.setRepeat(ti(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ii(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(a.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(a.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),a}(Qe),ri=Phaser.Utils.Objects.GetValue,si=Phaser.Math.Linear,ai=function(t){r(a,t);var i=h(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(a,[{key:"resetFromJSON",value:function(t){return c(s(a.prototype),"resetFromJSON",this).call(this,t),this.setEase(ri(t,"ease","Cubic")),this.setFrontToBackDirection(ri(t,"frontToBack",0)),this.setBackToFrontDirection(ri(t,"backToFront",1)),this}},{key:"setFrontToBackDirection",value:function(t){return "string"==typeof t&&(t=oi[t]),this.endAngleFB=0===t?180:-180,this}},{key:"setBackToFrontDirection",value:function(t){return "string"==typeof t&&(t=oi[t]),this.endAngleBF=0===t?-180:180,this}},{key:"start",value:function(t,e){if(this.timer.isRunning)return this;this.timer.setDelay(this.delay).setDuration(t);var i=e+1;return 0===this.parent.face?(this.startAngle=0,this.endAngle=this.endAngleFB*i):(this.startAngle=this.endAngleBF,this.endAngle=this.startAngle-this.endAngleBF*i),c(s(a.prototype),"start",this).call(this),this}},{key:"flip",value:function(t,e){return this.isRunning||(void 0===t&&(t=this.duration),void 0===e&&(e=0),this.start(t,e),this.emit("start",this.parent,this),this.parent.currentFaceIndex=(this.parent.currentFaceIndex+e+1)%2),this}},{key:"flipRight",value:function(t,e){return 0===this.parent.currentFaceIndex?this.setFrontToBackDirection(0):this.setBackToFrontDirection(0),this.flip(t,e),this}},{key:"flipLeft",value:function(t,e){return 0===this.parent.currentFaceIndex?this.setFrontToBackDirection(1):this.setBackToFrontDirection(1),this.flip(t,e)